fix javdb actors section

This commit is contained in:
lededev
2021-05-19 15:41:55 +08:00
parent 78e725f603
commit a900019099
3 changed files with 33 additions and 11 deletions

View File

@@ -13,11 +13,24 @@ def getTitle(a):
html = etree.fromstring(a, etree.HTMLParser()) html = etree.fromstring(a, etree.HTMLParser())
result = html.xpath("/html/body/section/div/h2/strong/text()")[0] result = html.xpath("/html/body/section/div/h2/strong/text()")[0]
return result return result
def getActor(a): # //*[@id="center_column"]/div[2]/div[1]/div/table/tbody/tr[1]/td/text()
html = etree.fromstring(a, etree.HTMLParser()) # //table/tr[1]/td[1]/text() def getActor(a):
result1 = str(html.xpath('//strong[contains(text(),"演員")]/../span/text()')).strip(" ['']") html = etree.fromstring(a, etree.HTMLParser())
result2 = str(html.xpath('//strong[contains(text(),"演員")]/../span/a/text()')).strip(" ['']") actors = html.xpath('//span[@class="value"]/a[contains(@href,"/actors/")]/text()')
return str(result1 + result2).strip('+').replace(",\\xa0", "").replace("'", "").replace(' ', '').replace(',,', '').replace('N/A', '').lstrip(',').replace(',', ', ') genders = html.xpath('//span[@class="value"]/a[contains(@href,"/actors/")]/../strong/@class')
r = []
idx = 0
actor_gendor = config.Config().actor_gender()
if not actor_gendor in ['female','male','both','all']:
actor_gendor = 'female'
for act in actors:
if((actor_gendor == 'all')
or (actor_gendor == 'both' and genders[idx] in ['symbol female', 'symbol male'])
or (actor_gendor == 'female' and genders[idx] == 'symbol female')
or (actor_gendor == 'male' and genders[idx] == 'symbol male')):
r.append(act)
idx = idx + 1
return r
def getaphoto(url): def getaphoto(url):
html_page = get_html(url) html_page = get_html(url)
@@ -276,3 +289,4 @@ if __name__ == "__main__":
# print(main('AGAV-042')) # print(main('AGAV-042'))
print(main('BANK-022')) print(main('BANK-022'))
print(main('FC2-735670')) print(main('FC2-735670'))
print(main('MVSD-439'))

View File

@@ -7,6 +7,8 @@ failed_move=0
auto_exit=0 auto_exit=0
transalte_to_sc=0 transalte_to_sc=0
multi_threading=1 multi_threading=1
;actor_gender value: female or male or both or all(含人妖)
actor_gender=female
[proxy] [proxy]
;proxytype: http or socks5 or socks5h switch: 0 1 ;proxytype: http or socks5 or socks5h switch: 0 1

View File

@@ -39,6 +39,9 @@ class Config:
def success_folder(self) -> str: def success_folder(self) -> str:
return self.conf.get("common", "success_output_folder") return self.conf.get("common", "success_output_folder")
def actor_gender(self) -> str:
return self.conf.get("common", "actor_gender")
def soft_link(self) -> bool: def soft_link(self) -> bool:
return self.conf.getboolean("common", "soft_link") return self.conf.getboolean("common", "soft_link")
def failed_move(self) -> bool: def failed_move(self) -> bool:
@@ -58,8 +61,8 @@ class Config:
return self.conf.getboolean("watermark", "switch") return self.conf.getboolean("watermark", "switch")
def is_extrafanart(self) -> bool: def is_extrafanart(self) -> bool:
return self.conf.getboolean("extrafanart", "switch") return self.conf.getboolean("extrafanart", "switch")
def watermark_type(self) -> int: def watermark_type(self) -> int:
return int(self.conf.get("watermark", "water")) return int(self.conf.get("watermark", "water"))
@@ -103,19 +106,19 @@ class Config:
def cacert_file(self) -> str: def cacert_file(self) -> str:
return self.conf.get('proxy', 'cacert_file') return self.conf.get('proxy', 'cacert_file')
def media_type(self) -> str: def media_type(self) -> str:
return self.conf.get('media', 'media_type') return self.conf.get('media', 'media_type')
def sub_rule(self): def sub_rule(self):
return self.conf.get('media', 'sub_type').split(',') return self.conf.get('media', 'sub_type').split(',')
def naming_rule(self) -> str: def naming_rule(self) -> str:
return self.conf.get("Name_Rule", "naming_rule") return self.conf.get("Name_Rule", "naming_rule")
def location_rule(self) -> str: def location_rule(self) -> str:
return self.conf.get("Name_Rule", "location_rule") return self.conf.get("Name_Rule", "location_rule")
def max_title_len(self) -> int: def max_title_len(self) -> int:
""" """
Maximum title length Maximum title length
@@ -162,6 +165,8 @@ class Config:
conf.set(sec1, "failed_move", "1") conf.set(sec1, "failed_move", "1")
conf.set(sec1, "auto_exit", "0") conf.set(sec1, "auto_exit", "0")
conf.set(sec1, "transalte_to_sc", "1") conf.set(sec1, "transalte_to_sc", "1")
# actor_gender value: female or male or both or all(含人妖)
conf.set(sec1, "actor_gender", "female")
sec2 = "proxy" sec2 = "proxy"
conf.add_section(sec2) conf.add_section(sec2)
@@ -203,7 +208,7 @@ class Config:
conf.set(sec8, "key", "") conf.set(sec8, "key", "")
conf.set(sec8, "delay", "1") conf.set(sec8, "delay", "1")
conf.set(sec8, "values", "title,outline") conf.set(sec8, "values", "title,outline")
sec9 = "trailer" sec9 = "trailer"
conf.add_section(sec9) conf.add_section(sec9)
conf.set(sec9, "switch", "0") conf.set(sec9, "switch", "0")
@@ -252,3 +257,4 @@ if __name__ == "__main__":
print(config.get_transalte_key()) print(config.get_transalte_key())
print(config.get_transalte_delay()) print(config.get_transalte_delay())
print(config.transalte_values()) print(config.transalte_values())
print(config.actor_gender())