diff --git a/unittest/data/FC2-10000 (javdb).json b/unittest/data/FC2-10000 (javdb).json new file mode 100644 index 000000000..156975338 --- /dev/null +++ b/unittest/data/FC2-10000 (javdb).json @@ -0,0 +1,27 @@ +{ + "注": "此文件用来测试找不到番号时的处理,故各字段故意为空", + "dvdid": "FC2-10000", + "cid": null, + "url": null, + "plot": null, + "cover": null, + "big_cover": null, + "genre": null, + "genre_id": null, + "genre_norm": null, + "score": null, + "title": null, + "ori_title": null, + "magnet": null, + "serial": null, + "actress": null, + "actress_pics": null, + "director": null, + "duration": null, + "producer": null, + "publisher": null, + "uncensored": null, + "publish_date": null, + "preview_pics": null, + "preview_video": null +} \ No newline at end of file diff --git a/unittest/data/FC2-3189680 (javdb).json b/unittest/data/FC2-3189680 (javdb).json index be44ae5dd..c91eaf4f9 100644 --- a/unittest/data/FC2-3189680 (javdb).json +++ b/unittest/data/FC2-3189680 (javdb).json @@ -5,22 +5,37 @@ "plot": null, "cover": "https://c0.jdbstatic.com/covers/rm/rmVapJ.jpg", "big_cover": null, - "genre": null, - "genre_id": null, + "genre": [ + "私人攝影", + "制服", + "內射" + ], + "genre_id": [ + "fc2?c1=11", + "fc2?c1=19", + "fc2?c1=18" + ], "genre_norm": null, - "score": "8.00", + "score": "8.04", "title": "【体育館倉庫】某ハーフ子役モデルを高額援助。計2回のゴムなし大量中出し。※4K特典(1時間越え)", "ori_title": null, - "magnet": null, + "magnet": [ + "magnet:?xt=urn:btih:6d4fed9103648ab2e4a22697f363bd243f7feffa&dn=FC2-3189680", + "magnet:?xt=urn:btih:4dea0950176f3c5af0f14ad96528f79d7bdc48fa&dn=FC2PPV 3189680" + ], "serial": null, - "actress": null, + "actress": [ + "永瀬ゆい" + ], "actress_pics": null, "director": null, - "duration": null, - "producer": null, + "duration": "49", + "producer": "体育館倉庫", "publisher": null, "uncensored": null, "publish_date": "2023-02-20", - "preview_pics": null, - "preview_video": null + "preview_pics": [ + "https://c0.jdbstatic.com/samples/rm/rmVapJ_l_0.jpg" + ], + "preview_video": "https://javdb.com/v/rmVapJ" } \ No newline at end of file diff --git a/unittest/data/FC2-985469 (javdb).json b/unittest/data/FC2-985469 (javdb).json new file mode 100644 index 000000000..5a8308e05 --- /dev/null +++ b/unittest/data/FC2-985469 (javdb).json @@ -0,0 +1,63 @@ +{ + "dvdid": "FC2-985469", + "cid": null, + "url": "https://javdb.com/v/nzA44", + "plot": null, + "cover": "https://c0.jdbstatic.com/covers/nz/nzA44.jpg", + "big_cover": null, + "genre": [ + "私人攝影", + "素人", + "內射", + "原作", + "無碼", + "角色扮演", + "戀物癖", + "可愛" + ], + "genre_id": [ + "fc2?c1=11", + "fc2?c1=26", + "fc2?c1=18", + "fc2?c1=7", + "fc2?c1=24", + "fc2?c1=9", + "fc2?c1=13", + "fc2?c1=20" + ], + "genre_norm": null, + "score": "8.82", + "title": "【個人撮影・無】JD2回生ちゃんに中出し!エロマンガ先生のパジャマコスで中出しえっちさせててもらいました♪", + "ori_title": null, + "magnet": [ + "magnet:?xt=urn:btih:903ecbf73fd1a466e11e9454388c77c854f2463f&dn=FC2PPV-985469", + "magnet:?xt=urn:btih:851c21dab8d9a4883e8940240107aa94e5e0905d&dn=FC2-PPV-985469", + "magnet:?xt=urn:btih:649d36f0fd470f5950a1edc6fbb5922a1a82a39e&dn=[7sht.me]FC2PPV-985469", + "magnet:?xt=urn:btih:b2a57edade565821bd611b89dfca1f8d0e63e891&dn=fc2-985469", + "magnet:?xt=urn:btih:6be7ae12c4be3a0f7e27d1720b4e23e1134dcfd1&dn=FC2-985469", + "magnet:?xt=urn:btih:e2eaaaa085d14a010ff014991f3ef8ac48954920&dn=FC2-PPV-985469-HD", + "magnet:?xt=urn:btih:fc56fea5e868c3c28f2e3cd1731adc347c55267c&dn=FC2-PPV-983579-985469-纱雾" + ], + "serial": null, + "actress": [], + "actress_pics": null, + "director": null, + "duration": "113", + "producer": "COS☆ぱこ", + "publisher": null, + "uncensored": null, + "publish_date": "2018-11-23", + "preview_pics": [ + "https://c0.jdbstatic.com/samples/nz/nzA44_l_0.jpg", + "https://c0.jdbstatic.com/samples/nz/nzA44_l_1.jpg", + "https://c0.jdbstatic.com/samples/nz/nzA44_l_2.jpg", + "https://c0.jdbstatic.com/samples/nz/nzA44_l_3.jpg", + "https://c0.jdbstatic.com/samples/nz/nzA44_l_4.jpg", + "https://c0.jdbstatic.com/samples/nz/nzA44_l_5.jpg", + "https://c0.jdbstatic.com/samples/nz/nzA44_l_6.jpg", + "https://c0.jdbstatic.com/samples/nz/nzA44_l_7.jpg", + "https://c0.jdbstatic.com/samples/nz/nzA44_l_8.jpg", + "https://c0.jdbstatic.com/samples/nz/nzA44_l_9.jpg" + ], + "preview_video": "https://javdb.com/v/nzA44" +} \ No newline at end of file diff --git a/web/javdb.py b/web/javdb.py index feb2a5a76..ad62c00b5 100644 --- a/web/javdb.py +++ b/web/javdb.py @@ -8,6 +8,7 @@ from web.base import Request, resp2html from web.exceptions import * from core.func import * +from core.avid import guess_av_type from core.config import cfg from core.datatype import MovieInfo, GenreMap from core.chromium import get_browsers_cookies @@ -152,7 +153,11 @@ def parse_data(movie: MovieInfo): director_tag = info.xpath("div/strong[text()='導演:']") if director_tag: movie.director = director_tag[0].getnext().text_content().strip() - producer_tag = info.xpath("div/strong[text()='片商:']") + av_type = guess_av_type(movie.dvdid) + if av_type != 'fc2': + producer_tag = info.xpath("div/strong[text()='片商:']") + else: + producer_tag = info.xpath("div/strong[text()='賣家:']") if producer_tag: movie.producer = producer_tag[0].getnext().text_content().strip() publisher_tag = info.xpath("div/strong[text()='發行:']") @@ -202,7 +207,7 @@ def parse_clean_data(movie: MovieInfo): except SiteBlocked: raise logger.error('JavDB: 可能触发了反爬虫机制,请稍后再试') - if movie.genre_id: + if movie.genre_id and (not movie.genre_id[0].startswith('fc2?')): movie.genre_norm = genre_map.map(movie.genre_id) movie.genre_id = None # 没有别的地方需要再用到,清空genre id(表明已经完成转换) @@ -212,7 +217,7 @@ def parse_clean_data(movie: MovieInfo): pretty_errors.configure(display_link=True) logger.root.handlers[1].level = logging.DEBUG - movie = MovieInfo('STARS-256') + movie = MovieInfo('FC2-3189680') try: parse_clean_data(movie) print(movie)