URL:http://v2.api.dmzj.com/article/recommend/header.json
method: GET
content-type: text/html
| # -*- coding:utf-8 -*- | |
| # 声明:知乎上某个答主写的爬虫脚本,代码没有整理,自己重新整理排版了,已经调试并通过 | |
| # 本人 Java 程序员,对 python 不熟,不过代码里面逻辑大概能看懂一些,这位答主的脚本是 python2 写的, | |
| # 我自己是 python3 的环境,所以有些细微的改动,目的是为了兼容 python3 可以正常运行 | |
| # | |
| # 原始脚本地址: https://www.zhihu.com/question/297715922/answer/676693318 | |
| # 如果觉得我冒犯了你的话,可以私信联系我,我删除。 | |
| import re |
以下所有的API都有两种方式可调用 http://api?key=value&key2=value2 以及 http://api/key/value/key2/value
| # coding=utf-8 | |
| import os | |
| import time | |
| import requests | |
| def ensure_dir(f): | |
| d = os.path.join(os.getcwd(), f) | |
| if not os.path.exists(d): |