mirror of
https://github.com/tubearchivist/tubearchivist
synced 2024-11-17 21:25:49 +00:00
add is_short standalone helper function
This commit is contained in:
parent
14d5a7ee1a
commit
ce4288ff66
@ -13,6 +13,7 @@ import unicodedata
|
||||
from datetime import datetime
|
||||
from urllib.parse import parse_qs, urlparse
|
||||
|
||||
import requests
|
||||
from home.src.download.yt_dlp_base import YtWrap
|
||||
|
||||
|
||||
@ -136,6 +137,16 @@ def get_mapping():
|
||||
return index_config
|
||||
|
||||
|
||||
def is_short(youtube_id):
|
||||
"""check if youtube_id is a shorts video, bot not it it's not a shorts"""
|
||||
shorts_url = f"https://www.youtube.com/shorts/{youtube_id}"
|
||||
response = requests.head(
|
||||
shorts_url, headers=requests_headers(), timeout=10
|
||||
)
|
||||
|
||||
return response.status_code == 200
|
||||
|
||||
|
||||
class UrlListParser:
|
||||
"""take a multi line string and detect valid youtube ids"""
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user