diff --git a/WebCrawler/javdb.py b/WebCrawler/javdb.py index 78c2aeb..48ae997 100644 --- a/WebCrawler/javdb.py +++ b/WebCrawler/javdb.py @@ -13,11 +13,24 @@ def getTitle(a): html = etree.fromstring(a, etree.HTMLParser()) result = html.xpath("/html/body/section/div/h2/strong/text()")[0] 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() - result1 = str(html.xpath('//strong[contains(text(),"演員")]/../span/text()')).strip(" ['']") - result2 = str(html.xpath('//strong[contains(text(),"演員")]/../span/a/text()')).strip(" ['']") - return str(result1 + result2).strip('+').replace(",\\xa0", "").replace("'", "").replace(' ', '').replace(',,', '').replace('N/A', '').lstrip(',').replace(',', ', ') + +def getActor(a): + html = etree.fromstring(a, etree.HTMLParser()) + actors = html.xpath('//span[@class="value"]/a[contains(@href,"/actors/")]/text()') + 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): html_page = get_html(url) @@ -276,3 +289,4 @@ if __name__ == "__main__": # print(main('AGAV-042')) print(main('BANK-022')) print(main('FC2-735670')) + print(main('MVSD-439')) diff --git a/config.ini b/config.ini index 33c65b7..a11f59e 100644 --- a/config.ini +++ b/config.ini @@ -7,6 +7,8 @@ failed_move=0 auto_exit=0 transalte_to_sc=0 multi_threading=1 +;actor_gender value: female or male or both or all(含人妖) +actor_gender=female [proxy] ;proxytype: http or socks5 or socks5h switch: 0 1 diff --git a/config.py b/config.py index 700b092..0df09eb 100644 --- a/config.py +++ b/config.py @@ -39,6 +39,9 @@ class Config: def success_folder(self) -> str: 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: return self.conf.getboolean("common", "soft_link") def failed_move(self) -> bool: @@ -58,8 +61,8 @@ class Config: return self.conf.getboolean("watermark", "switch") def is_extrafanart(self) -> bool: - return self.conf.getboolean("extrafanart", "switch") - + return self.conf.getboolean("extrafanart", "switch") + def watermark_type(self) -> int: return int(self.conf.get("watermark", "water")) @@ -103,19 +106,19 @@ class Config: def cacert_file(self) -> str: return self.conf.get('proxy', 'cacert_file') - + def media_type(self) -> str: return self.conf.get('media', 'media_type') def sub_rule(self): return self.conf.get('media', 'sub_type').split(',') - + def naming_rule(self) -> str: return self.conf.get("Name_Rule", "naming_rule") def location_rule(self) -> str: return self.conf.get("Name_Rule", "location_rule") - + def max_title_len(self) -> int: """ Maximum title length @@ -162,6 +165,8 @@ class Config: conf.set(sec1, "failed_move", "1") conf.set(sec1, "auto_exit", "0") 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" conf.add_section(sec2) @@ -203,7 +208,7 @@ class Config: conf.set(sec8, "key", "") conf.set(sec8, "delay", "1") conf.set(sec8, "values", "title,outline") - + sec9 = "trailer" conf.add_section(sec9) conf.set(sec9, "switch", "0") @@ -252,3 +257,4 @@ if __name__ == "__main__": print(config.get_transalte_key()) print(config.get_transalte_delay()) print(config.transalte_values()) + print(config.actor_gender())