-
Notifications
You must be signed in to change notification settings - Fork 48
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
45 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
#! python3 | ||
|
||
""" | ||
https://jpg4.su/a/{id}/?sort=date_desc&page=1 | ||
""" | ||
|
||
import re | ||
|
||
from html import unescape | ||
|
||
from ..episode import Episode | ||
from ..session_manager import session_manager | ||
|
||
domain = ["jpg4.su"] | ||
name = "jpg4" | ||
noepfolder = True | ||
|
||
s = session_manager.get("https://jpg4.su/") | ||
s.timeout = (22, 180) | ||
|
||
def get_title(html, url): | ||
title = re.search(r'og:title" content="([^"]+)', html).group(1) | ||
return "[jpg4] {}".format(unescape(title).strip()) | ||
|
||
def get_episodes(html, url): | ||
# FIXME: multiple pages? | ||
result = [] | ||
for match in re.finditer(r'<a href="(https://jpg4\.su/img/[^"]+)"[^>]*>\s*<img src="([^"]*)" alt="([^"]*)', html): | ||
ep_url, thumb, title = match.groups() | ||
title = re.sub(r"\.\w+$", "", title) | ||
image = thumb.replace(".md.", ".") | ||
result.append(Episode(title, ep_url, image=image)) | ||
|
||
return result[::-1] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters