Check if extension is .htm or .html, instead of if it starts with .htm
This commit is contained in:
parent
1330b8c3cd
commit
ad17d5a4a5
|
@ -365,7 +365,7 @@ async def main():
|
||||||
url = urlunparse(urlparse(url, 'https'))
|
url = urlunparse(urlparse(url, 'https'))
|
||||||
await _download_file(filename, url)
|
await _download_file(filename, url)
|
||||||
ext = await _get_file_ext(filename)
|
ext = await _get_file_ext(filename)
|
||||||
if ext.startswith('.htm'):
|
if ext in ('.htm', '.html'):
|
||||||
with open(filename) as file:
|
with open(filename) as file:
|
||||||
soup = BeautifulSoup(file.read())
|
soup = BeautifulSoup(file.read())
|
||||||
ptitle = soup.find(lambda tag: tag.name == 'meta' and tag.attrs.get('property') == 'og:title' and tag.attrs.get('content')) or soup.find('title')
|
ptitle = soup.find(lambda tag: tag.name == 'meta' and tag.attrs.get('property') == 'og:title' and tag.attrs.get('content')) or soup.find('title')
|
||||||
|
|
Loading…
Reference in New Issue