更精确的有码无码处理
This commit is contained in:
@@ -60,7 +60,7 @@ def get_year(lx: html.HtmlElement) -> str:
|
|||||||
|
|
||||||
def get_outline(lx: html.HtmlElement, number: str, title: str) -> str:
|
def get_outline(lx: html.HtmlElement, number: str, title: str) -> str:
|
||||||
o = lx.xpath("//div[@class='movie-info section']/p[@itemprop='description']/text()")[0].strip()
|
o = lx.xpath("//div[@class='movie-info section']/p[@itemprop='description']/text()")[0].strip()
|
||||||
g = getStoryline(number, title)
|
g = getStoryline(number, title, 无码=True)
|
||||||
if len(g):
|
if len(g):
|
||||||
return g
|
return g
|
||||||
return o
|
return o
|
||||||
|
|||||||
@@ -60,10 +60,10 @@ def getCID(html):
|
|||||||
string = html.xpath("//a[contains(@class,'sample-box')][1]/@href")[0].replace('https://pics.dmm.co.jp/digital/video/','')
|
string = html.xpath("//a[contains(@class,'sample-box')][1]/@href")[0].replace('https://pics.dmm.co.jp/digital/video/','')
|
||||||
result = re.sub('/.*?.jpg','',string)
|
result = re.sub('/.*?.jpg','',string)
|
||||||
return result
|
return result
|
||||||
def getOutline(number, title): #获取剧情介绍 多进程并发查询
|
def getOutline(number, title, uncensored): #获取剧情介绍 多进程并发查询
|
||||||
if any(caller for caller in inspect.stack() if os.path.basename(caller.filename) == 'airav.py'):
|
if any(caller for caller in inspect.stack() if os.path.basename(caller.filename) == 'airav.py'):
|
||||||
return '' # 从airav.py过来的调用不计算outline直接返回,避免重复抓取数据拖慢处理速度
|
return '' # 从airav.py过来的调用不计算outline直接返回,避免重复抓取数据拖慢处理速度
|
||||||
return getStoryline(number,title)
|
return getStoryline(number,title, 无码=uncensored)
|
||||||
def getSeriseJa(html):
|
def getSeriseJa(html):
|
||||||
x = html.xpath('//span[contains(text(),"シリーズ:")]/../a/text()')
|
x = html.xpath('//span[contains(text(),"シリーズ:")]/../a/text()')
|
||||||
return str(x[0]) if len(x) else ''
|
return str(x[0]) if len(x) else ''
|
||||||
@@ -98,7 +98,7 @@ def main_uncensored(number):
|
|||||||
'title': title,
|
'title': title,
|
||||||
'studio': getStudioJa(lx),
|
'studio': getStudioJa(lx),
|
||||||
'year': getYear(lx),
|
'year': getYear(lx),
|
||||||
'outline': getOutline(w_number, title),
|
'outline': getOutline(w_number, title, True),
|
||||||
'runtime': getRuntime(lx),
|
'runtime': getRuntime(lx),
|
||||||
'director': getDirectorJa(lx),
|
'director': getDirectorJa(lx),
|
||||||
'actor': getActor(lx),
|
'actor': getActor(lx),
|
||||||
@@ -141,7 +141,7 @@ def main(number):
|
|||||||
'title': title,
|
'title': title,
|
||||||
'studio': getStudio(lx),
|
'studio': getStudio(lx),
|
||||||
'year': getYear(lx),
|
'year': getYear(lx),
|
||||||
'outline': getOutline(number, title),
|
'outline': getOutline(number, title, getUncensored(lx)),
|
||||||
'runtime': getRuntime(lx),
|
'runtime': getRuntime(lx),
|
||||||
'director': getDirector(lx),
|
'director': getDirector(lx),
|
||||||
'actor': getActor(lx),
|
'actor': getActor(lx),
|
||||||
|
|||||||
@@ -166,8 +166,8 @@ def getDirector(html):
|
|||||||
result1 = str(html.xpath('//strong[contains(text(),"導演")]/../span/text()')).strip(" ['']")
|
result1 = str(html.xpath('//strong[contains(text(),"導演")]/../span/text()')).strip(" ['']")
|
||||||
result2 = str(html.xpath('//strong[contains(text(),"導演")]/../span/a/text()')).strip(" ['']")
|
result2 = str(html.xpath('//strong[contains(text(),"導演")]/../span/a/text()')).strip(" ['']")
|
||||||
return str(result1 + result2).strip('+').replace("', '", '').replace('"', '')
|
return str(result1 + result2).strip('+').replace("', '", '').replace('"', '')
|
||||||
def getOutline(number, title): #获取剧情介绍 多进程并发查询
|
def getOutline(number, title, uncensored): #获取剧情介绍 多进程并发查询
|
||||||
return getStoryline(number,title)
|
return getStoryline(number, title, 无码=uncensored)
|
||||||
def getSeries(html):
|
def getSeries(html):
|
||||||
result1 = str(html.xpath('//strong[contains(text(),"系列")]/../span/text()')).strip(" ['']")
|
result1 = str(html.xpath('//strong[contains(text(),"系列")]/../span/text()')).strip(" ['']")
|
||||||
result2 = str(html.xpath('//strong[contains(text(),"系列")]/../span/a/text()')).strip(" ['']")
|
result2 = str(html.xpath('//strong[contains(text(),"系列")]/../span/a/text()')).strip(" ['']")
|
||||||
@@ -287,7 +287,7 @@ def main(number):
|
|||||||
'actor': getActor(lx),
|
'actor': getActor(lx),
|
||||||
'title': title,
|
'title': title,
|
||||||
'studio': getStudio(detail_page, lx),
|
'studio': getStudio(detail_page, lx),
|
||||||
'outline': getOutline(number, title),
|
'outline': getOutline(number, title, getUncensored(lx)),
|
||||||
'runtime': getRuntime(lx),
|
'runtime': getRuntime(lx),
|
||||||
'director': getDirector(lx),
|
'director': getDirector(lx),
|
||||||
'release': getRelease(detail_page),
|
'release': getRelease(detail_page),
|
||||||
|
|||||||
@@ -25,14 +25,15 @@ class noThread(object):
|
|||||||
|
|
||||||
|
|
||||||
# 获取剧情介绍 从列表中的站点同时查,取值优先级从前到后
|
# 获取剧情介绍 从列表中的站点同时查,取值优先级从前到后
|
||||||
def getStoryline(number, title, sites: list=None):
|
def getStoryline(number, title, sites: list=None, 无码=None):
|
||||||
start_time = time.time()
|
start_time = time.time()
|
||||||
conf = config.getInstance()
|
conf = config.getInstance()
|
||||||
if not conf.is_storyline():
|
if not conf.is_storyline():
|
||||||
return ''
|
return ''
|
||||||
debug = conf.debug() or conf.storyline_show() == 2
|
debug = conf.debug() or conf.storyline_show() == 2
|
||||||
storyine_sites = conf.storyline_site().split(',') if sites is None else sites
|
storyine_sites = conf.storyline_site().split(',') if sites is None else sites
|
||||||
if is_uncensored(number):
|
unc = 无码 if isinstance(无码, bool) else is_uncensored(number)
|
||||||
|
if unc:
|
||||||
storyine_sites += conf.storyline_uncensored_site().split(',')
|
storyine_sites += conf.storyline_uncensored_site().split(',')
|
||||||
else:
|
else:
|
||||||
storyine_sites += conf.storyline_censored_site().split(',')
|
storyine_sites += conf.storyline_censored_site().split(',')
|
||||||
|
|||||||
@@ -128,7 +128,7 @@ def getOutline(html, number, title):
|
|||||||
a = set(storyline_site) & {'airav', 'avno1'} # 只要中文的简介文字
|
a = set(storyline_site) & {'airav', 'avno1'} # 只要中文的简介文字
|
||||||
if len(a):
|
if len(a):
|
||||||
site = [n for n in storyline_site if n in a]
|
site = [n for n in storyline_site if n in a]
|
||||||
g = getStoryline(number, title, site)
|
g = getStoryline(number, title, site, 无码=False)
|
||||||
if len(g):
|
if len(g):
|
||||||
return g
|
return g
|
||||||
try:
|
try:
|
||||||
|
|||||||
4
core.py
4
core.py
@@ -724,10 +724,8 @@ def core_main(movie_path, number_th, oCC):
|
|||||||
c_word = '-C' # 中文字幕影片后缀
|
c_word = '-C' # 中文字幕影片后缀
|
||||||
|
|
||||||
# 判断是否无码
|
# 判断是否无码
|
||||||
uncensored = 1 if is_uncensored(number) else 0
|
|
||||||
unce = json_data.get('无码')
|
unce = json_data.get('无码')
|
||||||
if type(unce) is bool:
|
uncensored = int(unce) if isinstance(unce, bool) else int(is_uncensored(number))
|
||||||
uncensored = 1 if unce else 0
|
|
||||||
|
|
||||||
if '流出' in movie_path or 'uncensored' in movie_path.lower():
|
if '流出' in movie_path or 'uncensored' in movie_path.lower():
|
||||||
liuchu = '流出'
|
liuchu = '流出'
|
||||||
|
|||||||
Reference in New Issue
Block a user