Created
August 28, 2022 14:41
-
-
Save gamingflexer/3e84ebc02d375b844fc5b78020fe3736 to your computer and use it in GitHub Desktop.
Scrape Top Headlines For a Particular Hashtags
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import requests,json | |
API_KEY = "" | |
def headline_script(): | |
url = "https://contextualwebsearch-websearch-v1.p.rapidapi.com/api/search/NewsSearchAPI" | |
querystring = {"q":"TOPIC NEEDED","pageNumber":"1","pageSize":"10","autoCorrect":"true","fromPublishedDate":"null","toPublishedDate":"null"} | |
headers = { | |
"X-RapidAPI-Key": API_KEY, | |
"X-RapidAPI-Host": "contextualwebsearch-websearch-v1.p.rapidapi.com" | |
} | |
response = requests.request("GET", url, headers=headers, params=querystring) | |
return json.loads(response.text) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment