Apr-14-2017, 12:55 PM
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!")
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!")