Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
pytrends problem
#11
I also have found the easier one, but the pytrends package still can't work.

from pytrends.pyGTrends import pyGTrends
import time
from random import randint
def run_search(keyword):
google_username = '' #Enter google username
google_password = '' #Enter google password

#Connect to google
connector = pyGTrends(google_username, google_password)

#Request a report based on keyword
connector.request_report(keyword, geo = 'US', date = '03/2006 118m')
print(keyword)

#Wait a bit so Google doesn't block the script
time.sleep(randint(5,10))

#Save a csv
path = './output/'
connector.save_csv(path, keyword)

with open("fund name.txt", "r") as source:
lines = [line.rstrip('\n').replace('/', ' ').replace(',','') for line in source]
for name in lines:
run_search(name)
print("Finished!")
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Pytrends related querie & suggestion limitations cmg15326 0 558 May-02-2023, 03:47 PM
Last Post: cmg15326
  Need some help with Pytrends cmg15326 4 1,259 May-01-2023, 05:41 AM
Last Post: cmg15326

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020