gopup icon indicating copy to clipboard operation
gopup copied to clipboard

TypeError: string indices must be integers

Open r41350 opened this issue 3 years ago • 2 comments

import gopup as gp cookie==。。。 #正确的赋值后 index_df = gp.baidu_search_index(word="罩", start_date='2020-12-01', end_date='2020-12-25', cookie=cookie) print(index_df)

报错 TypeError Traceback (most recent call last) in 2 # 怎样看cookie https://jingyan.baidu.com/article/76a7e409284a80fc3a6e1566.html 3 cookie =。。。 ----> 4 index_df = gp.baidu_search_index(word="罩", start_date='2020-12-01', end_date='2020-12-25', cookie=cookie) 5 print(index_df)

C:\ProgramData\Anaconda3\lib\site-packages\gopup\index\index_baidu.py in baidu_search_index(word, start_date, end_date, cookie, type) 264 r = requests.get(url=url, params=params, headers=headers) 265 data = r.json()["data"] --> 266 all_data = data["userIndexes"][0][type]["data"] 267 uniqid = data["uniqid"] 268 ptbk = get_ptbk(uniqid, cookie)

TypeError: string indices must be integers

r41350 avatar Dec 25 '20 00:12 r41350

百度指数有调整,我迭代了一个版本,更新 0.2.9.1版本试试

justinzm avatar Dec 25 '20 05:12 justinzm

update到最新版本后运行,还是会报错: File "D:/1/GitHub/gopup/example/test.py", line 12, in index_df = gp.baidu_search_index(word="罩", start_date='2021-01-22', end_date='2021-01-26', cookie=cookie) File "d:\program files\Python\Lib\site-packages\gopup-0.2.8-py3.6.egg\gopup\index\index_baidu.py", line 266, in baidu_search_index all_data = data["userIndexes"][0][type]["data"] TypeError: string indices must be integers

KarlChe avatar Feb 10 '21 11:02 KarlChe