今天本来想写个脚本自动获取火影忍者漫画的更新,要不每次都要去浏览器上一页一页的翻。以前抓脚本就是靠正则式去源码中匹配,今天网上搜索了一下准备使用Beautiful Soup组件进行页面内容抓取。

在抓取漫画章节列表中始终抓不到信息,查看网页源代码明明是有列出来的,但经过BeautifulSoup一解析楞是找不到。

列出一个简单的示例:

 

#coding=utf-8

import urllib2
from BeautifulSoup import BeautifulSoup


manhua_url = "http://www.manmankan.com/html/1/index.asp"
manhua = urllib2.urlopen(manhua_url).read()
manhua = unicode(manhua, 'gbk','ignore').encode('utf-8','ignore')
print manhua

soup = BeautifulSoup(manhua,)
print soup.prettify()

 

 

 

 

两次print一对比,嘿~,soup明显丢失了很多信息,何解?

 

-To Be Continue-

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-01-19
  • 2021-11-28
  • 2022-12-23
  • 2022-01-09
  • 2021-05-20
猜你喜欢
  • 2022-01-21
  • 2022-12-23
  • 2021-12-07
  • 2021-08-16
  • 2021-05-30
  • 2021-06-24
相关资源
相似解决方案