From 97f6187e402191ebae859afa43df7ecd1fe06474 Mon Sep 17 00:00:00 2001 From: jeancf Date: Tue, 3 Jan 2023 11:00:41 +0100 Subject: [PATCH] Correction of URL building --- twoot.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/twoot.py b/twoot.py index 5c250c5..b85c495 100755 --- a/twoot.py +++ b/twoot.py @@ -30,7 +30,7 @@ import sqlite3 import sys import time 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 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']: 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 = { 'outtmpl': "output/" + TOML['config']['twitter_account'] + "/" + status_id + "/%(id)s.%(ext)s", 'format': "best[width<=500]",