Check if extension is .htm or .html, instead of if it starts with .htm

This commit is contained in:
blank X 2021-04-29 16:33:29 +07:00
parent 1330b8c3cd
commit ad17d5a4a5
Signed by: blankie
GPG Key ID: CC15FC822C7F61F5
1 changed files with 1 additions and 1 deletions

View File

@ -365,7 +365,7 @@ async def main():
url = urlunparse(urlparse(url, 'https'))
await _download_file(filename, url)
ext = await _get_file_ext(filename)
if ext.startswith('.htm'):
if ext in ('.htm', '.html'):
with open(filename) as file:
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')