使用IP访问学校,解决破盾问题

This commit is contained in:
ngfchl
2022-10-13 14:10:20 +08:00
parent fad6e1df95
commit 3398493f7c
3 changed files with 18 additions and 10 deletions

View File

@@ -154,12 +154,12 @@
{
"id": 3,
"created_at": "2022-07-17 10:24:59.754000",
"updated_at": "2022-09-28 14:19:49.685000",
"updated_at": "2022-10-13 13:48:43.145285",
"name": "BT学校",
"url": "https://pt.btschool.club/",
"url": "http://47.242.110.63/",
"logo": "https://pt.btschool.club/favicon.ico",
"sign_in_support": 1,
"get_torrent_support": 0,
"get_torrent_support": 1,
"get_userinfo_support": 1,
"search_support": 0,
"page_default": "torrents.php",

View File

@@ -162,13 +162,13 @@
"pk": 3,
"fields": {
"created_at": "2022-07-17T10:24:59.754",
"updated_at": "2022-09-28T14:19:49.685",
"url": "https://pt.btschool.club/",
"updated_at": "2022-10-13T13:48:43.145",
"url": "http://47.242.110.63/",
"name": "BT学校",
"logo": "https://pt.btschool.club/favicon.ico",
"tracker": "btschool.club",
"sign_in_support": true,
"get_torrent_support": false,
"get_torrent_support": true,
"get_userinfo_support": true,
"search_support": false,
"page_default": "torrents.php",

View File

@@ -866,7 +866,7 @@ class PtSpider:
)
res = self.send_request(my_site=my_site, method=site.sign_in_method, url=url,
data=eval(site.sign_in_params))
logger.info(res.text)
logger.info(res.status_code)
if 'hares.top' in site.url:
code = res.json().get('code')
# logger.info('白兔返回码:'+ type(code))
@@ -906,9 +906,16 @@ class PtSpider:
return CommonResponse.error(
status=StatusCodeEnum.FAILED_SIGN_IN
)
if 'btschool' in site.url:
if '47.242.110.63' in site.url:
logger.info(res.status_code)
logger.info(res.content.decode('utf-8'))
text = self.parse(res, '//script/text()')
text = self.parse(res, '//a[@href="index.php"]/font/text()')
signin_stat = self.parse(res, '//a[contains(@href,"addbouns"])')
logger.info('{}:{}'.format(site.name, text))
if len(signin_stat) <= 0:
return CommonResponse.success(msg=text)
"""
# text = self.parse(res, '//script/text()')
if len(text) > 0:
location = self.parse_school_location(text)
logger.info('学校签到链接:' + location)
@@ -931,7 +938,8 @@ class PtSpider:
signin_today.save()
return CommonResponse.success(msg='签到成功!')
else:
return CommonResponse.error(msg='签到失败!')
"""
return CommonResponse.error(msg='签到失败或网络错误!')
if res.status_code == 200:
status = converter.convert(res.content.decode('utf8'))
# status = ''.join(self.parse(res, '//a[contains(@href,{})]/text()'.format(site.page_sign_in)))