OrangeCrush on Nostr: Another option is the pytrends package from Google. Here is a quick function to grab ...
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
Published at
2024-04-06 07:45:19Event JSON
{
"id": "0b87b1fbdbae799e572e68c2f2e561e039f113302557a97f79e9e418a37e3d62",
"pubkey": "6c0e9016b9c1efe7edef87e505e2a1e03db1fbbcfdc3ed6b4f8aaa4b540ad98f",
"created_at": 1712389519,
"kind": 1,
"tags": [
[
"e",
"320894f735f6933b2e6f157ad2a5597a3c37ddb63cbd24d18b2b100ca068286a",
"wss://relay.orange-crush.com/",
"root"
],
[
"e",
"b31a3ef6571324326938575d91a76177eddea908ee9c142509b5ef725252ce46",
"wss://relay.orange-crush.com/",
"reply"
],
[
"p",
"3aa5817273c3b2f94f491840e0472f049d0f10009e23de63006166bca9b36ea3",
"wss://nos.lol/",
"mention"
]
],
"content": "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.\n\nfrom pytrends.request import TrendReq\npytrend= TrendReq()\n\ndef GetTrendingTopic():\n df = pytrend.trending_searches(pn='united_states')\n try:\n # Grab a random trending event from today and grab as plaintext string from dataframe:\n return str(df.sample(n=1).values[0]).split(\"\\'\")[1]\n except:\n return None",
"sig": "48da97c4eef2cedeeaa56200d42ad3cc01112b1de32286cf1b5147a32126f232699db8538394d0d753a6de899c4332523037f278fffe17b407dae728697bd736"
}