Merge pull request #490 from lededev/javdb_gdr

fix javdb actors section
This commit is contained in:
Yoshiko2
2021-05-20 19:31:50 +08:00
committed by GitHub
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:
@@ -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)
@@ -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())