Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
title = self.watch_html[i_start:i_end].strip()
index = title.lower().rfind(' - youtube')
title = title[:index] if index > 0 else title
self.player_config_args['title'] = title
self.vid_descr = extract.get_vid_descr(self.watch_html)
# https://github.com/nficano/pytube/issues/165
stream_maps = ['url_encoded_fmt_stream_map']
if 'adaptive_fmts' in self.player_config_args:
stream_maps.append('adaptive_fmts')
# unscramble the progressive and adaptive stream manifests.
for fmt in stream_maps:
if not self.age_restricted and fmt in self.vid_info:
mixins.apply_descrambler(self.vid_info, fmt)
mixins.apply_descrambler(self.player_config_args, fmt)
try:
mixins.apply_signature(self.player_config_args, fmt, self.js)
except TypeError:
self.js_url = extract.js_url(
self.embed_html, self.age_restricted,
)
self.js = request.get(self.js_url)
mixins.apply_signature(self.player_config_args, fmt, self.js)
# build instances of :class:`Stream `
self.initialize_stream_objects(fmt)
# load the player_response object (contains subtitle information)
apply_mixin(self.player_config_args, 'player_response', json.loads)
i_end = self.watch_html.lower().index('')
title = self.watch_html[i_start:i_end].strip()
index = title.lower().rfind(' - youtube')
title = title[:index] if index > 0 else title
self.player_config_args['title'] = title
self.vid_descr = extract.get_vid_descr(self.watch_html)
# https://github.com/nficano/pytube/issues/165
stream_maps = ['url_encoded_fmt_stream_map']
if 'adaptive_fmts' in self.player_config_args:
stream_maps.append('adaptive_fmts')
# unscramble the progressive and adaptive stream manifests.
for fmt in stream_maps:
if not self.age_restricted and fmt in self.vid_info:
mixins.apply_descrambler(self.vid_info, fmt)
mixins.apply_descrambler(self.player_config_args, fmt)
try:
mixins.apply_signature(self.player_config_args, fmt, self.js)
except TypeError:
self.js_url = extract.js_url(
self.embed_html, self.age_restricted,
)
self.js = request.get(self.js_url)
mixins.apply_signature(self.player_config_args, fmt, self.js)
# build instances of :class:`Stream `
self.initialize_stream_objects(fmt)
# load the player_response object (contains subtitle information)
apply_mixin(self.player_config_args, 'player_response', json.loads)
self.player_config_args = self.vid_info
else:
self.player_config_args = extract.get_ytplayer_config(
self.watch_html,
)['args']
self.vid_descr = extract.get_vid_descr(self.watch_html)
# https://github.com/nficano/pytube/issues/165
stream_maps = ['url_encoded_fmt_stream_map']
if 'adaptive_fmts' in self.player_config_args:
stream_maps.append('adaptive_fmts')
# unscramble the progressive and adaptive stream manifests.
for fmt in stream_maps:
if not self.age_restricted and fmt in self.vid_info:
mixins.apply_descrambler(self.vid_info, fmt)
mixins.apply_descrambler(self.player_config_args, fmt)
try:
mixins.apply_signature(self.player_config_args, fmt, self.js)
except TypeError:
self.js_url = extract.js_url(
self.embed_html, self.age_restricted,
)
self.js = request.get(self.js_url)
mixins.apply_signature(self.player_config_args, fmt, self.js)
# build instances of :class:`Stream `
self.initialize_stream_objects(fmt)
# load the player_response object (contains subtitle information)
apply_mixin(self.player_config_args, 'player_response', json.loads)
i_end = self.watch_html.lower().index('')
title = self.watch_html[i_start:i_end].strip()
index = title.lower().rfind(' - youtube')
title = title[:index] if index > 0 else title
self.player_config_args['title'] = title
self.vid_descr = extract.get_vid_descr(self.watch_html)
# https://github.com/nficano/pytube/issues/165
stream_maps = ['url_encoded_fmt_stream_map']
if 'adaptive_fmts' in self.player_config_args:
stream_maps.append('adaptive_fmts')
# unscramble the progressive and adaptive stream manifests.
for fmt in stream_maps:
if not self.age_restricted and fmt in self.vid_info:
mixins.apply_descrambler(self.vid_info, fmt)
mixins.apply_descrambler(self.player_config_args, fmt)
try:
mixins.apply_signature(self.player_config_args, fmt, self.js)
except TypeError:
self.js_url = extract.js_url(
self.embed_html, self.age_restricted,
)
self.js = request.get(self.js_url)
mixins.apply_signature(self.player_config_args, fmt, self.js)
# build instances of :class:`Stream `
self.initialize_stream_objects(fmt)
# load the player_response object (contains subtitle information)
apply_mixin(self.player_config_args, 'player_response', json.loads)
title = self.watch_html[i_start:i_end].strip()
index = title.lower().rfind(' - youtube')
title = title[:index] if index > 0 else title
self.player_config_args['title'] = title
self.vid_descr = extract.get_vid_descr(self.watch_html)
# https://github.com/nficano/pytube/issues/165
stream_maps = ['url_encoded_fmt_stream_map']
if 'adaptive_fmts' in self.player_config_args:
stream_maps.append('adaptive_fmts')
# unscramble the progressive and adaptive stream manifests.
for fmt in stream_maps:
if not self.age_restricted and fmt in self.vid_info:
mixins.apply_descrambler(self.vid_info, fmt)
mixins.apply_descrambler(self.player_config_args, fmt)
try:
mixins.apply_signature(self.player_config_args, fmt, self.js)
except TypeError:
self.js_url = extract.js_url(
self.embed_html, self.age_restricted,
)
self.js = request.get(self.js_url)
mixins.apply_signature(self.player_config_args, fmt, self.js)
# build instances of :class:`Stream `
self.initialize_stream_objects(fmt)
# load the player_response object (contains subtitle information)
apply_mixin(self.player_config_args, 'player_response', json.loads)
else:
self.player_config_args = extract.get_ytplayer_config(
self.watch_html,
)['args']
self.vid_descr = extract.get_vid_descr(self.watch_html)
# https://github.com/nficano/pytube/issues/165
stream_maps = ['url_encoded_fmt_stream_map']
if 'adaptive_fmts' in self.player_config_args:
stream_maps.append('adaptive_fmts')
# unscramble the progressive and adaptive stream manifests.
for fmt in stream_maps:
if not self.age_restricted and fmt in self.vid_info:
mixins.apply_descrambler(self.vid_info, fmt)
mixins.apply_descrambler(self.player_config_args, fmt)
try:
mixins.apply_signature(self.player_config_args, fmt, self.js)
except TypeError:
self.js_url = extract.js_url(
self.embed_html, self.age_restricted,
)
self.js = request.get(self.js_url)
mixins.apply_signature(self.player_config_args, fmt, self.js)
# build instances of :class:`Stream `
self.initialize_stream_objects(fmt)
# load the player_response object (contains subtitle information)
apply_mixin(self.player_config_args, 'player_response', json.loads)