How to use the pytube.mixins.apply_signature function in pytube

To help you get started, we’ve selected a few pytube examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github rols1 / Kodi-Addon-ARDundZDF / resources / lib / pytube / __main__.py View on Github external
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.initialize_caption_objects()
		PLog('init YouTube finished successfully')
github ksharindam / quartz-browser-qt5 / quartz_browser / pytube / __main__.py View on Github external
)['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)

        self.initialize_caption_objects()
        logger.info('init finished successfully')
github nficano / pytube / pytube / __main__.py View on Github external
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.initialize_caption_objects()
        logger.info('init finished successfully')
github ksharindam / quartz-browser-qt5 / quartz_browser / pytube / __main__.py View on Github external
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.initialize_caption_objects()
        logger.info('init finished successfully')