最美情侣中文字幕电影,在线麻豆精品传媒,在线网站高清黄,久久黄色视频

歡迎光臨散文網(wǎng) 會員登陸 & 注冊

獲取免費小說,免費小說隨時看

2020-05-28 22:35 作者:每日一遍__以防抑郁  | 我要投稿

很多時候我們追小說時候,總會有很多的廣告,讓我們看小說的心情大打折扣,下面讓我們來獲取免費小說,獲取到本地隨時可以看吧。

import requests,re,parsel

from fake_useragent import UserAgent


ua = UserAgent()

header = {"User-Agent":ua.random}


Url = "https://www.167k.com/book/20761"


session = requests.session()

session.headers = header


def local(url,title,num):

? ? try:

? ? ? ? res = session.get(url)

? ? ? ? if res.status_code == 200:

? ? ? ? ? ? url = "https://www.167k.com/phone/book/get_bookcontent?book_id={}&chapter_id={}".format(num[2], num[3])

? ? ? ? ? ? res = session.get(url)

? ? ? ? ? ? print(res.text)

? ? except Exception as e:

? ? ? ? print("詳細頁面請求出錯:",e)


def main():

? ? try:

? ? ? ? res = requests.get(Url,headers=header)

? ? ? ? # 獲取總標題 和一個圖片

? ? ? ? if res.status_code == 200:

? ? ? ? ? ? html = parsel.Selector(res.text)

? ? ? ? ? ? image = html.xpath('//div[@class="de_navtu"]/div[1]/img/@src').extract_first()

? ? ? ? ? ? # 留意一下這里標題是否有作者名字

? ? ? ? ? ? title_all = html.xpath('//div[@class="de_navtu"]/div[2]/div[1]/text()').extract_first()

? ? ? ? ? ? name = html.xpath('//div[@class="de_navtu"]/div[2]/div[1]/span/text()').extract_first()

? ? ? ? ? ? title_all = title_all.replace("\n","").replace("\t","")

? ? ? ? ? ? mold = html.xpath('//div[@class="de_navtu"]/div[2]/div[2]/div/text()').extract()

? ? ? ? ? ? # print(mold)

? ? ? ? ? ? # print("圖片鏈接:",image)

? ? ? ? ? ? # print("總標題:",title_all)

? ? ? ? ? ? # print("作者:",name,len(name))

? ? ? ? ? ? # print(title_all,len(title_all))

? ? ? ? ? ? titles = html.xpath('//div[@class="bo_zj"]/ul/li/a/@title').extract()

? ? ? ? ? ? urls = html.xpath('//div[@class="bo_zj"]/ul/li/a/@href').extract()

? ? ? ? ? ? for title,url in zip(titles,urls):

? ? ? ? ? ? ? ? #? https://www.167k.com/book/20761/126590035? ? ?構(gòu)造這個URL

? ? ? ? ? ? ? ? #? https://www.167k.com/phone/book/get_bookcontent?book_id=20761&chapter_id=126590035

? ? ? ? ? ? ? ? #? https://www.167k.com/phone/book/get_bookcontent?book_id=20761&chapter_id=126590117

? ? ? ? ? ? ? ? if url == '/book/20761/126590007':

? ? ? ? ? ? ? ? ? ? num = url.split('/')

? ? ? ? ? ? ? ? ? ? url = "https://www.167k.com{}".format(url)

? ? ? ? ? ? ? ? ? ? local(url,title,num)

? ? ? ? ? ? ? ? ? ? print(url)

? ? ? ? ? ? ? ? # url = "https://www.167k.com{}".format(url)

? ? ? ? ? ? ? ? # print(title,url)

? ? ? ? else:

? ? ? ? ? ? print("不是200")



? ? except Exception as e:

? ? ? ? print("請求主頁面出錯:",e)



if __name__ == '__main__':

? ? main()


獲取免費小說,免費小說隨時看的評論 (共 條)

分享到微博請遵守國家法律
深水埗区| 合江县| 南阳市| 西安市| 凤冈县| 元氏县| 犍为县| 如东县| 阜南县| 漾濞| 广宁县| 东安县| 土默特右旗| 舒兰市| 全州县| 商丘市| 蕲春县| 金寨县| 孟村| 日土县| 邢台县| 上蔡县| 定远县| 湄潭县| 博白县| 林口县| 镇安县| 宜宾市| 新巴尔虎右旗| 万源市| 康平县| 垦利县| 莒南县| 武义县| 新沂市| 依兰县| 吐鲁番市| 北辰区| 会泽县| 长汀县| 专栏|