diff --git a/app.py b/app.py index b8851480507d8e29233d7f9f4fdb47e4f4929251..32fb42d74a4d7e37f0820a2037b2c82ca7ea2469 100644 --- a/app.py +++ b/app.py @@ -55,6 +55,19 @@ def vod(): cms = CMS(rule) print(cms) print(cms.title) + wd = getParmas('wd') + ac = getParmas('ac') + quick = getParmas('quick') + play = getParmas('play') + flag = getParmas('flag') + filter = getParmas('filter') + t = getParmas('t') + pg = getParmas('pg') + ext = getParmas('ext') + ids = getParmas('ids') + q = getParmas('q') + print(getParmas()) + return jsonify({'rule':rule,'js_code':js_code}) if __name__ == '__main__': diff --git "a/js/\351\270\255\345\245\210\351\243\236.js" "b/js/\351\270\255\345\245\210\351\243\236.js" index 388673022288faa4db96d7fab1d47ab3db5de328..8def5666873b1b22d5ddbe766a7ce892c96c2e2a 100644 --- "a/js/\351\270\255\345\245\210\351\243\236.js" +++ "b/js/\351\270\255\345\245\210\351\243\236.js" @@ -9,5 +9,5 @@ var rule = { class_url:'dianying&lianxuju&zongyi&dongman', 一级:'body a.module-poster-item.module-item;a&&title;.lazyload&&data-original;.module-item-note&&Text;a&&href', 二级:{"title":"h1&&Text;.module-info-tag&&Text","img":".lazyload&&data-original","desc":".module-info-item:eq(1)&&Text;.module-info-item:eq(2)&&Text;.module-info-item:eq(3)&&Text","content":".module-info-introduction&&Text","tabs":".module-tab-item","lists":".module-play-list:eq(#id) a"}, - 搜索:'', + 搜索:'body .module-item;.module-card-item-title&&Text;.lazyload&&data-original;.module-item-note&&Text;a&&href;.module-info-item-content&&Text', } \ No newline at end of file diff --git a/models/cms.py b/models/cms.py index b175f7717f8dfdd8b8aca5872cc655e895c6b9e3..1851632904cdcec563c4a6784988cc0df0e8a785 100644 --- a/models/cms.py +++ b/models/cms.py @@ -8,6 +8,7 @@ import requests from utils.web import * from utils.config import config from utils.htmlParser import jsoup +from urllib.parse import urljoin class CMS: def __init__(self,rule): @@ -92,8 +93,8 @@ class CMS: # params = '-'.join(urlParams) # print(params) # url = self.url + '/{0}.html'.format(params) - fypage = str(fypage) - url = self.url.replace('fyclass',fyclass).replace('fypage',fypage) + pg = str(fypage) + url = self.url.replace('fyclass',fyclass).replace('fypage',pg) print(url) headers = {'user-agent': self.ua} r = requests.get(url, headers=headers) @@ -113,7 +114,7 @@ class CMS: img = pd(item, p[2]) desc = pdfh(item, p[3]) link = pd(item, p[4]) - content = '' + content = '' if len(p) < 6 else pdfh(item, p[5]) # sid = self.regStr(sid, "/video/(\\S+).html") videos.append({ "vod_id": link, @@ -218,6 +219,43 @@ class CMS: } return result + def searchContent(self, key, fypage=1,quick=1): + pg = str(fypage) + url = self.searchUrl.replace('**', key).replace('fypage',pg) + if not str(url).startswith('http'): + url = urljoin(self.url,url) + print(url) + headers = {'user-agent': self.ua} + r = requests.get(url, headers=headers) + html = r.text + p = self.搜索.split(';') # 解析 + jsp = jsoup(self.url) + pdfh = jsp.pdfh + pdfa = jsp.pdfa + pd = jsp.pd + pq = jsp.pq + items = pdfa(html, p[0]) + videos = [] + for item in items: + # print(item) + title = pdfh(item, p[1]) + img = pd(item, p[2]) + desc = pdfh(item, p[3]) + link = pd(item, p[4]) + content = '' if len(p) < 6 else pdfh(item, p[5]) + # sid = self.regStr(sid, "/video/(\\S+).html") + videos.append({ + "vod_id": link, + "vod_name": title, + "vod_pic": img, + "vod_remarks": desc, + "vod_content": content, + }) + result = { + 'list': videos + } + return result + if __name__ == '__main__': from utils import parser js_path = f'js/鸭奈飞.js' @@ -227,4 +265,5 @@ if __name__ == '__main__': print(cms.title) # print(cms.homeContent()) # cms.categoryContent('dianying',1) - print(cms.detailContent(['67391'])) \ No newline at end of file + # print(cms.detailContent(['67391'])) + print(cms.searchContent('斗罗大陆')) \ No newline at end of file diff --git a/pycms.json b/pycms.json index ed7e23c7518281a23dab5696feba356d665f7d3d..1129b5e119be99ea1e3eaf7c0550522ba9e1c5a2 100644 --- a/pycms.json +++ b/pycms.json @@ -2,7 +2,7 @@ "key":"dr_yanaifei", "name":"鸭奈飞", "type":4, - "api":"http://127.0.0.1:9000/vod?rule=鸭奈飞", + "api":"http://192.168.10.99:9000/vod?rule=鸭奈飞", "searchable": 1, "quickSearch": 1, "filterable": 1