modify scripts
This commit is contained in:
+29
-15
@@ -178,6 +178,7 @@ class JavbusCrawler(GenericCrawler):
|
||||
"""
|
||||
result = {
|
||||
'avatar': {},
|
||||
'title' : {},
|
||||
'movies': []
|
||||
}
|
||||
|
||||
@@ -189,6 +190,9 @@ class JavbusCrawler(GenericCrawler):
|
||||
else:
|
||||
logging.debug(f"avatar-box not found. href: {href}")
|
||||
|
||||
# 解析页面上的title,获取影片数量等信息
|
||||
result['title'] = self.parse_title_info(soup, href)
|
||||
|
||||
# 解析影片列表
|
||||
movie_boxes = soup.find_all('a', class_='movie-box')
|
||||
if movie_boxes:
|
||||
@@ -336,17 +340,9 @@ class JavbusCrawler(GenericCrawler):
|
||||
|
||||
return movie_info
|
||||
|
||||
|
||||
# 获取演员详情
|
||||
def parse_studios_labels_series_detail(self, soup, href):
|
||||
"""
|
||||
解析Javbus网页内容,提取演员信息和影片列表
|
||||
"""
|
||||
result = {
|
||||
'meta': {},
|
||||
'movies': []
|
||||
}
|
||||
|
||||
# 获取页面头部的信息
|
||||
def parse_title_info(self, soup, href):
|
||||
title_info = {}
|
||||
try:
|
||||
# 解析标题
|
||||
b_tag = soup.select_one('.alert.alert-success.alert-common p b')
|
||||
@@ -367,8 +363,8 @@ class JavbusCrawler(GenericCrawler):
|
||||
# 提取前两个元素作为工作室和角色
|
||||
studio = parts[video_index - 2]
|
||||
role = parts[video_index - 1]
|
||||
result['meta']['title'] = studio
|
||||
result['meta']['role'] = role
|
||||
title_info['title'] = studio
|
||||
title_info['role'] = role
|
||||
else:
|
||||
logging.debug(f"无法按规则解析: {' - '.join(parts)}")
|
||||
|
||||
@@ -384,13 +380,31 @@ class JavbusCrawler(GenericCrawler):
|
||||
if '全部影片' in text:
|
||||
match = re.search(r'全部影片\s*(\d+)\s*', text)
|
||||
if match:
|
||||
result['meta']['movies_cnt'] = int(match.group(1))
|
||||
title_info['movies_cnt'] = int(match.group(1))
|
||||
|
||||
# 提取已有磁力数量
|
||||
if '已有磁力' in text:
|
||||
match = re.search(r'已有磁力\s*(\d+)\s*', text)
|
||||
if match:
|
||||
result['meta']['magnet_cnt'] = int(match.group(1))
|
||||
title_info['magnet_cnt'] = int(match.group(1))
|
||||
except Exception as e:
|
||||
logging.warning(f"parse html error: {str(e)}, href: {href}", exc_info=True)
|
||||
|
||||
return title_info
|
||||
|
||||
# 获取演员详情
|
||||
def parse_studios_labels_series_detail(self, soup, href):
|
||||
"""
|
||||
解析Javbus网页内容,提取演员信息和影片列表
|
||||
"""
|
||||
result = {
|
||||
'meta': {},
|
||||
'movies': []
|
||||
}
|
||||
|
||||
try:
|
||||
# 解析标题
|
||||
result['meta'] = self.parse_title_info(soup, href)
|
||||
|
||||
div_waterfall = soup.find('div', id='waterfall')
|
||||
if not div_waterfall:
|
||||
|
||||
Reference in New Issue
Block a user