reference: https://zhuanlan.zhihu.com/p/25286144

 

爬取数据时,是不是只能每个网站每个网站的分析,有没有通用的方式

做爬虫也好多年了,一般抓取网站中的标题,文章发布时间,正文,文章图片。可以做到 80%用通用规则解决。
1,标题:在提取链接的时候把 link title 保存下来 
2,文章发布时间:用网页 heads 里的 last modify 
3,抽取正文:有开源的模块( Python 有 readability-lxml,Java 有 JoyHtml 
4,文章图片:在抽取的正文中提取<img>

相关文章:

  • 2021-06-26
  • 2021-09-03
  • 2021-06-26
  • 2021-12-19
  • 2021-07-27
  • 2021-06-23
猜你喜欢
  • 2022-02-25
  • 2021-08-13
  • 2022-02-08
  • 2021-07-07
  • 2021-12-15
相关资源
相似解决方案