Fix bs4 warning by specifying parser
This commit is contained in:
@@ -35,7 +35,7 @@ class Erome(BaseDownloader):
|
|||||||
@staticmethod
|
@staticmethod
|
||||||
def _get_links(url: str) -> set[str]:
|
def _get_links(url: str) -> set[str]:
|
||||||
page = requests.get(url)
|
page = requests.get(url)
|
||||||
soup = bs4.BeautifulSoup(page.text)
|
soup = bs4.BeautifulSoup(page.text, 'html.parser')
|
||||||
front_images = soup.find_all('img', attrs={'class': 'lasyload'})
|
front_images = soup.find_all('img', attrs={'class': 'lasyload'})
|
||||||
out = [im.get('data-src') for im in front_images]
|
out = [im.get('data-src') for im in front_images]
|
||||||
|
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ class Gallery(BaseDownloader):
|
|||||||
"Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8",
|
"Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8",
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
soup = bs4.BeautifulSoup(page.text)
|
soup = bs4.BeautifulSoup(page.text, 'html.parser')
|
||||||
|
|
||||||
links = soup.findAll('a', attrs={'target': '_blank', 'href': re.compile(r'https://preview\.redd\.it.*')})
|
links = soup.findAll('a', attrs={'target': '_blank', 'href': re.compile(r'https://preview\.redd\.it.*')})
|
||||||
links = [link.get('href') for link in links]
|
links = [link.get('href') for link in links]
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ class Imgur(BaseDownloader):
|
|||||||
if res.status_code != 200:
|
if res.status_code != 200:
|
||||||
raise ResourceNotFound(f'Server responded with {res.status_code} to {link}')
|
raise ResourceNotFound(f'Server responded with {res.status_code} to {link}')
|
||||||
|
|
||||||
soup = bs4.BeautifulSoup(res.text)
|
soup = bs4.BeautifulSoup(res.text, 'html.parser')
|
||||||
scripts = soup.find_all('script', attrs={'type': 'text/javascript'})
|
scripts = soup.find_all('script', attrs={'type': 'text/javascript'})
|
||||||
scripts = [script.string.replace('\n', '') for script in scripts if script.string]
|
scripts = [script.string.replace('\n', '') for script in scripts if script.string]
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user