Skip to content

Commit

Permalink
feat: fc2
Browse files Browse the repository at this point in the history
  • Loading branch information
legnaleurc committed Aug 5, 2024
1 parent 5be6959 commit 25a39a4
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 5 deletions.
8 changes: 5 additions & 3 deletions drive/app/jav/_dispatch.py
Original file line number Diff line number Diff line change
Expand Up @@ -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),
],
)

Expand Down
27 changes: 25 additions & 2 deletions drive/app/jav/_sauce.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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,
}


Expand Down

0 comments on commit 25a39a4

Please sign in to comment.