得到手机版新闻解析
得到手机版新闻 api
2018.7.30有效,之后不保证
从源代码发现是异步加载
抓包发现是ajax请求,带的参数有个token
在源码中找到token,拼接
#!/usr/bin/env python # coding:utf8 # author:Z time:2018/7/30 import re import requests url='https://m.igetget.com/share/course/article/article_id/67982' # html = urllib2.urlopen(url).read()#python2 html=requests.get(url) token = re.findall( """{"class_id":252,"ptype":24,"pid":2,"article_id":67982,"origin_article_id":7972,"dd_article_id":1644050193567449000,"dd_article_token":"(.*?)".*""", html.text, re.S)[0] parse_token = token.replace('/', '%2F').replace('+', '%2B').replace('==', '%3D%3D') xhr_api = url.replace('article/article_id/','api/articleInfo?token=%s'%parse_token) url = re.findall('(.*%3D%3D)\d+', xhr_api, re.S)[0] print(url)
'
https://m.igetget.com/share/course/api/articleInfo?token=KWn%2FCP3W2t1dAB9L2qUeTEIvD39t0SXgLnIebs36S4%2BZXd8wl9BNsH535L7zvQ%3D%3D
'