forked from rDrama/rDrama
remove unecessary request when making a post linking to a yt video
parent
b5aefda124
commit
0be653e632
|
@ -712,8 +712,6 @@ def submit_post(v, sub=None):
|
||||||
yt_id = url.split('https://youtube.com/watch?v=')[1].split('&')[0].split('%')[0]
|
yt_id = url.split('https://youtube.com/watch?v=')[1].split('&')[0].split('%')[0]
|
||||||
|
|
||||||
if yt_id_regex.fullmatch(yt_id):
|
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)
|
params = parse_qs(urlparse(url).query, keep_blank_values=True)
|
||||||
t = params.get('t', params.get('start', [0]))[0]
|
t = params.get('t', params.get('start', [0]))[0]
|
||||||
if isinstance(t, str): t = t.replace('s','')
|
if isinstance(t, str): t = t.replace('s','')
|
||||||
|
|
Loading…
Reference in New Issue