Closed huangzhaor closed 4 years ago
还有个请求就是想让大佬多写一个变量名type,让人们自己选择index的字典输出的是包括'all'还是“pc”还是“wise”,还是三者全部输出
还有个请求就是想让大佬多写一个变量名type,让人们自己选择index的字典输出的是包括'all'还是“pc”还是“wise”,还是三者全部输出
https://github.com/longxiaofei/spider-BaiduIndex/issues/12#issue-552582851
1、之前有人问过cookie取不对的问题,所以在readme中非常详细地描述了如何取cookie
请你打开百度的首页,登录后,找到www.baidu.com此条GET请求,并复制此条请求的request headers里的cookie,将此cookie粘贴到config.py中的COOKIES对象中
2、我想的是如何以最简单的方式将数据输出出来,如果只需要wise的数据,你可以
for index in baidu_index.get_index():
if index['type'] == 'wise':
print(index)
C:\ProgramData\Anaconda3\python.exe C:/Users/Administrator/Desktop/spider-BaiduIndex-master/new_spider_without_selenium/demo.py Traceback (most recent call last): File "C:/Users/Administrator/Desktop/spider-BaiduIndex-master/new_spider_without_selenium/demo.py", line 6, in for index in baidu_index.get_index(): File "C:\Users\Administrator\Desktop\spider-BaiduIndex-master\new_spider_without_selenium\get_index.py", line 58, in get_index keywords=params_data['keywords'] File "C:\Users\Administrator\Desktop\spider-BaiduIndex-master\new_spider_without_selenium\get_index.py", line 109, in _get_encrypt_datas uniqid = datas['data']['uniqid'] TypeError: string indices must be integers
我一开始以为是cookie可能是找好的。然后发现您说可能缺了一个cookie。我后来请人解决了这个问题,希望大佬在某个地方给补上一些些注释哈哈。谢谢
C:\ProgramData\Anaconda3\python.exe C:/Users/Administrator/Desktop/spider-BaiduIndex-master/new_spider_without_selenium/demo.py Traceback (most recent call last): File "C:/Users/Administrator/Desktop/spider-BaiduIndex-master/new_spider_without_selenium/demo.py", line 6, in for index in baidu_index.get_index(): File "C:\Users\Administrator\Desktop\spider-BaiduIndex-master\new_spider_without_selenium\get_index.py", line 58, in get_index keywords=params_data['keywords'] File "C:\Users\Administrator\Desktop\spider-BaiduIndex-master\new_spider_without_selenium\get_index.py", line 109, in _get_encrypt_datas uniqid = datas['data']['uniqid'] TypeError: string indices must be integers
我一开始以为是cookie可能是找好的。然后发现您说可能缺了一个cookie。我后来请人解决了这个问题,希望大佬在某个地方给补上一些些注释哈哈。谢谢
请问下这个是如何解决的呢
C:\ProgramData\Anaconda3\python.exe C:/Users/Administrator/Desktop/spider-BaiduIndex-master/new_spider_without_selenium/demo.py Traceback (most recent call last): File "C:/Users/Administrator/Desktop/spider-BaiduIndex-master/new_spider_without_selenium/demo.py", line 6, in
for index in baidu_index.get_index():
File "C:\Users\Administrator\Desktop\spider-BaiduIndex-master\new_spider_without_selenium\get_index.py", line 58, in get_index
keywords=params_data['keywords']
File "C:\Users\Administrator\Desktop\spider-BaiduIndex-master\new_spider_without_selenium\get_index.py", line 109, in _get_encrypt_datas
uniqid = datas['data']['uniqid']
TypeError: string indices must be integers
我一开始以为是cookie可能是找好的。然后发现您说可能缺了一个cookie。我后来请人解决了这个问题,希望大佬在某个地方给补上一些些注释哈哈。谢谢