2012-03-13 66 views
2

現在是6個月,我使用模塊 pyGTrends下載有關搜索查詢的數據。pyGTrends模塊的問題 - PYTHON

從一兩天,看來該pyGTrends模塊不 工作了,具體產生的錯誤是:


Traceback (most recent call last): 
    File "d_queries.py", line 41, in <module> 
    print queryReport.csv()[:100] 
    File "/----/----/Desktop/pangea/queries_v1/pyGTrends.py", line 107, in csv 
    raise Exception("Could not find requested section") 
Exception: Could not find requested section 

添加在一些「打印」命令模塊pyGTrends.py 當我打印「self.raw_data」時我獲得


??You must be signed in to export data from Google Trends. 

我做了一些檢查,比如谷歌沒有改變URL的語法來獲得,因爲 的CSV如果我手動插入在瀏覽器行

self.raw_data = self.opener.open('http://www.google.com/trends/viz?' + params).read() 

的輸出(一旦在Google Trends中手動執行登錄) 我可以定期訪問csv。

1 - 是否有其他用戶可以確認使用pyGTrends中的類似問題?

2 - 我想知道是否可以將 連接到可能已被google更改的登錄過程(這只是一個假設, 我沒有任何關於此的信息)。 在這種情況下,應該在pyGTrends的代碼中完成哪些更改?

回答

0

我不知道該修復多大,但它不工作。我發現與GALX cookie匹配的模式存在問題。模式應改變

galx = re.compile('<input type="hidden"(.*?)name="GALX"(.*?)value="(?P<galx> ... ', re.DOTALL) 

但是,這似乎並沒有解決我的問題,因爲我仍然得到錯誤,請求的部分找不到。