mirror of
https://github.com/DYefremov/DemonEditor.git
synced 2026-07-07 09:42:21 +02:00
revert default formats for youtube
This commit is contained in:
@@ -13,7 +13,8 @@ _YT_LIST_PATTERN = re.compile(r"https://www.youtube.com/.+?(?:list=)([\w-]{23,})
|
||||
_YT_VIDEO_PATTERN = re.compile(r"https://r\d+---sn-[\w]{10}-[\w]{3,5}.googlevideo.com/videoplayback?.*")
|
||||
_HEADERS = {"User-Agent": "Mozilla/5.0"}
|
||||
|
||||
Quality = {137: "1080p", 136: "720p", 135: "480p", 134: "360p", 133: "240p", 160: "144p", 0: "0p"}
|
||||
Quality = {137: "1080p", 136: "720p", 135: "480p", 134: "360p",
|
||||
133: "240p", 160: "144p", 0: "0p", 18: "360p", 22: "720p"}
|
||||
|
||||
|
||||
class YouTube:
|
||||
@@ -58,7 +59,7 @@ class YouTube:
|
||||
det = resp.get("videoDetails", None)
|
||||
title = det.get("title", None) if det else None
|
||||
streaming_data = resp.get("streamingData", None)
|
||||
fmts = streaming_data.get("adaptiveFormats", None) if streaming_data else None
|
||||
fmts = streaming_data.get("formats", None) if streaming_data else None
|
||||
|
||||
if fmts:
|
||||
urls = {Quality[i["itag"]]: i["url"] for i in
|
||||
|
||||
@@ -1271,24 +1271,12 @@ Author: Dmitriy Yefremov
|
||||
<row>
|
||||
<col id="0" translatable="yes">Auto</col>
|
||||
</row>
|
||||
<row>
|
||||
<col id="0">1080p</col>
|
||||
</row>
|
||||
<row>
|
||||
<col id="0">720p</col>
|
||||
</row>
|
||||
<row>
|
||||
<col id="0">480p</col>
|
||||
</row>
|
||||
<row>
|
||||
<col id="0">360p</col>
|
||||
</row>
|
||||
<row>
|
||||
<col id="0">240p</col>
|
||||
</row>
|
||||
<row>
|
||||
<col id="0">144p</col>
|
||||
</row>
|
||||
</data>
|
||||
</object>
|
||||
<object class="GtkWindow" id="yt_import_dialog_window">
|
||||
|
||||
@@ -688,6 +688,8 @@ class YtListImportDialog:
|
||||
act = self._quality_model.get_value(self._quality_box.get_active_iter(), 0)
|
||||
for link in links:
|
||||
lnk, title = link
|
||||
if not lnk:
|
||||
continue
|
||||
ln = lnk.get(act) if act in lnk else lnk[sorted(lnk, key=lambda x: int(x.rstrip("p")), reverse=True)[0]]
|
||||
fav_id = get_fav_id(ln, title, self._profile)
|
||||
srv = Service(None, None, IPTV_ICON, title, *aggr[0:3], BqServiceType.IPTV.name, *aggr, None, fav_id, None)
|
||||
|
||||
Reference in New Issue
Block a user