forked from rDrama/rDrama
1
0
Fork 0

remove unecessary request when making a post linking to a yt video

master
Aevann1 2022-11-19 14:34:03 +02:00 committed by justcool393
parent b5aefda124
commit 0be653e632
1 changed files with 9 additions and 11 deletions

View File

@ -712,8 +712,6 @@ def submit_post(v, sub=None):
yt_id = url.split('https://youtube.com/watch?v=')[1].split('&')[0].split('%')[0]
if yt_id_regex.fullmatch(yt_id):
req = requests.get(f"https://www.googleapis.com/youtube/v3/videos?id={yt_id}&key={YOUTUBE_KEY}&part=contentDetails", timeout=5).json()
if req.get('items'):
params = parse_qs(urlparse(url).query, keep_blank_values=True)
t = params.get('t', params.get('start', [0]))[0]
if isinstance(t, str): t = t.replace('s','')