From 3b79cf31dc3d5d764a21ef4891f30cda7b3a4413 Mon Sep 17 00:00:00 2001 From: jnozsc <470215+jnozsc@users.noreply.github.com> Date: Sat, 25 Jul 2020 14:27:24 -0700 Subject: [PATCH] fix #251 --- fanza.py | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/fanza.py b/fanza.py index 8858c52..71aab6a 100644 --- a/fanza.py +++ b/fanza.py @@ -15,7 +15,7 @@ from ADC_function import * def getTitle(text): html = etree.fromstring(text, etree.HTMLParser()) - result = html.xpath('//*[@id="title"]/text()')[0] + result = html.xpath('//*[starts-with(@id, "title")]/text()')[0] return result @@ -94,9 +94,12 @@ def getRelease(text): "//td[contains(text(),'発売日:')]/following-sibling::td/a/text()" )[0].lstrip("\n") except: - result = html.xpath( - "//td[contains(text(),'発売日:')]/following-sibling::td/text()" - )[0].lstrip("\n") + try: + result = html.xpath( + "//td[contains(text(),'発売日:')]/following-sibling::td/text()" + )[0].lstrip("\n") + except: + result = "----" if result == "----": try: result = html.xpath( @@ -208,6 +211,7 @@ def main(number): "https://www.dmm.co.jp/mono/anime/-/detail/=/cid=", "https://www.dmm.co.jp/digital/videoc/-/detail/=/cid=", "https://www.dmm.co.jp/digital/nikkatsu/-/detail/=/cid=", + "https://www.dmm.co.jp/rental/-/detail/=/cid=", ] chosen_url = "" @@ -290,3 +294,4 @@ def main_htmlcode(number): if __name__ == "__main__": print(main("DV-1562")) + print(main("96fad1217"))