url works for me Larz60+.
You are doing unnecessary stuff Reldaing.
in
Img(soup)
function it could just be
image = soup.find('img', class_="img-responsive scan-page")
Here go directly to the to the img tag and take out url from
src
attribute.
Example.
import requests
from bs4 import BeautifulSoup
url = 'https://www.lelscan-vf.com/manga/vinland-saga/164'
response = requests.get(url)
soup = BeautifulSoup(response.content, 'lxml')
image = soup.find('img', class_="img-responsive scan-page")
image_url = image.get('src').strip()
print(image_url)
Output:
https://lelscan-vf.com/uploads/manga/vinland-saga/chapters/164/01.png
The
next_chapter
here can just use url and increment bye one.
import requests
from bs4 import BeautifulSoup
def manga(start_img, stop_img):
for page in range(start_img, stop_img):
url = f'https://www.lelscan-vf.com/manga/vinland-saga/{page}'
response = requests.get(url)
soup = BeautifulSoup(response.content, 'lxml')
image = soup.find('img', class_="img-responsive scan-page")
image_url = image.get('src').strip()
print(image_url)
if __name__ == '__main__':
start_img = 164
stop_img = 169
manga(start_img, stop_img)
Output:
https://lelscan-vf.com/uploads/manga/vinland-saga/chapters/164/01.png
https://lelscan-vf.com/uploads/manga/vinland-saga/chapters/165/01.png
https://lelscan-vf.com/uploads/manga/vinland-saga/chapters/166/01.png
https://lelscan-vf.com/uploads/manga/vinland-saga/chapters/167/01.png
https://lelscan-vf.com/uploads/manga/vinland-saga/chapters/168/01.png
So maybe your or task is to downloads these images,try that or if just want url then this should do it.