Correction of URL building

This commit is contained in:
jeancf 2023-01-03 11:00:41 +01:00
parent 6404296631
commit 97f6187e40

View File

@ -30,7 +30,7 @@ import sqlite3
import sys import sys
import time import time
from pathlib import Path from pathlib import Path
from urllib.parse import urlparse, parse_qsl, urlencode, urlunparse from urllib.parse import urlparse, parse_qsl, urlencode, urlunparse, urljoin
import requests import requests
from bs4 import BeautifulSoup, element from bs4 import BeautifulSoup, element
@ -424,7 +424,8 @@ def process_attachments(nitter_url, attachments_container, status_id, author_acc
if TOML['options']['upload_videos']: if TOML['options']['upload_videos']:
import youtube_dl import youtube_dl
video_file = os.path.join('https://twitter.com', author_account, 'status', status_id) video_path = f"{author_account}/status/{status_id}"
video_file = urljoin('https://twitter.com', video_path)
ydl_opts = { ydl_opts = {
'outtmpl': "output/" + TOML['config']['twitter_account'] + "/" + status_id + "/%(id)s.%(ext)s", 'outtmpl': "output/" + TOML['config']['twitter_account'] + "/" + status_id + "/%(id)s.%(ext)s",
'format': "best[width<=500]", 'format': "best[width<=500]",