from typing import list, any, union
import requests
from bs4 import beautifulsoup
# 請求的首部資訊(固定)
headers =
count = 1
while count <= 120:
print(count)
counts = str(count)
#輸入需要扒取的網頁位址
# url = ''+counts # 盾之勇者成名錄
# url = ''+counts # 歡迎來到實力至上主義的教室
# url = ''+counts # 關於我轉生變成史萊姆這檔事
url = ''+counts # 關於我轉生變成史萊姆這檔事
count = count + 1
res = requests.get(url, headers=headers)
soup = beautifulsoup(res.text, 'lxml')#(固定)
# tags = soup.find_all('span', )
# 獲取哪個塊的內容
news_list = soup.find('div', )
news = news_list
# if count >= 230:
# news = news_list
# else:
# news = news_list.find_all('p')
#將獲得的list轉換為str格式
news = str(news)
#輸入需要匯出到哪個位置的什麼檔案,編碼格式自定
f = open('f:/不死者.txt', 'a', encoding='utf-8')
f.write(news)
f.close()
分享一下我的小說史
對於乙個男孩子來說,玄幻 是生命中乙個不可缺少的部分。基本上每乙個人都會把自己想象成為裡邊的男主角,飛天掠地,翻江倒海無所不能。最重要的是身邊還有被作者描寫的非常完美的許多漂亮小姐姐。獸王是我小學的時候偶然間接觸到的,然後就無法抑制的喜歡上了這本書。雨魔大大是乙個不可多得的人才他寫的 即使放在現在我...
python爬豆瓣 Python 爬一下豆瓣電影
簡介 純屬python小練習 檔案結構 usr bin python coding utf 8 import urllib2 class html object def downlod self,url if url is none return none response urllib2.urlo...
requests爬取小說
1.url解析 2.傳送請求 3.接收返回 4.進行解析 5.儲存 將國風中文網制定頁的 的題目 作者 最近更新章節和時間抓取下來儲存到本地 小夥伴們,今天我們用的利劍是requests xpath 第一步 匯入模組 import requests from lxml import etree im...