From aca32b3cdc12a61da78cdc56f123c0db86f6d941 Mon Sep 17 00:00:00 2001
From: jnozsc <470215+jnozsc@users.noreply.github.com>
Date: Sat, 25 Jul 2020 14:13:49 -0700
Subject: [PATCH 1/5] fix fanza
---
fanza.py | 15 ++++++++++-----
1 file changed, 10 insertions(+), 5 deletions(-)
diff --git a/fanza.py b/fanza.py
index d33abc7..617949a 100644
--- a/fanza.py
+++ b/fanza.py
@@ -2,6 +2,7 @@
# -*- coding: utf-8 -*-
import json
import re
+from urllib.parse import urlencode
from lxml import etree
@@ -108,7 +109,7 @@ def getRelease(text):
)[0].lstrip("\n")
except:
pass
- return result.replace('/','-')
+ return result.replace("/", "-")
def getTag(text):
@@ -187,8 +188,7 @@ def getSeries(text):
)[0]
return result
except:
- return ''
-
+ return ""
def main(number):
@@ -210,9 +210,14 @@ def main(number):
"https://www.dmm.co.jp/digital/nikkatsu/-/detail/=/cid=",
]
chosen_url = ""
+
for url in fanza_urls:
chosen_url = url + fanza_search_number
- htmlcode = get_html(chosen_url)
+ htmlcode = get_html(
+ "https://www.dmm.co.jp/age_check/=/declared=yes/?{}".format(
+ urlencode({"rurl": chosen_url})
+ )
+ )
if "404 Not Found" not in htmlcode:
break
if "404 Not Found" in htmlcode:
@@ -284,4 +289,4 @@ def main_htmlcode(number):
if __name__ == "__main__":
- print(main("DV-1562"))
\ No newline at end of file
+ print(main("DV-1562"))
From 121c20864b1976ea11404f9f7c9b653ee667c70a Mon Sep 17 00:00:00 2001
From: jnozsc <470215+jnozsc@users.noreply.github.com>
Date: Sat, 25 Jul 2020 14:14:56 -0700
Subject: [PATCH 2/5] import cloudscraper only when necessary
---
ADC_function.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/ADC_function.py b/ADC_function.py
index 86fc447..44707cf 100755
--- a/ADC_function.py
+++ b/ADC_function.py
@@ -1,6 +1,5 @@
import requests
from lxml import etree
-import cloudscraper
import config
@@ -87,6 +86,7 @@ def post_html(url: str, query: dict) -> requests.Response:
def get_javlib_cookie() -> [dict, str]:
+ import cloudscraper
proxy, timeout, retry_count, proxytype = config.Config().proxy()
proxies = get_proxy(proxy, proxytype)
From 97182f924954b0dcc59a30ce7c75ddac82c1b4cc Mon Sep 17 00:00:00 2001
From: jnozsc <470215+jnozsc@users.noreply.github.com>
Date: Sat, 25 Jul 2020 14:20:01 -0700
Subject: [PATCH 3/5] fix #261
---
fanza.py | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/fanza.py b/fanza.py
index 617949a..8858c52 100644
--- a/fanza.py
+++ b/fanza.py
@@ -57,11 +57,11 @@ def getLabel(text):
html = etree.fromstring(text, etree.HTMLParser()) # //table/tr[1]/td[1]/text()
try:
result = html.xpath(
- "//td[contains(text(),'シリーズ:')]/following-sibling::td/a/text()"
+ "//td[contains(text(),'レーベル:')]/following-sibling::td/a/text()"
)[0]
except:
result = html.xpath(
- "//td[contains(text(),'シリーズ:')]/following-sibling::td/text()"
+ "//td[contains(text(),'レーベル:')]/following-sibling::td/text()"
)[0]
return result
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 4/5] 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"))
From 5f20f61fc50df8ddb7dc78a6322330ee5386d632 Mon Sep 17 00:00:00 2001
From: jnozsc <470215+jnozsc@users.noreply.github.com>
Date: Sat, 25 Jul 2020 14:39:01 -0700
Subject: [PATCH 5/5] one more fix on #261
---
core.py | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/core.py b/core.py
index 1a13ec2..fe1e150 100755
--- a/core.py
+++ b/core.py
@@ -168,7 +168,8 @@ def get_info(json_data): # 返回json里的数据
cover = json_data['cover']
website = json_data['website']
series = json_data['series']
- return title, studio, year, outline, runtime, director, actor_photo, release, number, cover, website, series
+ label = json_data.get('label', "")
+ return title, studio, year, outline, runtime, director, actor_photo, release, number, cover, website, series, label
def small_cover_check(path, number, cover_small, c_word, conf: config.Config, filepath, failed_folder):
@@ -177,7 +178,7 @@ def small_cover_check(path, number, cover_small, c_word, conf: config.Config, fi
def create_folder(success_folder, location_rule, json_data, conf: config.Config): # 创建文件夹
- title, studio, year, outline, runtime, director, actor_photo, release, number, cover, website, series= get_info(json_data)
+ title, studio, year, outline, runtime, director, actor_photo, release, number, cover, website, series, label = get_info(json_data)
if len(location_rule) > 240: # 新建成功输出文件夹
path = success_folder + '/' + location_rule.replace("'actor'", "'manypeople'", 3).replace("actor","'manypeople'",3) # path为影片+元数据所在目录
else:
@@ -265,7 +266,7 @@ def image_download(cover, number, c_word, path, conf: config.Config, filepath, f
def print_files(path, c_word, naming_rule, part, cn_sub, json_data, filepath, failed_folder, tag, actor_list, liuchu):
- title, studio, year, outline, runtime, director, actor_photo, release, number, cover, website, series = get_info(json_data)
+ title, studio, year, outline, runtime, director, actor_photo, release, number, cover, website, series, label = get_info(json_data)
try:
if not os.path.exists(path):
@@ -293,8 +294,7 @@ def print_files(path, c_word, naming_rule, part, cn_sub, json_data, filepath, fa
except:
aaaa = ''
print(" " + studio + "", file=code)
- print(" ", file=code)
+ print(" ", file=code)
if cn_sub == '1':
print(" 中文字幕", file=code)
if liuchu == '流出':