1
0
mirror of https://github.com/yt-dlp/yt-dlp.git synced 2024-10-04 16:37:09 +02:00

[underline] Add extractor

This commit is contained in:
NightMachinery 2022-12-06 07:00:41 +03:30
parent ebab01bb73
commit 2cb546cf8e
No known key found for this signature in database
GPG Key ID: C567089D40CA8367

View File

@ -27,7 +27,7 @@ class UnderlineIE(InfoExtractor):
_TESTS = [
{
"params": {
"skip_download": True,
"skip_download": True, # needs cookies
},
"url": "https://underline.io/events/342/posters/12863/poster/66463-mbti-personality-prediction-approach-on-persian-twitter?tab=video",
"md5": "md5:eaa894161adaef6efd6008681e1cd2c5",
@ -36,22 +36,11 @@ class UnderlineIE(InfoExtractor):
"id": "342/posters/12863/poster/66463-mbti-personality-prediction-approach-on-persian-twitter",
"ext": "mp4",
"title": "MBTI Personality Prediction Approach on Persian Twitter",
# * A value
# * MD5 checksum; start the string with md5:
# * A regular expression; start the string with re:
# * Any Python type, e.g. int or float
},
}
]
def _real_extract(self, url):
# cookies = self._get_cookies(url)
# if DEBUG_P:
# ic(cookies)
# if not cookies:
# self.raise_login_required('Cookies are needed to download from this website', method='cookies')
video_id = self._match_id(url)
webpage = self._download_webpage(url, video_id)
@ -64,13 +53,9 @@ def _real_extract(self, url):
)
if DEBUG_P:
# ic(webpage_info)
with open("./tmp.json", "w") as f:
json.dump(webpage_info, f)
# ic(webpage_info["props"]["pageProps"]["snapshot"]["models"][10]["title"])
# embed()
title = list(gen_dict_extract(webpage_info, "title"))
if DEBUG_P:
ic(title)
@ -93,8 +78,11 @@ def _real_extract(self, url):
m3u8_url = url
if m3u8_url:
formats.extend(self._extract_m3u8_formats(
m3u8_url, video_id, ext='mp4', entry_protocol='m3u8_native'))
formats.extend(
self._extract_m3u8_formats(
m3u8_url, video_id, ext="mp4", entry_protocol="m3u8_native"
)
)
return {
"id": video_id,