Browse Source

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

master
blank X 1 year ago
parent
commit
ad17d5a4a5
Signed by: blankie
GPG Key ID: CC15FC822C7F61F5
  1. 2
      redditbot.py

2
redditbot.py

@ -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')

Loading…
Cancel
Save