Fix some weird URLs

This commit is contained in:
blank X 2020-09-05 02:18:25 +07:00
parent 966e5ec799
commit a1216f1273
1 changed files with 3 additions and 0 deletions

View File

@ -252,6 +252,7 @@ async def main():
url = preview[i]['source']['url'] url = preview[i]['source']['url']
break break
if url: if url:
url = urlunparse(urlparse(url, 'https'))
await _download_file(filename, url) await _download_file(filename, url)
mimetype = await _get_file_mimetype(filename) mimetype = await _get_file_mimetype(filename)
if mimetype.startswith('image') and preview and preview['enabled']: if mimetype.startswith('image') and preview and preview['enabled']:
@ -262,6 +263,7 @@ async def main():
for url in urls: for url in urls:
if os.path.getsize(filename) < 10000000: if os.path.getsize(filename) < 10000000:
break break
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.startswith('.htm'):
@ -283,6 +285,7 @@ async def main():
tat += url tat += url
files = [] files = []
if pimg: if pimg:
pimg = urlunparse(urlparse(pimg, 'https'))
await _download_file(filename, pimg) await _download_file(filename, pimg)
files.append(filename) files.append(filename)
else: else: