首页 > 其他 > 详细

爬虫3:pdf页面+pdfminer模块+demo

时间:2016-05-21 01:20:23      阅读:457      评论:0      收藏:0      [点我收藏+]

  本文介绍下pdf页面的爬取,需要借助pdfminer模块

  demo一般流程:

  1)设置url

url = http://www.------ + .PDF

  2)requests模块获取url

import requests
r = requests.get(inner_url)

  3)写入.pdf文件

myFile = open("PDF/" +  i[uassociateAnnouncement] + .pdf, "wb")
myFile.write( r.content )
myFile.close()

  4)引入pdfminer模块

import pdfminer

  5)BeautifulSoup解析html

from bs4 import BeautifulSoup

html = open(PDF/1202268749.html).read()

未完待续,先睡觉,pdfminer把pdf页面解析成html页面,然后beautifulsoap解析html页面即可。

 

爬虫3:pdf页面+pdfminer模块+demo

原文:http://www.cnblogs.com/rongyux/p/5513811.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!