0
を「エラーが検出されました」私はdominolabからのサンプルコードを使用し、次のコードを持っている:Googleトレンド
from pytrends.pyGTrends import pyGTrends
import time
from random import randint
from IPython.display import display
from pprint import pprint
import urllib
import sys
import os
google_username = "myusername"
google_password = "mypassword"
path = "csv_files"
if not os.path.exists(path):
os.makedirs(path)
base_keyword = "/m/0k44x" #Image Processing
terms = [
"Image Processing",
"Signal Processing",
"Computer Vision",
"Machine Learning",
"Information Retrieval",
"Data Mining"
]
advanced_terms = [
"/m/07844",
"/m/0yk6",
"/m/05kx1v",
"/m/04zv0zl",
"/m/017chx",
"/m/0cqyr9",
"/m/0121sb",
"/m/07844",
"/m/06dq9"
]
# connect to Google Trends API
connector = pyGTrends(google_username, google_password)
for label, keyword in zip(terms, advanced_terms):
print(label)
sys.stdout.flush()
keyword_string = '"{0}, {1}"'.format(keyword, base_keyword)
connector.request_report(keyword_string, geo="US", date="01/2014 65m")
# wait a random amount of time between requests to avoid bot detection
time.sleep(randint(5, 10))
# download file
connector.save_csv(path, label)
for term in terms:
data = connector.get_suggestions(term)
pprint(data)
はしかし、私は、保存されたCSVファイルでこれらを参照してください。
<div id="report">
<div class="errorTitle">An error has been detected</div>
<div class="errorSubTitle">This page is currently unavailable. Please try again later.<br/> Please make sure your query is valid and try again.<br/> If you're experiencing long delays, consider reducing your comparison items.<br/> Thanks for your patience.</div>
</div>
何が間違っていて、どのように修正できますか? Googleトレンドからデータを取得しました。ここにはan exampleがあります。
元のコードが '2008 96m'ました – maxymoo