diff --git a/py/西瓜影视.py b/py/西瓜影视.py deleted file mode 100644 index f9db284..0000000 --- a/py/西瓜影视.py +++ /dev/null @@ -1,336 +0,0 @@ -# -*- coding: utf-8 -*- -# by @PyramidStore AutoGen -import re -import sys -sys.path.append('..') -import json -from urllib.parse import quote -from base.spider import Spider - - -class Spider(Spider): - - def init(self, extend=""): - self.nav_host = 'https://www.xiguadh.com' - self.headers = { - 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36', - 'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8', - 'Accept-Language': 'zh-CN,zh;q=0.9,en;q=0.8', - } - self.host = self._get_host() - - def _get_host(self): - """获取视频站点 URL,失败时从导航页获取""" - default_host = 'https://www.bzzdyy.com' - try: - r = self.fetch(default_host, headers=self.headers, timeout=10, verify=False) - if r.status_code == 200: - return default_host - except Exception: - pass - try: - r = self.fetch(self.nav_host, headers=self.headers, timeout=15, verify=False) - html = r.text - urls = re.findall(r'url:\s*["\']([^"\']+)["\']', html) - for url in urls: - if url.startswith('http') and 'xiguadh' not in url: - return url.rstrip('/') - except Exception: - pass - return default_host - - def getName(self): - return '西瓜影院' - - def isVideoFormat(self, url): - return False - - def manualVideoCheck(self): - return True - - def homeContent(self, filter): - try: - r = self.fetch(self.host, headers=self.headers, timeout=15, verify=False) - html = r.text - # 提取主要分类 - nav_match = re.search(r'
', html, re.DOTALL) - if nav_match: - nav_html = nav_match.group(1) - categories = re.findall(r'