diff --git a/drive/app/jav/_dispatch.py b/drive/app/jav/_dispatch.py index 657fb6e7..44a34f49 100644 --- a/drive/app/jav/_dispatch.py +++ b/drive/app/jav/_dispatch.py @@ -33,11 +33,13 @@ def _match_fc2(name: str) -> JavData | None: m = re.search(r"fc2[-_]ppv[-_](\d+)", name, re.I) if not m: return None - name = f"FC2-PPV-{m.group(1)}" + id_ = m.group(1) + name = f"FC2-PPV-{id_}" return JavData( sauce_list=[ - SauceData(sauce="javbee", query=name, name=name), - SauceData(sauce="javtorrent", query=name, name=name), + SauceData(sauce="fc2_acm", query=id_, name=name), + SauceData(sauce="fc2_tor", query=name, name=name), + SauceData(sauce="fc2_bee", query=name, name=name), ], ) diff --git a/drive/app/jav/_sauce.py b/drive/app/jav/_sauce.py index c8921090..a0c5d87a 100644 --- a/drive/app/jav/_sauce.py +++ b/drive/app/jav/_sauce.py @@ -223,6 +223,28 @@ async def _fetch_from_javtorrent( return _normalize_name(title.text) +async def _fetch_from_fc2( + session: ClientSession, jav_id: str, query: str +) -> str | None: + soup = await _get_html( + session, + f"https://adult.contents.fc2.com/article/{query}/", + ) + if not soup: + return None + + title = soup.select_one('head > meta[name="twitter:title"]') + if not title: + return None + meta = title.attrs.get("content") + if not meta: + return None + if not isinstance(meta, str): + return None + name = _normalize_name(meta) + return f"{jav_id} {name}" + + _SAUCE_DICT = { "heydouga": _fetch_from_heydouga, "carib": _fetch_from_carib, @@ -232,8 +254,9 @@ async def _fetch_from_javtorrent( "heyzo": _fetch_from_heyzo, "fanza": _fetch_from_fanza, "mgs": _fetch_from_mgs, - "javbee": _fetch_from_javbee, - "javtorrent": _fetch_from_javtorrent, + "fc2_bee": _fetch_from_javbee, + "fc2_tor": _fetch_from_javtorrent, + "fc2_acm": _fetch_from_fc2, }