提交 0b8a6032 编写于 作者: H hjdhnx

修复py厂长

上级 787a1389
3.9.24beta6
\ No newline at end of file
3.9.24beta7
\ No newline at end of file
......@@ -7,6 +7,7 @@ import base64
import hashlib
import requests
from Crypto.Cipher import AES
import urllib
class Spider(Spider): # 元类 默认的元类 type
def getName(self):
......@@ -39,10 +40,13 @@ class Spider(Spider): # 元类 默认的元类 type
def homeVideoContent(self):
url = "https://czspp.com"
if len(self.cookies) <= 0:
self.getCookie(url)
url = url + self.zid
rsp = self.fetch(url)
header = {
"Connection": "keep-alive",
"Referer": url,
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/104.0.0.0 Safari/537.36"
}
session = self.getCookie(url,header)
rsp = session.get(url, headers=header)
root = self.html(self.cleanText(rsp.text))
aList = root.xpath("//div[@class='mi_btcon']//ul/li")
videos = []
......@@ -63,7 +67,6 @@ class Spider(Spider): # 元类 默认的元类 type
}
return result
cookies = ''
def getCookie(self,url,header):
session = requests.session()
rsp = session.get(url)
......@@ -89,7 +92,7 @@ class Spider(Spider): # 元类 默认的元类 type
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/104.0.0.0 Safari/537.36"
}
session = self.getCookie(url,header)
rsp = session.get(url, cookies=self.cookies, headers=header)
rsp = session.get(url, headers=header)
root = self.html(self.cleanText(rsp.text))
aList = root.xpath("//div[contains(@class,'bt_img mi_ne_kd mrb')]/ul/li")
videos = []
......@@ -124,7 +127,7 @@ class Spider(Spider): # 元类 默认的元类 type
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/104.0.0.0 Safari/537.36"
}
session = self.getCookie(url, header)
rsp = session.get(url,cookies=self.cookies,headers=header)
rsp = session.get(url, headers=header)
root = self.html(self.cleanText(rsp.text))
node = root.xpath("//div[@class='dyxingq']")[0]
pic = node.xpath(".//div[@class='dyimg fl']/img/@src")[0]
......@@ -194,14 +197,14 @@ class Spider(Spider): # 元类 默认的元类 type
return result
def searchContent(self, key, quick):
url = 'https://czspp.com/xssearch?q={0}'.format(key)
url = 'https://czspp.com/xssearch?q={0}'.format(urllib.parse.quote(key))
header = {
"Connection": "keep-alive",
"Referer": url,
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/104.0.0.0 Safari/537.36"
}
session = self.getCookie(url, header)
rsp = session.get(url,cookies=self.cookies, headers=header)
rsp = session.get(url, headers=header)
root = self.html(self.cleanText(rsp.text))
vodList = root.xpath("//div[contains(@class,'mi_ne_kd')]/ul/li/a")
videos = []
......@@ -251,7 +254,7 @@ class Spider(Spider): # 元类 默认的元类 type
}
session = self.getCookie(url, header)
pat = '\\"([^\\"]+)\\";var [\\d\\w]+=function dncry.*md5.enc.Utf8.parse\\(\\"([\\d\\w]+)\\".*md5.enc.Utf8.parse\\(([\\d]+)\\)'
rsp = session.get(url,cookies=self.cookies, headers=header)
rsp = session.get(url, headers=header)
html = rsp.text
content = self.regStr(html, pat)
if content == '':
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册