当前仓库属于暂停状态,部分功能使用受限,详情请查阅 仓库状态说明
1 Star 0 Fork 89

hanmichael/scrapy_zhilian
暂停

forked from 小码编程/scrapy_zhaopin
暂停
 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
test1.py 2.30 KB
一键复制 编辑 原始数据 按行查看 历史
子沐 提交于 2018-07-09 13:50 . !1 V2.0版本发布
import json
import requests
head = {'host': 'h5api.m.taobao.com',
'user-agent': 'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.132 Safari/537.36',
'cookie': 't=b1293b84b15857eef2477e87a2c463a4; cna=tOKCE20h/WUCAXPstbNVnaFO; thw=cn; hng=CN%7Czh-CN%7CCNY%7C156; ali_ab=115.236.181.179.1526621044801.8; UM_distinctid=1638b1d8284139-09ce3ff908074e-454c092b-100200-1638b1d828539a; enc=utUKtJXwxNlBRJ4MNZi0nHJ9Z3iS03Xf5QWZcqcUUE5s77naaF%2Bd8Cl4NUOgfTMx%2Bg7L1qoqP%2FuP9cLMhgDYsw%3D%3D; l=AoCAfQM8KXqm6kfoFAInkuak0ARSCWTT; tg=0; cookie2=5d92e5df49299d7fd4659924f7ce6d6f; _tb_token_=5e64e53e73e3e; _cc_=URm48syIZQ%3D%3D; _m_h5_tk=7cc83f4bcd396d26323a05517fa4fa06_1528955944928; _m_h5_tk_enc=99623c2228c43227d2df622832e9caa6; v=0; uc3=nk2=stHgFFcbILLr05o%3D&id2=UojXIdrCdOsGmA%3D%3D&vt3=F8dBzr2I9ePQa00tUIk%3D&lg2=W5iHLLyFOGW7aA%3D%3D; existShop=MTUyODk1NTgxNg%3D%3D; lgc=%5Cu8273%5Cu82731990316; tracknick=%5Cu8273%5Cu82731990316; dnk=%5Cu8273%5Cu82731990316; sg=648; csg=4aaa46b0; cookie1=BqfUOoKK6qHwVUDKIL8MKIrUGJ9Shhw64Z9DVnVmu1A%3D; unb=1939659924; skt=51082ed34042b2b3; _l_g_=Ug%3D%3D; _nk_=%5Cu8273%5Cu82731990316; cookie17=UojXIdrCdOsGmA%3D%3D; mt=ci=70_1; uc1=cookie16=WqG3DMC9UpAPBHGz5QBErFxlCA%3D%3D&cookie21=VFC%2FuZ9aiKCaj7AzMpJs&cookie15=UIHiLt3xD8xYTw%3D%3D&existShop=false&pas=0&cookie14=UoTeNmh59xE4kw%3D%3D&tag=10&lng=zh_CN; isg=BDMz0-1abPhy3SAX7bx5rOkbwjedwKO4LlO1XeXQntKJ5FOGbThXepFamhQKxB8i'}
url = 'http://h5api.m.taobao.com/h5/mtop.taobao.iliad.comment.query.latest/1.0/?jsv=2.4.0&appKey=12574478&t=1528956323325&sign=d98e195b3ca4e084b6b6debcb5bef43f&api=mtop.taobao.iliad.comment.query.latest&v=1.0&type=jsonp&dataType=jsonp&callback=mtopjsonp516&data=%7B%22limit%22%3A20%2C%22topic%22%3A%22b5d34611-cdda-4af2-8961-212765c4c149%22%2C%22tab%22%3A2%2C%22order%22%3A%22acs%22%2C%22paginationContext%22%3A%22%7B%5C%22commentId%5C%22%3A101962196188%2C%5C%22refreshTime%5C%22%3A1528956323300%2C%5C%22timestamp%5C%22%3A1528956321000%7D%22%2C%22from%22%3A%22zhongkong%22%7D'
jscontent = requests.get(url, headers=head).content
jsDict = json.loads(jscontent.decode('utf-8').strip(" mtopjsonp516()"))
jsData = jsDict['data']
# comments=jsData["commentid"]
# for each in comments:
# print (each['content'])
print(jscontent.decode('utf-8').strip(" mtopjsonp6318()"))
print(jsDict)
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Python
1
https://gitee.com/hanmichael/scrapy_zhilian.git
[email protected]:hanmichael/scrapy_zhilian.git
hanmichael
scrapy_zhilian
scrapy_zhilian
master

搜索帮助