csdn_spider/README.md

1.4 KiB
Raw Blame History

CSDN 爬虫脚本

主要功能:爬取 csdn 博客指定用户的所有博文并转换为 markdown 格式保存到本地。

一、运行环境

需要安装WebDriver驱动,https://chromedriver.chromium.org/downloads下载与本地对应的chrome驱动后,将其添加至环境变量$PATH

python3
python3 -m pip install -r requirements.txt

二、获取脚本

git clone https://github.com/ds19991999/csdn-spider.git

三、用法

1.获取cookie

登录 csdn 账号,进入:https://blog.csdn.net ,按 F12 调试网页,复制所有的 Request Headers,保存到cookie.txt文件中

1571482112632

2.添加需要爬取的 csdn 用户

username.txt中添加用户名,一行一个

3.运行脚本

python3 csdn.py

四、效果

运行过程

1571483423256

文章列表建立./articles/username/README.md

1571483552438

爬取的博文./articles/username/

1571483479356

博文转换效果

1571483777703

五、LICENSE

Creative Commons License

PS:随意写的爬虫脚本,佛系更新。