最近在看一本小说,每次点击下一章,就要等哈,而且有的还有广告,有点烦,就下载个txt了,没有广告,没有等待,哈哈
代码如下
# coding=utf-8
import requests
from bs4 import BeautifulSoup
# 设置请求头
headers = {
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/65.0.3325.181 Safari/537.36"}
# 设置获取python岗位数量的url
url = "https://www.biquge.info/35_35517/"
# 获取响应
response = requests.get(url, headers=headers)
# 解码
html = response.content.decode('utf-8')
# 创建bs4对象
soup = BeautifulSoup(html, "html5lib")
list = []
for soup0 in soup.find_all("dd"):
url1 = "https://www.biquge.info/35_35517/" + soup0.find("a").get('href')
title=soup0.find("a").text
print(url1)
# 获取响应
tf = 1
while (tf == 1):
try:
response1 =