Merge pull request #20 from bellingcat/galen-endpoint-fix

Add subdomain to Reddit endpoint to avoid redirect
This commit is contained in:
Richard Mwewa
2023-11-30 15:59:07 +02:00
committed by GitHub
2 changed files with 2 additions and 2 deletions

View File

@@ -16,7 +16,7 @@ Public Class ApiHandler
''' </summary>
''' <returns>Json object containing scraped data.</returns>
Public Async Function ScrapeRedditAsync(subreddit As String, listing As String, limit As Integer, timeframe As String) As Task(Of JObject)
Dim ApiEndpoint As String = $"https://reddit.com/r/{subreddit}/{listing}.json?limit={limit}&t={timeframe}"
Dim ApiEndpoint As String = $"https://www.reddit.com/r/{subreddit}/{listing}.json?limit={limit}&t={timeframe}"
Return Await GetJObjectFromEndpointAsync(endpoint:=ApiEndpoint)
End Function

View File

@@ -102,7 +102,7 @@ def get_posts(args: argparse):
# Send a GET request to the specified subreddit and listing,
# limiting the response by the specified limit and timeframe.
response = session.get(
f"https://reddit.com/r/{subreddit}/{listing}"
f"https://www.reddit.com/r/{subreddit}/{listing}"
f".json?limit={limit}&t={timeframe}"
).json()