Skip to content

Commit

Permalink
Fix: 404 in dm5
Browse files Browse the repository at this point in the history
  • Loading branch information
eight04 committed Aug 9, 2024
1 parent 1d87a3a commit 08eb7c9
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions comiccrawler/mods/dm5.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@

from ..core import Episode, grabhtml
from ..util import clean_tags
from ..session_manager import session_manager

cookie = {
"isAdult": "1",
Expand All @@ -24,13 +25,19 @@
domain = ["www.dm5.com", "tel.dm5.com", "hk.dm5.com"]
name = "動漫屋"

def load_config():
s = session_manager.get("https://www.dm5.com/")
s.headers.update({
"Accept-Language": "zh-TW,en-US;q=0.7,en;q=0.3"
})

def get_title(html, url):
return re.search('DM5_COMIC_MNAME="([^"]+)', html).group(1)

def get_episodes(html, url):
s = []

for match in re.finditer('<li>\s*<a href="(/m\d+/)"[^>]*>(.+?)</a>', html, re.DOTALL):
for match in re.finditer(r'<li>\s*<a href="(/m\d+/)"[^>]*>(.+?)</a>', html, re.DOTALL):
# https://github.com/eight04/ComicCrawler/issues/165
ep_url, title = match.groups()
s.append(Episode(
Expand All @@ -53,9 +60,9 @@ def get_images(html, url):
else:
key = ""

count = int(re.search("DM5_IMAGE_COUNT=(\d+);", html).group(1))
cid = re.search("DM5_CID=(\d+);", html).group(1)
mid = re.search("DM5_MID=(\d+);", html).group(1)
count = int(re.search(r"DM5_IMAGE_COUNT=(\d+);", html).group(1))
cid = re.search(r"DM5_CID=(\d+);", html).group(1)
mid = re.search(r"DM5_MID=(\d+);", html).group(1)
dt = re.search('DM5_VIEWSIGN_DT="([^"]+)', html).group(1)
sign = re.search('DM5_VIEWSIGN="([^"]+)', html).group(1)

Expand Down

0 comments on commit 08eb7c9

Please sign in to comment.