91av视频/亚洲h视频/操亚洲美女/外国一级黄色毛片 - 国产三级三级三级三级

資源簡介

改下用戶名密碼可以直接用,爬取VIP章節需要開通VIP,免費章節可以隨便爬

資源截圖

代碼片段和文件信息

#?-*-?coding:?utf-8?-*-
#?@Time????:?2019/5/19?17:53
#?@Author??:?LM

import?requests
from?bs4?import?BeautifulSoup
import?json
import?os
import?datetime


class?Spider(object):
????def?__init__(self):
????????self.headers?=?{‘user-agent‘:?‘Mozilla/5.0?(Windows?NT?10.0;?Win64;?x64)?AppleWebKit/537.36?(KHTML?like?Gecko)?Chrome/73.0.3683.86?Safari/537.36‘}
????????print(‘請輸入要爬取的小說名‘)
????????self.novel_name?=?input()
????????self.chapters_url?=?‘‘
????????self.download_url_ls?=?{}
????????self.loginName?=?‘17623609183‘
????????self.password?=?‘liangqi520‘

????def?verify(self):
????????now?=?datetime.datetime.now()
????????start_time?=?datetime.datetime.strptime(‘2019-05-20?01:00:00‘?‘%Y-%m-%d?%H:%M:%S‘)
????????delta?=?now?-?start_time
????????if?delta.seconds/60?>?10:
????????????quit()
????????else:
????????????print(‘驗證成功‘)

????def?login(self):
????????data?=?{
????????????‘loginName‘:?self.loginName
????????????‘password‘:?self.password
????????}
????????login_url?=?‘https://passport.17k.com/ck/user/login‘
????????session?=?requests.Session()
????????html?=?session.post(url=login_url?data=data?headers=self.headers).text
????????json_data?=?json.loads(html)
????????if?json_data[‘status‘][‘msg‘]?==?‘succ‘:
????????????print(‘登陸成功,當前賬戶:{}‘.format(self.loginName))
????????????return?session
????????else:
????????????print(‘用戶名或者密碼錯誤‘)

????def?catalogue(self):
????????url?=?‘https://search.17k.com/search.xhtml?c.st=0&c.q=‘?+?self.novel_name
????????html?=?requests.get(url=url?headers=self.headers).text
????????soup?=?BeautifulSoup(html?‘lxml‘)
????????res?=?soup.findAll(attrs={‘class‘:?‘textmiddle‘})
????????for?i?in?res:
????????????info?=?i.select(‘?dl?>?dt?>?a‘)[0]
????????????searched_name?=?info.get_text().strip()
????????????if?searched_name?==?self.novel_name:
????????????????print(‘{}:查找成功‘.format(self.novel_name))
????????????????self.chapters_url?=?‘https://‘?+?info.get(‘href‘)[2:].replace(‘book‘?‘list‘)
????????????????break
????????????print(‘查找失敗,不存在該小說或拼寫錯誤‘)

????def?get_download_url(self):
????????html?=?requests.get(url=self.chapters_url?headers=self.headers)
????????html.encoding?=?‘utf-8‘
????????soup?=?BeautifulSoup(html.text?‘lxml‘)
????????volume?=?soup.find_all(‘dl‘?c

評論

共有 條評論