Skip to content

Commit

Permalink
fix(Some Madra Sites Use src Instead of data-src): 🐛
Browse files Browse the repository at this point in the history
  • Loading branch information
thezak48 committed Nov 23, 2023
1 parent a1284eb commit 127e547
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 8 deletions.
10 changes: 6 additions & 4 deletions manga_dl/utilities/sites/madraNew.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,12 +91,14 @@ def get_chapter_images(self, chapter_url):

if result.status_code == 200:
soup = BeautifulSoup(result.text, "html.parser")
nodes = soup.find_all("div", {"class": "reading-content"})
nodes = soup.find("div", {"class": "reading-content"})
images = []

for node in nodes:
url = node.img["data-src"]
images.append(url)
for img in nodes.find_all("img"):
if "data-src" in img.attrs:
images.append(img["data-src"].strip())
elif "src" in img.attrs:
images.append(img["src"].strip())

return images

Expand Down
11 changes: 7 additions & 4 deletions manga_dl/utilities/sites/madraOld.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,11 +114,14 @@ def get_chapter_images(self, chapter_url):

if result.status_code == 200:
soup = BeautifulSoup(result.text, "html.parser")
node = soup.find("div", {"class": "reading-content"})
image_nodes = node.find_all("img")
nodes = soup.find("div", {"class": "reading-content"})
images = []
for image_node in image_nodes:
images.append(image_node["data-src"].lstrip().rstrip())

for img in nodes.find_all("img"):
if "data-src" in img.attrs:
images.append(img["data-src"].strip())
elif "src" in img.attrs:
images.append(img["src"].strip())

return images

Expand Down

0 comments on commit 127e547

Please sign in to comment.