Another option is the pytrends package from Google. Here is a quick function to grab a random trending search term from the US so that you can feed it into your AI prompts. There is much cooler stuff you can do with google but they are pretty rate limited for free requests.

from pytrends.request import TrendReq

pytrend= TrendReq()

def GetTrendingTopic():

df = pytrend.trending_searches(pn='united_states')

try:

# Grab a random trending event from today and grab as plaintext string from dataframe:

return str(df.sample(n=1).values[0]).split("\'")[1]

except:

return None

Reply to this note

Please Login to reply.

Discussion

No replies yet.