From ada41745075428fd222fab7f7e21ac4e442916a0 Mon Sep 17 00:00:00 2001 From: hjdhnx Date: Fri, 2 Sep 2022 20:54:25 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E5=85=BB=E7=AB=AF=E6=BA=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- classes/cms.py | 8 +++++++- "js/\345\205\273\347\253\257.js" | 16 ++++++++++++++++ models/rules.db | Bin 32768 -> 32768 bytes utils/web.py | 9 +++++++++ 4 files changed, 32 insertions(+), 1 deletion(-) create mode 100644 "js/\345\205\273\347\253\257.js" diff --git a/classes/cms.py b/classes/cms.py index ae290b1..d31319d 100644 --- a/classes/cms.py +++ b/classes/cms.py @@ -74,7 +74,10 @@ class CMS: url = rule.get('url','') detailUrl = rule.get('detailUrl','') searchUrl = rule.get('searchUrl','') - headers = rule.get('headers',{}) + default_headers = getHeaders(host) + self_headers = rule.get('headers',{}) + default_headers.update(self_headers) + headers = default_headers cookie = self.getCookie() # print(f'{self.title}cookie:{cookie}') if cookie: @@ -97,6 +100,7 @@ class CMS: headers['User-Agent'] = UA if not 'referer' in lower_keys: headers['Referer'] = host + # print(headers) self.headers = headers self.host = host self.homeUrl = urljoin(host,homeUrl) if host and homeUrl else homeUrl @@ -331,6 +335,7 @@ class CMS: 'type_id': class_urls[i] }) # print(self.url) + print(self.headers) has_cache = False if self.homeUrl.startswith('http'): # print(self.homeUrl) @@ -504,6 +509,7 @@ class CMS: r.encoding = self.encoding print(r.url) html = r.text + # print(html) items = pdfa(html, p[0]) except: pass diff --git "a/js/\345\205\273\347\253\257.js" "b/js/\345\205\273\347\253\257.js" new file mode 100644 index 0000000..bbe7d35 --- /dev/null +++ "b/js/\345\205\273\347\253\257.js" @@ -0,0 +1,16 @@ +var rule = { + title:'养端', + host:'https://aaq48.com:33666', + homeUrl:'/home/index.html', + url:'/home/vodlist/38/fyclass-fypage.html', + headers:{ + 'User-Agent':'MOBILE_UA' + }, + timeout:5000, + class_parse:'.menu&&dl&ⅆa&&Text;a&&href;.*/(.*?)-', + limit:5, + play_parse:true, + lazy:'', + 一级:'.channel-list&&dl;h3&&Text;img&&data-original;font&&Text;a&&href', + 二级:'*', +} \ No newline at end of file diff --git a/models/rules.db b/models/rules.db index 5bab170b985ece673fed633c415766dc1636773b..ba625b869d246ed0fb1b5d497d7d14d508e6b685 100644 GIT binary patch delta 308 zcmZo@U}|V!njp=XFj2;tF=1oE5`Jb8*3!xB0_sexr5hVvS?e36#n>4n8>6Ecp0@6O zzIy$$=}TYEU-@kMg69hw)t;?c{(N5_l=EcA+Go?+pRS$$bmvqxsIoboAZ1Ty?|rgs z`HS{d&$@e|oTrW3!JOWOFB@h(?OO3{&uXa9-(&uIzW;nTHVY{n;p66FmSluDT5R)U zJw-(k4z3&q{vf_3yx(|Zc-C=0;g;gc+1MDu#oVYZKl!4G8k4!n