forked from rty813/doc_downloader
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
orca_west
committed
Feb 8, 2020
1 parent
2ea8dee
commit 6119a1c
Showing
3 changed files
with
35 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,4 +6,5 @@ __pycache__/ | |
*.pyc | ||
*.log | ||
book118/out/ | ||
*.spec |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,4 @@ | ||
import fire | ||
import pymysql | ||
import os | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,41 @@ | ||
# 多种文档下载器 | ||
本工具适用于下载豆丁、道客巴巴、淘豆网、原创力、新浪爱问、金锄头网站的可以预览的文档。只要可以预览,就可以下载。下载下来是图片格式,然后会通过reportlab库,将图片转换成PDF。 | ||
|
||
其中,由于新浪爱问网站用的都是svg格式的文件,将其转换成图片需要调用svg2png库。因此,需要先安装nodejs,再利用npm安装svg2png,然后才能正常使用。 | ||
其中,由于新浪爱问网站用的都是svg格式的文件,将其转换成图片格式需要调用第三方库。Windows下可用svg2png库,Linux下可使用rsvg库。当然,在windows上面也可以安装rsvg库,需要下载CRAN,利用CRAN安装rsvg,实现svg的转换。 | ||
|
||
## rsvg库安装方法 | ||
Binary packages for __OS-X__ or __Windows__ can be installed directly from CRAN: | ||
|
||
```r | ||
install.packages("rsvg") | ||
``` | ||
|
||
Installation from source on Linux or OSX requires [`librsvg2`](https://developer.gnome.org/rsvg/). On __Debian__ or __Ubuntu__ install [librsvg2-dev](https://packages.debian.org/testing/librsvg2-dev): | ||
|
||
``` | ||
sudo apt-get install -y librsvg2-dev | ||
``` | ||
|
||
On __Fedora__, __CentOS or RHEL__ we need [librsvg2-devel](https://apps.fedoraproject.org/packages/librsvg2-devel): | ||
|
||
## 使用方法 | ||
``` | ||
sudo yum install librsvg2-devel | ||
```` | ||
On __OS-X__ use [rsvg](https://github.com/Homebrew/homebrew-core/blob/master/Formula/librsvg.rb) from Homebrew: | ||
``` | ||
brew install librsvg | ||
``` | ||
## svg2png安装方法(仅限Windows操作系统) | ||
``` | ||
1. 安装nodejs | ||
2. 命令提示符内输入:npm install -g svg2png | ||
3. 命令提示符内输入:Set-ExecutionPolicy -ExecutionPolicy RemoteSigned | ||
4. 命令提示符内输入:python docDownloader.py | ||
3. 命令提示符内输入:Set-ExecutionPolicy -ExecutionPolicy | ||
``` | ||
## 本项目使用方法 | ||
终端内输入: | ||
``` | ||
python docDownloader.py | ||
``` |