mirror of
https://git.vectorsigma.ru/public/tubearchivist.git
synced 2026-08-09 00:10:04 +00:00
add is_short standalone helper function
This commit is contained in:
@@ -13,6 +13,7 @@ import unicodedata
|
|||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
from urllib.parse import parse_qs, urlparse
|
from urllib.parse import parse_qs, urlparse
|
||||||
|
|
||||||
|
import requests
|
||||||
from home.src.download.yt_dlp_base import YtWrap
|
from home.src.download.yt_dlp_base import YtWrap
|
||||||
|
|
||||||
|
|
||||||
@@ -136,6 +137,16 @@ def get_mapping():
|
|||||||
return index_config
|
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:
|
class UrlListParser:
|
||||||
"""take a multi line string and detect valid youtube ids"""
|
"""take a multi line string and detect valid youtube ids"""
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user