Giter Club home page Giter Club logo

-book118-'s Introduction

-book118-

'''写了个小爬虫,爬取文档投稿赚钱网(book118)的pdf、word文档并生成pdf文件

使用注意:在run.py统计目录下建立两个文件夹:分别命名:图片、文件库
使用注意:在run.py统计目录下建立两个文件夹:分别命名:图片、文件库
使用注意:在run.py统计目录下建立两个文件夹:分别命名:图片、文件库

作用: 下载pdf、word(不包括ppt哦,因为我看到ppt是js生成的),然后转存为pdf文件

使用方法:

一、运行
	run.py,在交互界面把你要下载的文件当前网址复制下来,粘贴上去,鼠标移动到冒号前按enter。

二、注意事项:
	我发现这个网站的响应有时候会卡并且慢,所以如果报错什么的,重新run一次就行,一般都可以解决。
还有一点,因为响应慢,所以下载文件页面时,如果太多页,速度你懂的,我觉得是网站的错哈哈哈,其实我程序也只是花不到一天写的,优化还是不够的,但思考下时间成本和收益,emm勉强能拿去用就行吧。

三、pdf横向、纵向修改
`在img.py中找到如下代码修改:`
 #修改PDF文件方向:-默认纵向,改direction为其他则是横向
	direction= '|'
	if direction== '-':
	    imgDoc.setPageSize(landscape(A4))
	    document_width,document_height = landscape(A4)
	else:
	    imgDoc.setPageSize(A4)
	    document_width, document_height = A4

特别鸣谢: 本程序中参考了某位大神的图片转pdf程序,原github:https://github.com/ilovin/stitch_img_to_pdf。

-book118-'s People

Contributors

gallenqiu avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

-book118-'s Issues

请教爬取内容问题

请教一下,我自己写book118的爬虫以作者思路可能不一样,我不知道为什么我抓包抓的getPreview包只能加载到预读部分,但是这个好像可以一次性全部爬取

您好,我下载了一个100多页的文档,生成的PDF顺序错乱

您好,我下载了一个100多页的文档,生成的PDF顺序错乱,基本上是下面的排序:

图片页码数:
1,
10,100,101,102,103,...,109,
11,110,111,112,113,...,119,
12,120,121,122,
13,14,15,...,19,
2,
20,21,22,23,...,29,
3,
30,31,32,33,...,39,
4,
40,41,42,43,...,49,

您可以说一下在哪里修改吗?

生成的图片文件名编号问题导致PDF页面错乱

比如下载的资料名为:Python教程,则生成的图片文件名为:Python教程1.png,Python教程2.png.......
但生成PDF时,实际顺序是:Python教程1.png,Python教程10.png,Python教程11.png,Python教程12.png,修改也很简单把
run.py中 with open('图片//'+str(self.title).split('.')[0]+str(c)+'.png','wb+')as f:
改为 with open('图片//'+str(self.title).split('.')[0]+str(c).zfill(n)+'.png','wb+')as f:
其中n就是根据总网址数量前加1个或两个0,生成Python教程01.png或者Python教程001.png就可以了

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.