You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Jun 30, 2022. It is now read-only.
raiseException("Failed to retrieve JavaScript for this video")
79
+
60
80
def_getJS(self) ->None:
61
-
self._js=self.youtube.js
81
+
# Here we get a JavaScript that links to specific Player JavaScript
82
+
self.url='https://www.youtube.com/iframe_api'
83
+
res=self.syncGetRequest()
84
+
self.extract_js_url(res.text)
62
85
63
86
asyncdefgetJavaScript(self):
64
-
# we don't wanna break compatibility, so we just pass.
65
-
# We retrieve Player JavaScript using _getDecipheredURLs()
66
-
pass
87
+
# Same as in _getJS(), except it's asynchronous
88
+
self.url='https://www.youtube.com/iframe_api'
89
+
res=awaitself.asyncGetRequest()
90
+
self.extract_js_url(res.text)
67
91
68
-
'''
69
-
Not fetching for new player JavaScript if pytube.__js__ is not None or exception is not caused.
70
-
'''
71
92
def_decipher(self, retry: bool=False):
72
-
ifnotpytube.__js__orretry:
73
-
self.youtube._js=None
74
-
self.youtube._js_url=None
75
-
pytube.__js__=None
76
-
pytube.__js_url__=None
93
+
ifnotself._js_urlorretry:
94
+
self._js_url=None
95
+
self._js=None
77
96
self._getJS()
78
97
try:
79
-
'''
80
-
These two are the main methods being used from PyTube.
81
-
Used to decipher the stream URLs using player JavaScript & the player_response passed from the getStream method of this derieved class.
82
-
These methods operate on the value of "player_response" key in dictionary of self._player_response & save _deciphered information in the "url_encoded_fmt_stream_map" key.
83
-
'''
98
+
# We need to decipher one URL at time.
99
+
foryt_formatinself._player_response:
100
+
# If format_id is specified, then it means that we requested only for one URL (ITAG), thus we can skip
101
+
# all other ITAGs, which would take up our precious system resources and our valuable time
0 commit comments