Skip to content

Commit 1c9c0f3

Browse files
committed
[youtube] fix extraction (close #3031)
1 parent c4042d0 commit 1c9c0f3

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

src/you_get/extractors/youtube.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,14 @@ def n_to_n(js, n):
8282
# Xka - https://www.youtube.com/s/player/dc0c6770/player_ias.vflset/sv_SE/base.js
8383
# jma - https://www.youtube.com/s/player/8d9f6215/player_ias.vflset/sv_SE/base.js
8484
f1 = match1(js, r',[$\w]+\.length\|\|([$\w]+)\(""\)\)}};')
85+
86+
# Examples:
87+
# Yla, ida - https://www.youtube.com/s/player/fb725ac8/player-plasma-ias-phone-sv_SE.vflset/base.js
88+
# Hla, eda - https://www.youtube.com/s/player/2f238d39/player-plasma-ias-phone-en_US.vflset/base.js
89+
if not f1:
90+
f0 = match1(js, r'c=([$\w]+)\[0\]\(c\),a\.set\(b,c\)')
91+
f1 = match1(js, r'%s=\[([$\w]+)\]' % f0)
92+
8593
f1def = match1(js, r'\W%s=(function\(\w+\).+?\)});' % re.escape(f1))
8694
n = dukpy.evaljs('(%s)("%s")' % (f1def, n))
8795
return n
@@ -186,7 +194,7 @@ def check_playability_response(self, ytInitialPlayerResponse):
186194
)
187195

188196
def prepare(self, **kwargs):
189-
self.ua = 'Mozilla/5.0 (Linux; Android 14) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/127.0.6533.103 Mobile Safari/537.36'
197+
self.ua = 'Mozilla/5.0 (Linux; Android 15) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/130.0.6723.73 Mobile Safari/537.36'
190198

191199
assert self.url or self.vid
192200

0 commit comments

Comments
 (0)