Skip to content

Commit

Permalink
Fix #226: avwiki: 修复演员名的字符串被当做列表处理的问题
Browse files Browse the repository at this point in the history
  • Loading branch information
Yuukiy committed Feb 25, 2024
1 parent aae4612 commit fe86a74
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 5 deletions.
4 changes: 3 additions & 1 deletion unittest/data/259LUXU-593 (avwiki).json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@
"ori_title": null,
"magnet": null,
"serial": "ラグジュTV",
"actress": "白咲りの",
"actress": [
"白咲りの"
],
"actress_pics": null,
"director": null,
"duration": null,
Expand Down
4 changes: 3 additions & 1 deletion unittest/data/300MIUM-1001 (avwiki).json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@
"ori_title": null,
"magnet": null,
"serial": "レンタル彼女",
"actress": "沙優七羽",
"actress": [
"沙優七羽"
],
"actress_pics": null,
"director": null,
"duration": null,
Expand Down
30 changes: 30 additions & 0 deletions unittest/data/SSIS-698 (avwiki).json
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
{
"dvdid": "SSIS-698",
"cid": null,
"url": "https://av-wiki.net/SSIS-698",
"plot": null,
"cover": "https://pics.dmm.co.jp/digital/video/ssis00698/ssis00698pl.jpg",
"big_cover": null,
"genre": null,
"genre_id": null,
"genre_norm": null,
"score": null,
"title": "三上悠亜と新ありなと相沢みなみ",
"ori_title": null,
"magnet": null,
"serial": null,
"actress": [
"三上悠亜",
"新ありな",
"相沢みなみ"
],
"actress_pics": null,
"director": null,
"duration": null,
"producer": "エスワン ナンバーワンスタイル",
"publisher": null,
"uncensored": false,
"publish_date": "2023-05-05",
"preview_pics": null,
"preview_video": null
}
9 changes: 6 additions & 3 deletions web/avwiki.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,15 @@ def parse_data(movie: MovieInfo):
dt_txt_ls, dd_tags = info.xpath("dt/text()"), info.xpath("dd")
data = {}
for dt_txt, dd in zip(dt_txt_ls, dd_tags):
dt_txt = dt_txt.strip()
a_tag = dd.xpath('a')
if len(a_tag) == 0:
dd_txt = dd.text
dd_txt = dd.text.strip()
else:
dd_txt = a_tag[0].text
data[dt_txt.strip()] = dd_txt.strip()
dd_txt = [i.text.strip() for i in a_tag]
if isinstance(dd_txt, list) and dt_txt != 'AV女優名': # 只有女优名以列表的数据格式保留
dd_txt = dd_txt[0]
data[dt_txt] = dd_txt

ATTR_MAP = {'メーカー': 'producer', 'AV女優名': 'actress', 'メーカー品番': 'dvdid', 'シリーズ': 'serial', '配信開始日': 'publish_date'}
for key, attr in ATTR_MAP.items():
Expand Down

0 comments on commit fe86a74

Please sign in to comment.