2 years ago

#8950

test-img

fathawk

How to create keywords from an API generated list and look for them in Social Media using Python?

What I have to do is Step 1: use the https://newsapi.org/ and Python to generate the top 10 daily news Step 2: save keywords of these news and look for related tweets and posts on reddit in real time and save the related content automatically, also in real time

I am stuck on step 2

This is what I have so far

import requests
def topnews():
    query_params = {
        "source": "bbc-news",
        "sortBy": "top",
        "apiKey": "4dbc17e007ab436fb66416009dfb59a8"
    }
    url = " https://newsapi.org/v1/articles"
    res = requests.get(url, params=query_params)
    news = res.json()

    article = news["articles"]

    results = []

    for ar in article:
        results.append(ar["title"])

    for i in range(len(results)):
        print(i + 1, results[i])


if __name__ == '__main__':
    topnews()

python

api

twitter

reddit

social-media

0 Answers

Your Answer

Accepted video resources