这里有新鲜出炉的精品教程,程序狗速度看过来!
jparser 0.0.11 发布了。主要更新内容如下:
Bug fix:
在线测试 Demo:http://jparser.duapp.com/
用法示例:
- import urllib2 from jparser import PageModel html = urllib2.urlopen("http://news.sohu.com/20170512/n492734045.shtml").read().decode('gb18030') pm = PageModel(html) result = pm.extract() print "==title=="print result['title'] print "==content=="
- for x in result['content'] :
- if x['type'] == 'text': print x['data']
- if x['type'] == 'image': print "[IMAGE]",
- x['data']['src']
来源: http://www.phperz.com/article/17/0518/335136.html