code
stringlengths
66
870k
docstring
stringlengths
19
26.7k
func_name
stringlengths
1
138
language
stringclasses
1 value
repo
stringlengths
7
68
path
stringlengths
5
324
url
stringlengths
46
389
license
stringclasses
7 values
def throttling_swap(d: list, e: int): """Swap positions of the 0'th and e'th elements in-place.""" e = throttling_mod_func(d, e) f = d[0] d[0] = d[e] d[e] = f
Swap positions of the 0'th and e'th elements in-place.
throttling_swap
python
pytube/pytube
pytube/cipher.py
https://github.com/pytube/pytube/blob/master/pytube/cipher.py
Unlicense
def map_functions(js_func: str) -> Callable: """For a given JavaScript transform function, return the Python equivalent. :param str js_func: The JavaScript version of the transform function. """ mapper = ( # function(a){a.reverse()} (r"{\w\.reverse\(\)}", reverse), # fun...
For a given JavaScript transform function, return the Python equivalent. :param str js_func: The JavaScript version of the transform function.
map_functions
python
pytube/pytube
pytube/cipher.py
https://github.com/pytube/pytube/blob/master/pytube/cipher.py
Unlicense
def main(): """Command line application to download youtube videos.""" # noinspection PyTypeChecker parser = argparse.ArgumentParser(description=main.__doc__) args = _parse_args(parser) if args.verbose: log_filename = None if args.logfile: log_filename = args.logfile ...
Command line application to download youtube videos.
main
python
pytube/pytube
pytube/cli.py
https://github.com/pytube/pytube/blob/master/pytube/cli.py
Unlicense
def build_playback_report(youtube: YouTube) -> None: """Serialize the request data to json for offline debugging. :param YouTube youtube: A YouTube object. """ ts = int(dt.datetime.utcnow().timestamp()) fp = os.path.join(os.getcwd(), f"yt-video-{youtube.video_id}-{ts}.json.gz") js = yo...
Serialize the request data to json for offline debugging. :param YouTube youtube: A YouTube object.
build_playback_report
python
pytube/pytube
pytube/cli.py
https://github.com/pytube/pytube/blob/master/pytube/cli.py
Unlicense
def _unique_name(base: str, subtype: str, media_type: str, target: str) -> str: """ Given a base name, the file format, and the target directory, will generate a filename unique for that directory and file format. :param str base: The given base-name. :param str subtype: The filetype...
Given a base name, the file format, and the target directory, will generate a filename unique for that directory and file format. :param str base: The given base-name. :param str subtype: The filetype of the video which will be downloaded. :param str media_type: The media_ty...
_unique_name
python
pytube/pytube
pytube/cli.py
https://github.com/pytube/pytube/blob/master/pytube/cli.py
Unlicense
def ffmpeg_process( youtube: YouTube, resolution: str, target: Optional[str] = None ) -> None: """ Decides the correct video stream to download, then calls _ffmpeg_downloader. :param YouTube youtube: A valid YouTube object. :param str resolution: YouTube video resolution. :param...
Decides the correct video stream to download, then calls _ffmpeg_downloader. :param YouTube youtube: A valid YouTube object. :param str resolution: YouTube video resolution. :param str target: Target directory for download
ffmpeg_process
python
pytube/pytube
pytube/cli.py
https://github.com/pytube/pytube/blob/master/pytube/cli.py
Unlicense
def _ffmpeg_downloader( audio_stream: Stream, video_stream: Stream, target: str ) -> None: """ Given a YouTube Stream object, finds the correct audio stream, downloads them both giving them a unique name, them uses ffmpeg to create a new file with the audio and video from the previously downloaded f...
Given a YouTube Stream object, finds the correct audio stream, downloads them both giving them a unique name, them uses ffmpeg to create a new file with the audio and video from the previously downloaded files. Then deletes the original adaptive streams, leaving the combination. :param Stream audi...
_ffmpeg_downloader
python
pytube/pytube
pytube/cli.py
https://github.com/pytube/pytube/blob/master/pytube/cli.py
Unlicense
def download_by_itag( youtube: YouTube, itag: int, target: Optional[str] = None ) -> None: """Start downloading a YouTube video. :param YouTube youtube: A valid YouTube object. :param int itag: YouTube format identifier code. :param str target: Target directory for download ...
Start downloading a YouTube video. :param YouTube youtube: A valid YouTube object. :param int itag: YouTube format identifier code. :param str target: Target directory for download
download_by_itag
python
pytube/pytube
pytube/cli.py
https://github.com/pytube/pytube/blob/master/pytube/cli.py
Unlicense
def download_by_resolution( youtube: YouTube, resolution: str, target: Optional[str] = None ) -> None: """Start downloading a YouTube video. :param YouTube youtube: A valid YouTube object. :param str resolution: YouTube video resolution. :param str target: Target directory f...
Start downloading a YouTube video. :param YouTube youtube: A valid YouTube object. :param str resolution: YouTube video resolution. :param str target: Target directory for download
download_by_resolution
python
pytube/pytube
pytube/cli.py
https://github.com/pytube/pytube/blob/master/pytube/cli.py
Unlicense
def download_highest_resolution_progressive( youtube: YouTube, resolution: str, target: Optional[str] = None ) -> None: """Start downloading the highest resolution progressive stream. :param YouTube youtube: A valid YouTube object. :param str resolution: YouTube video resolution. :p...
Start downloading the highest resolution progressive stream. :param YouTube youtube: A valid YouTube object. :param str resolution: YouTube video resolution. :param str target: Target directory for download
download_highest_resolution_progressive
python
pytube/pytube
pytube/cli.py
https://github.com/pytube/pytube/blob/master/pytube/cli.py
Unlicense
def download_caption( youtube: YouTube, lang_code: Optional[str], target: Optional[str] = None ) -> None: """Download a caption for the YouTube video. :param YouTube youtube: A valid YouTube object. :param str lang_code: Language code desired for caption file. Prints available c...
Download a caption for the YouTube video. :param YouTube youtube: A valid YouTube object. :param str lang_code: Language code desired for caption file. Prints available codes if the value is None or the desired code is not available. :param str target: Target directo...
download_caption
python
pytube/pytube
pytube/cli.py
https://github.com/pytube/pytube/blob/master/pytube/cli.py
Unlicense
def download_audio( youtube: YouTube, filetype: str, target: Optional[str] = None ) -> None: """ Given a filetype, downloads the highest quality available audio stream for a YouTube video. :param YouTube youtube: A valid YouTube object. :param str filetype: Desired file format t...
Given a filetype, downloads the highest quality available audio stream for a YouTube video. :param YouTube youtube: A valid YouTube object. :param str filetype: Desired file format to download. :param str target: Target directory for download
download_audio
python
pytube/pytube
pytube/cli.py
https://github.com/pytube/pytube/blob/master/pytube/cli.py
Unlicense
def __init__(self, caller: str, pattern: Union[str, Pattern]): """ :param str caller: Calling function :param str pattern: Pattern that failed to match """ super().__init__(f"{caller}: could not find match for {pattern}") self.caller = caller ...
:param str caller: Calling function :param str pattern: Pattern that failed to match
__init__
python
pytube/pytube
pytube/exceptions.py
https://github.com/pytube/pytube/blob/master/pytube/exceptions.py
Unlicense
def publish_date(watch_html: str): """Extract publish date :param str watch_html: The html contents of the watch page. :rtype: str :returns: Publish date of the video. """ try: result = regex_search( r"(?<=itemprop=\"datePublished\" content=\")\d{4}-\d{2}-\d{2...
Extract publish date :param str watch_html: The html contents of the watch page. :rtype: str :returns: Publish date of the video.
publish_date
python
pytube/pytube
pytube/extract.py
https://github.com/pytube/pytube/blob/master/pytube/extract.py
Unlicense
def recording_available(watch_html): """Check if live stream recording is available. :param str watch_html: The html contents of the watch page. :rtype: bool :returns: Whether or not the content is private. """ unavailable_strings = [ 'This live stream recording is not a...
Check if live stream recording is available. :param str watch_html: The html contents of the watch page. :rtype: bool :returns: Whether or not the content is private.
recording_available
python
pytube/pytube
pytube/extract.py
https://github.com/pytube/pytube/blob/master/pytube/extract.py
Unlicense
def is_private(watch_html): """Check if content is private. :param str watch_html: The html contents of the watch page. :rtype: bool :returns: Whether or not the content is private. """ private_strings = [ "This is a private video. Please sign in to verify that you may s...
Check if content is private. :param str watch_html: The html contents of the watch page. :rtype: bool :returns: Whether or not the content is private.
is_private
python
pytube/pytube
pytube/extract.py
https://github.com/pytube/pytube/blob/master/pytube/extract.py
Unlicense
def is_age_restricted(watch_html: str) -> bool: """Check if content is age restricted. :param str watch_html: The html contents of the watch page. :rtype: bool :returns: Whether or not the content is age restricted. """ try: regex_search(r"og:restrictions:age", watch_htm...
Check if content is age restricted. :param str watch_html: The html contents of the watch page. :rtype: bool :returns: Whether or not the content is age restricted.
is_age_restricted
python
pytube/pytube
pytube/extract.py
https://github.com/pytube/pytube/blob/master/pytube/extract.py
Unlicense
def playability_status(watch_html: str) -> (str, str): """Return the playability status and status explanation of a video. For example, a video may have a status of LOGIN_REQUIRED, and an explanation of "This is a private video. Please sign in to verify that you may see it." This explanation is what g...
Return the playability status and status explanation of a video. For example, a video may have a status of LOGIN_REQUIRED, and an explanation of "This is a private video. Please sign in to verify that you may see it." This explanation is what gets incorporated into the media player overlay. :param st...
playability_status
python
pytube/pytube
pytube/extract.py
https://github.com/pytube/pytube/blob/master/pytube/extract.py
Unlicense
def channel_name(url: str) -> str: """Extract the ``channel_name`` or ``channel_id`` from a YouTube url. This function supports the following patterns: - :samp:`https://youtube.com/c/{channel_name}/*` - :samp:`https://youtube.com/channel/{channel_id}/* - :samp:`https://youtube.com/u/{channel_name}...
Extract the ``channel_name`` or ``channel_id`` from a YouTube url. This function supports the following patterns: - :samp:`https://youtube.com/c/{channel_name}/*` - :samp:`https://youtube.com/channel/{channel_id}/* - :samp:`https://youtube.com/u/{channel_name}/*` - :samp:`https://youtube.com/user/...
channel_name
python
pytube/pytube
pytube/extract.py
https://github.com/pytube/pytube/blob/master/pytube/extract.py
Unlicense
def video_info_url(video_id: str, watch_url: str) -> str: """Construct the video_info url. :param str video_id: A YouTube video identifier. :param str watch_url: A YouTube watch url. :rtype: str :returns: :samp:`https://youtube.com/get_video_info` with necessary GET ...
Construct the video_info url. :param str video_id: A YouTube video identifier. :param str watch_url: A YouTube watch url. :rtype: str :returns: :samp:`https://youtube.com/get_video_info` with necessary GET parameters.
video_info_url
python
pytube/pytube
pytube/extract.py
https://github.com/pytube/pytube/blob/master/pytube/extract.py
Unlicense
def video_info_url_age_restricted(video_id: str, embed_html: str) -> str: """Construct the video_info url. :param str video_id: A YouTube video identifier. :param str embed_html: The html contents of the embed page (for age restricted videos). :rtype: str :returns: :samp:`ht...
Construct the video_info url. :param str video_id: A YouTube video identifier. :param str embed_html: The html contents of the embed page (for age restricted videos). :rtype: str :returns: :samp:`https://youtube.com/get_video_info` with necessary GET parameters.
video_info_url_age_restricted
python
pytube/pytube
pytube/extract.py
https://github.com/pytube/pytube/blob/master/pytube/extract.py
Unlicense
def js_url(html: str) -> str: """Get the base JavaScript url. Construct the base JavaScript url, which contains the decipher "transforms". :param str html: The html contents of the watch page. """ try: base_js = get_ytplayer_config(html)['assets']['js'] except (KeyError, Re...
Get the base JavaScript url. Construct the base JavaScript url, which contains the decipher "transforms". :param str html: The html contents of the watch page.
js_url
python
pytube/pytube
pytube/extract.py
https://github.com/pytube/pytube/blob/master/pytube/extract.py
Unlicense
def mime_type_codec(mime_type_codec: str) -> Tuple[str, List[str]]: """Parse the type data. Breaks up the data in the ``type`` key of the manifest, which contains the mime type and codecs serialized together, and splits them into separate elements. **Example**: mime_type_codec('audio/webm; co...
Parse the type data. Breaks up the data in the ``type`` key of the manifest, which contains the mime type and codecs serialized together, and splits them into separate elements. **Example**: mime_type_codec('audio/webm; codecs="opus"') -> ('audio/webm', ['opus']) :param str mime_type_codec: ...
mime_type_codec
python
pytube/pytube
pytube/extract.py
https://github.com/pytube/pytube/blob/master/pytube/extract.py
Unlicense
def get_ytplayer_js(html: str) -> Any: """Get the YouTube player base JavaScript path. :param str html The html contents of the watch page. :rtype: str :returns: Path to YouTube's base.js file. """ js_url_patterns = [ r"(/s/player/[\w\d]+/[\w\d_/.]+/base\.js)" ] ...
Get the YouTube player base JavaScript path. :param str html The html contents of the watch page. :rtype: str :returns: Path to YouTube's base.js file.
get_ytplayer_js
python
pytube/pytube
pytube/extract.py
https://github.com/pytube/pytube/blob/master/pytube/extract.py
Unlicense
def get_ytplayer_config(html: str) -> Any: """Get the YouTube player configuration data from the watch html. Extract the ``ytplayer_config``, which is json data embedded within the watch html and serves as the primary source of obtaining the stream manifest data. :param str html: The html ...
Get the YouTube player configuration data from the watch html. Extract the ``ytplayer_config``, which is json data embedded within the watch html and serves as the primary source of obtaining the stream manifest data. :param str html: The html contents of the watch page. :rtype: str :r...
get_ytplayer_config
python
pytube/pytube
pytube/extract.py
https://github.com/pytube/pytube/blob/master/pytube/extract.py
Unlicense
def get_ytcfg(html: str) -> str: """Get the entirety of the ytcfg object. This is built over multiple pieces, so we have to find all matches and combine the dicts together. :param str html: The html contents of the watch page. :rtype: str :returns: Substring of the html contain...
Get the entirety of the ytcfg object. This is built over multiple pieces, so we have to find all matches and combine the dicts together. :param str html: The html contents of the watch page. :rtype: str :returns: Substring of the html containing the encoded manifest data.
get_ytcfg
python
pytube/pytube
pytube/extract.py
https://github.com/pytube/pytube/blob/master/pytube/extract.py
Unlicense
def apply_signature(stream_manifest: Dict, vid_info: Dict, js: str) -> None: """Apply the decrypted signature to the stream manifest. :param dict stream_manifest: Details of the media streams available. :param str js: The contents of the base.js asset file. """ cipher = Cipher(js=j...
Apply the decrypted signature to the stream manifest. :param dict stream_manifest: Details of the media streams available. :param str js: The contents of the base.js asset file.
apply_signature
python
pytube/pytube
pytube/extract.py
https://github.com/pytube/pytube/blob/master/pytube/extract.py
Unlicense
def apply_descrambler(stream_data: Dict) -> None: """Apply various in-place transforms to YouTube's media stream data. Creates a ``list`` of dictionaries by string splitting on commas, then taking each list item, parsing it as a query string, converting it to a ``dict`` and unquoting the value. :p...
Apply various in-place transforms to YouTube's media stream data. Creates a ``list`` of dictionaries by string splitting on commas, then taking each list item, parsing it as a query string, converting it to a ``dict`` and unquoting the value. :param dict stream_data: Dictionary containing quer...
apply_descrambler
python
pytube/pytube
pytube/extract.py
https://github.com/pytube/pytube/blob/master/pytube/extract.py
Unlicense
def __init__(self, generator): """Construct a :class:`DeferredGeneratorList <DeferredGeneratorList>`. :param generator generator: The deferrable generator to create a wrapper for. :param func func: (Optional) A function to call on the generator items to produce the list....
Construct a :class:`DeferredGeneratorList <DeferredGeneratorList>`. :param generator generator: The deferrable generator to create a wrapper for. :param func func: (Optional) A function to call on the generator items to produce the list.
__init__
python
pytube/pytube
pytube/helpers.py
https://github.com/pytube/pytube/blob/master/pytube/helpers.py
Unlicense
def __getitem__(self, key) -> Any: """Only generate items as they're asked for.""" # We only allow querying with indexes. if not isinstance(key, (int, slice)): raise TypeError('Key must be either a slice or int.') # Convert int keys to slice key_slice = key i...
Only generate items as they're asked for.
__getitem__
python
pytube/pytube
pytube/helpers.py
https://github.com/pytube/pytube/blob/master/pytube/helpers.py
Unlicense
def __iter__(self): """Custom iterator for dynamically generated list.""" iter_index = 0 while True: try: curr_item = self[iter_index] except IndexError: return else: yield curr_item iter_index +=...
Custom iterator for dynamically generated list.
__iter__
python
pytube/pytube
pytube/helpers.py
https://github.com/pytube/pytube/blob/master/pytube/helpers.py
Unlicense
def regex_search(pattern: str, string: str, group: int) -> str: """Shortcut method to search a string for a given pattern. :param str pattern: A regular expression pattern. :param str string: A target string to search. :param int group: Index of group to return. :rtype: ...
Shortcut method to search a string for a given pattern. :param str pattern: A regular expression pattern. :param str string: A target string to search. :param int group: Index of group to return. :rtype: str or tuple :returns: Substring pattern matches.
regex_search
python
pytube/pytube
pytube/helpers.py
https://github.com/pytube/pytube/blob/master/pytube/helpers.py
Unlicense
def setup_logger(level: int = logging.ERROR, log_filename: Optional[str] = None) -> None: """Create a configured instance of logger. :param int level: Describe the severity level of the logs to handle. """ fmt = "[%(asctime)s] %(levelname)s in %(module)s: %(message)s" date_fmt = "%H:%M:%S" ...
Create a configured instance of logger. :param int level: Describe the severity level of the logs to handle.
setup_logger
python
pytube/pytube
pytube/helpers.py
https://github.com/pytube/pytube/blob/master/pytube/helpers.py
Unlicense
def target_directory(output_path: Optional[str] = None) -> str: """ Function for determining target directory of a download. Returns an absolute path (if relative one given) or the current path (if none given). Makes directory if it does not exist. :type output_path: str :rtype: str :re...
Function for determining target directory of a download. Returns an absolute path (if relative one given) or the current path (if none given). Makes directory if it does not exist. :type output_path: str :rtype: str :returns: An absolute directory path as a string.
target_directory
python
pytube/pytube
pytube/helpers.py
https://github.com/pytube/pytube/blob/master/pytube/helpers.py
Unlicense
def uniqueify(duped_list: List) -> List: """Remove duplicate items from a list, while maintaining list order. :param List duped_list List to remove duplicates from :return List result De-duplicated list """ seen: Dict[Any, bool] = {} result = [] for item in duped_list: ...
Remove duplicate items from a list, while maintaining list order. :param List duped_list List to remove duplicates from :return List result De-duplicated list
uniqueify
python
pytube/pytube
pytube/helpers.py
https://github.com/pytube/pytube/blob/master/pytube/helpers.py
Unlicense
def generate_all_html_json_mocks(): """Regenerate the video mock json files for all current test videos. This should automatically output to the test/mocks directory. """ test_vid_ids = [ '2lAe1cqCOXo', '5YceQ8YqYMc', 'irauhITDrsE', 'm8uHb5jIGN8', 'QRS8MkLhQmM', ...
Regenerate the video mock json files for all current test videos. This should automatically output to the test/mocks directory.
generate_all_html_json_mocks
python
pytube/pytube
pytube/helpers.py
https://github.com/pytube/pytube/blob/master/pytube/helpers.py
Unlicense
def create_mock_html_json(vid_id) -> Dict[str, Any]: """Generate a json.gz file with sample html responses. :param str vid_id YouTube video id :return dict data Dict used to generate the json.gz file """ from pytube import YouTube gzip_filename = 'yt-video-%s-html.json.gz' % vi...
Generate a json.gz file with sample html responses. :param str vid_id YouTube video id :return dict data Dict used to generate the json.gz file
create_mock_html_json
python
pytube/pytube
pytube/helpers.py
https://github.com/pytube/pytube/blob/master/pytube/helpers.py
Unlicense
def __init__(self, client='ANDROID_MUSIC', use_oauth=False, allow_cache=True): """Initialize an InnerTube object. :param str client: Client to use for the object. Default to web because it returns the most playback types. :param bool use_oauth: Whether or not...
Initialize an InnerTube object. :param str client: Client to use for the object. Default to web because it returns the most playback types. :param bool use_oauth: Whether or not to authenticate to YouTube. :param bool allow_cache: Allows caching o...
__init__
python
pytube/pytube
pytube/innertube.py
https://github.com/pytube/pytube/blob/master/pytube/innertube.py
Unlicense
def cache_tokens(self): """Cache tokens to file if allowed.""" if not self.allow_cache: return data = { 'access_token': self.access_token, 'refresh_token': self.refresh_token, 'expires': self.expires } if not os.path.exists(_cache_...
Cache tokens to file if allowed.
cache_tokens
python
pytube/pytube
pytube/innertube.py
https://github.com/pytube/pytube/blob/master/pytube/innertube.py
Unlicense
def refresh_bearer_token(self, force=False): """Refreshes the OAuth token if necessary. :param bool force: Force-refresh the bearer token. """ if not self.use_oauth: return # Skip refresh if it's not necessary and not forced if self.expires > time...
Refreshes the OAuth token if necessary. :param bool force: Force-refresh the bearer token.
refresh_bearer_token
python
pytube/pytube
pytube/innertube.py
https://github.com/pytube/pytube/blob/master/pytube/innertube.py
Unlicense
def _call_api(self, endpoint, query, data): """Make a request to a given endpoint with the provided query parameters and data.""" # Remove the API key if oauth is being used. if self.use_oauth: del query['key'] endpoint_url = f'{endpoint}?{parse.urlencode(query)}' he...
Make a request to a given endpoint with the provided query parameters and data.
_call_api
python
pytube/pytube
pytube/innertube.py
https://github.com/pytube/pytube/blob/master/pytube/innertube.py
Unlicense
def browse(self): """Make a request to the browse endpoint. TODO: Figure out how we can use this """ # endpoint = f'{self.base_url}/browse' # noqa:E800 ... # return self._call_api(endpoint, query, self.base_data) # noqa:E800
Make a request to the browse endpoint. TODO: Figure out how we can use this
browse
python
pytube/pytube
pytube/innertube.py
https://github.com/pytube/pytube/blob/master/pytube/innertube.py
Unlicense
def config(self): """Make a request to the config endpoint. TODO: Figure out how we can use this """ # endpoint = f'{self.base_url}/config' # noqa:E800 ... # return self._call_api(endpoint, query, self.base_data) # noqa:E800
Make a request to the config endpoint. TODO: Figure out how we can use this
config
python
pytube/pytube
pytube/innertube.py
https://github.com/pytube/pytube/blob/master/pytube/innertube.py
Unlicense
def guide(self): """Make a request to the guide endpoint. TODO: Figure out how we can use this """ # endpoint = f'{self.base_url}/guide' # noqa:E800 ... # return self._call_api(endpoint, query, self.base_data) # noqa:E800
Make a request to the guide endpoint. TODO: Figure out how we can use this
guide
python
pytube/pytube
pytube/innertube.py
https://github.com/pytube/pytube/blob/master/pytube/innertube.py
Unlicense
def next(self): """Make a request to the next endpoint. TODO: Figure out how we can use this """ # endpoint = f'{self.base_url}/next' # noqa:E800 ... # return self._call_api(endpoint, query, self.base_data) # noqa:E800
Make a request to the next endpoint. TODO: Figure out how we can use this
next
python
pytube/pytube
pytube/innertube.py
https://github.com/pytube/pytube/blob/master/pytube/innertube.py
Unlicense
def player(self, video_id): """Make a request to the player endpoint. :param str video_id: The video id to get player info for. :rtype: dict :returns: Raw player info results. """ endpoint = f'{self.base_url}/player' query = { ...
Make a request to the player endpoint. :param str video_id: The video id to get player info for. :rtype: dict :returns: Raw player info results.
player
python
pytube/pytube
pytube/innertube.py
https://github.com/pytube/pytube/blob/master/pytube/innertube.py
Unlicense
def search(self, search_query, continuation=None): """Make a request to the search endpoint. :param str search_query: The query to search. :rtype: dict :returns: Raw search query results. """ endpoint = f'{self.base_url}/search' query = { ...
Make a request to the search endpoint. :param str search_query: The query to search. :rtype: dict :returns: Raw search query results.
search
python
pytube/pytube
pytube/innertube.py
https://github.com/pytube/pytube/blob/master/pytube/innertube.py
Unlicense
def verify_age(self, video_id): """Make a request to the age_verify endpoint. Notable examples of the types of video this verification step is for: * https://www.youtube.com/watch?v=QLdAhwSBZ3w * https://www.youtube.com/watch?v=hc0ZDaAZQT0 :param str video_id: The v...
Make a request to the age_verify endpoint. Notable examples of the types of video this verification step is for: * https://www.youtube.com/watch?v=QLdAhwSBZ3w * https://www.youtube.com/watch?v=hc0ZDaAZQT0 :param str video_id: The video id to get player info for. :rt...
verify_age
python
pytube/pytube
pytube/innertube.py
https://github.com/pytube/pytube/blob/master/pytube/innertube.py
Unlicense
def get_transcript(self, video_id): """Make a request to the get_transcript endpoint. This is likely related to captioning for videos, but is currently untested. """ endpoint = f'{self.base_url}/get_transcript' query = { 'videoId': video_id, } query.u...
Make a request to the get_transcript endpoint. This is likely related to captioning for videos, but is currently untested.
get_transcript
python
pytube/pytube
pytube/innertube.py
https://github.com/pytube/pytube/blob/master/pytube/innertube.py
Unlicense
def get_format_profile(itag: int) -> Dict: """Get additional format information for a given itag. :param str itag: YouTube format identifier code. """ itag = int(itag) if itag in ITAGS: res, bitrate = ITAGS[itag] else: res, bitrate = None, None return { "reso...
Get additional format information for a given itag. :param str itag: YouTube format identifier code.
get_format_profile
python
pytube/pytube
pytube/itags.py
https://github.com/pytube/pytube/blob/master/pytube/itags.py
Unlicense
def parse_for_all_objects(html, preceding_regex): """Parses input html to find all matches for the input starting point. :param str html: HTML to be parsed for an object. :param str preceding_regex: Regex to find the string preceding the object. :rtype list: :returns: A list...
Parses input html to find all matches for the input starting point. :param str html: HTML to be parsed for an object. :param str preceding_regex: Regex to find the string preceding the object. :rtype list: :returns: A list of dicts created from parsing the objects.
parse_for_all_objects
python
pytube/pytube
pytube/parser.py
https://github.com/pytube/pytube/blob/master/pytube/parser.py
Unlicense
def parse_for_object(html, preceding_regex): """Parses input html to find the end of a JavaScript object. :param str html: HTML to be parsed for an object. :param str preceding_regex: Regex to find the string preceding the object. :rtype dict: :returns: A dict created from p...
Parses input html to find the end of a JavaScript object. :param str html: HTML to be parsed for an object. :param str preceding_regex: Regex to find the string preceding the object. :rtype dict: :returns: A dict created from parsing the object.
parse_for_object
python
pytube/pytube
pytube/parser.py
https://github.com/pytube/pytube/blob/master/pytube/parser.py
Unlicense
def find_object_from_startpoint(html, start_point): """Parses input html to find the end of a JavaScript object. :param str html: HTML to be parsed for an object. :param int start_point: Index of where the object starts. :rtype dict: :returns: A dict created from parsing the...
Parses input html to find the end of a JavaScript object. :param str html: HTML to be parsed for an object. :param int start_point: Index of where the object starts. :rtype dict: :returns: A dict created from parsing the object.
find_object_from_startpoint
python
pytube/pytube
pytube/parser.py
https://github.com/pytube/pytube/blob/master/pytube/parser.py
Unlicense
def parse_for_object_from_startpoint(html, start_point): """JSONifies an object parsed from HTML. :param str html: HTML to be parsed for an object. :param int start_point: Index of where the object starts. :rtype dict: :returns: A dict created from parsing the object. ""...
JSONifies an object parsed from HTML. :param str html: HTML to be parsed for an object. :param int start_point: Index of where the object starts. :rtype dict: :returns: A dict created from parsing the object.
parse_for_object_from_startpoint
python
pytube/pytube
pytube/parser.py
https://github.com/pytube/pytube/blob/master/pytube/parser.py
Unlicense
def throttling_array_split(js_array): """Parses the throttling array into a python list of strings. Expects input to begin with `[` and close with `]`. :param str js_array: The javascript array, as a string. :rtype: list: :returns: A list of strings representing splits on `,` in th...
Parses the throttling array into a python list of strings. Expects input to begin with `[` and close with `]`. :param str js_array: The javascript array, as a string. :rtype: list: :returns: A list of strings representing splits on `,` in the throttling array.
throttling_array_split
python
pytube/pytube
pytube/parser.py
https://github.com/pytube/pytube/blob/master/pytube/parser.py
Unlicense
def __init__(self, fmt_streams): """Construct a :class:`StreamQuery <StreamQuery>`. param list fmt_streams: list of :class:`Stream <Stream>` instances. """ self.fmt_streams = fmt_streams self.itag_index = {int(s.itag): s for s in fmt_streams}
Construct a :class:`StreamQuery <StreamQuery>`. param list fmt_streams: list of :class:`Stream <Stream>` instances.
__init__
python
pytube/pytube
pytube/query.py
https://github.com/pytube/pytube/blob/master/pytube/query.py
Unlicense
def filter( self, fps=None, res=None, resolution=None, mime_type=None, type=None, subtype=None, file_extension=None, abr=None, bitrate=None, video_codec=None, audio_codec=None, only_audio=None, only_video=Non...
Apply the given filtering criterion. :param fps: (optional) The frames per second. :type fps: int or None :param resolution: (optional) Alias to ``res``. :type res: str or None :param res: (optional) The video resolut...
filter
python
pytube/pytube
pytube/query.py
https://github.com/pytube/pytube/blob/master/pytube/query.py
Unlicense
def order_by(self, attribute_name: str) -> "StreamQuery": """Apply a sort order. Filters out stream the do not have the attribute. :param str attribute_name: The name of the attribute to sort by. """ has_attribute = [ s for s in self.fmt_streams ...
Apply a sort order. Filters out stream the do not have the attribute. :param str attribute_name: The name of the attribute to sort by.
order_by
python
pytube/pytube
pytube/query.py
https://github.com/pytube/pytube/blob/master/pytube/query.py
Unlicense
def get_by_resolution(self, resolution: str) -> Optional[Stream]: """Get the corresponding :class:`Stream <Stream>` for a given resolution. Stream must be a progressive mp4. :param str resolution: Video resolution i.e. "720p", "480p", "360p", "240p", "144p" :rtype: :class:`...
Get the corresponding :class:`Stream <Stream>` for a given resolution. Stream must be a progressive mp4. :param str resolution: Video resolution i.e. "720p", "480p", "360p", "240p", "144p" :rtype: :class:`Stream <Stream>` or None :returns: The :class:`Stream <St...
get_by_resolution
python
pytube/pytube
pytube/query.py
https://github.com/pytube/pytube/blob/master/pytube/query.py
Unlicense
def get_lowest_resolution(self) -> Optional[Stream]: """Get lowest resolution stream that is a progressive mp4. :rtype: :class:`Stream <Stream>` or None :returns: The :class:`Stream <Stream>` matching the given itag or None if not found. """ return ( ...
Get lowest resolution stream that is a progressive mp4. :rtype: :class:`Stream <Stream>` or None :returns: The :class:`Stream <Stream>` matching the given itag or None if not found.
get_lowest_resolution
python
pytube/pytube
pytube/query.py
https://github.com/pytube/pytube/blob/master/pytube/query.py
Unlicense
def get_audio_only(self, subtype: str = "mp4") -> Optional[Stream]: """Get highest bitrate audio stream for given codec (defaults to mp4) :param str subtype: Audio subtype, defaults to mp4 :rtype: :class:`Stream <Stream>` or None :returns: The :class:`Stream <Str...
Get highest bitrate audio stream for given codec (defaults to mp4) :param str subtype: Audio subtype, defaults to mp4 :rtype: :class:`Stream <Stream>` or None :returns: The :class:`Stream <Stream>` matching the given itag or None if not found.
get_audio_only
python
pytube/pytube
pytube/query.py
https://github.com/pytube/pytube/blob/master/pytube/query.py
Unlicense
def first(self) -> Optional[Stream]: """Get the first :class:`Stream <Stream>` in the results. :rtype: :class:`Stream <Stream>` or None :returns: the first result of this query or None if the result doesn't contain any streams. """ try: retur...
Get the first :class:`Stream <Stream>` in the results. :rtype: :class:`Stream <Stream>` or None :returns: the first result of this query or None if the result doesn't contain any streams.
first
python
pytube/pytube
pytube/query.py
https://github.com/pytube/pytube/blob/master/pytube/query.py
Unlicense
def last(self): """Get the last :class:`Stream <Stream>` in the results. :rtype: :class:`Stream <Stream>` or None :returns: Return the last result of this query or None if the result doesn't contain any streams. """ try: return self.fmt_strea...
Get the last :class:`Stream <Stream>` in the results. :rtype: :class:`Stream <Stream>` or None :returns: Return the last result of this query or None if the result doesn't contain any streams.
last
python
pytube/pytube
pytube/query.py
https://github.com/pytube/pytube/blob/master/pytube/query.py
Unlicense
def count(self, value: Optional[str] = None) -> int: # pragma: no cover """Get the count of items in the list. :rtype: int """ if value: return self.fmt_streams.count(value) return len(self)
Get the count of items in the list. :rtype: int
count
python
pytube/pytube
pytube/query.py
https://github.com/pytube/pytube/blob/master/pytube/query.py
Unlicense
def get_by_language_code( self, lang_code: str ) -> Optional[Caption]: # pragma: no cover """Get the :class:`Caption <Caption>` for a given ``lang_code``. :param str lang_code: The code that identifies the caption language. :rtype: :class:`Caption <Caption>` or None ...
Get the :class:`Caption <Caption>` for a given ``lang_code``. :param str lang_code: The code that identifies the caption language. :rtype: :class:`Caption <Caption>` or None :returns: The :class:`Caption <Caption>` matching the given ``lang_code`` or None if ...
get_by_language_code
python
pytube/pytube
pytube/query.py
https://github.com/pytube/pytube/blob/master/pytube/query.py
Unlicense
def get(url, extra_headers=None, timeout=socket._GLOBAL_DEFAULT_TIMEOUT): """Send an http GET request. :param str url: The URL to perform the GET request for. :param dict extra_headers: Extra headers to add to the request :rtype: str :returns: UTF-8 encoded string of respons...
Send an http GET request. :param str url: The URL to perform the GET request for. :param dict extra_headers: Extra headers to add to the request :rtype: str :returns: UTF-8 encoded string of response
get
python
pytube/pytube
pytube/request.py
https://github.com/pytube/pytube/blob/master/pytube/request.py
Unlicense
def post(url, extra_headers=None, data=None, timeout=socket._GLOBAL_DEFAULT_TIMEOUT): """Send an http POST request. :param str url: The URL to perform the POST request for. :param dict extra_headers: Extra headers to add to the request :param dict data: The data to send on the P...
Send an http POST request. :param str url: The URL to perform the POST request for. :param dict extra_headers: Extra headers to add to the request :param dict data: The data to send on the POST request :rtype: str :returns: UTF-8 encoded string of response
post
python
pytube/pytube
pytube/request.py
https://github.com/pytube/pytube/blob/master/pytube/request.py
Unlicense
def seq_stream( url, timeout=socket._GLOBAL_DEFAULT_TIMEOUT, max_retries=0 ): """Read the response in sequence. :param str url: The URL to perform the GET request for. :rtype: Iterable[bytes] """ # YouTube expects a request sequence number as part of the parameters. split_url = parse...
Read the response in sequence. :param str url: The URL to perform the GET request for. :rtype: Iterable[bytes]
seq_stream
python
pytube/pytube
pytube/request.py
https://github.com/pytube/pytube/blob/master/pytube/request.py
Unlicense
def stream( url, timeout=socket._GLOBAL_DEFAULT_TIMEOUT, max_retries=0 ): """Read the response in chunks. :param str url: The URL to perform the GET request for. :rtype: Iterable[bytes] """ file_size: int = default_range_size # fake filesize to start downloaded = 0 while downloa...
Read the response in chunks. :param str url: The URL to perform the GET request for. :rtype: Iterable[bytes]
stream
python
pytube/pytube
pytube/request.py
https://github.com/pytube/pytube/blob/master/pytube/request.py
Unlicense
def seq_filesize(url): """Fetch size in bytes of file at given URL from sequential requests :param str url: The URL to get the size of :returns: int: size in bytes of remote file """ total_filesize = 0 # YouTube expects a request sequence number as part of the parameters. split_url = parse....
Fetch size in bytes of file at given URL from sequential requests :param str url: The URL to get the size of :returns: int: size in bytes of remote file
seq_filesize
python
pytube/pytube
pytube/request.py
https://github.com/pytube/pytube/blob/master/pytube/request.py
Unlicense
def head(url): """Fetch headers returned http GET request. :param str url: The URL to perform the GET request for. :rtype: dict :returns: dictionary of lowercase headers """ response_headers = _execute_request(url, method="HEAD").info() return {k.lower(): v for k, v in respo...
Fetch headers returned http GET request. :param str url: The URL to perform the GET request for. :rtype: dict :returns: dictionary of lowercase headers
head
python
pytube/pytube
pytube/request.py
https://github.com/pytube/pytube/blob/master/pytube/request.py
Unlicense
def __init__( self, stream: Dict, monostate: Monostate ): """Construct a :class:`Stream <Stream>`. :param dict stream: The unscrambled data extracted from YouTube. :param dict monostate: Dictionary of data shared across all instances of :class:`St...
Construct a :class:`Stream <Stream>`. :param dict stream: The unscrambled data extracted from YouTube. :param dict monostate: Dictionary of data shared across all instances of :class:`Stream <Stream>`.
__init__
python
pytube/pytube
pytube/streams.py
https://github.com/pytube/pytube/blob/master/pytube/streams.py
Unlicense
def is_adaptive(self) -> bool: """Whether the stream is DASH. :rtype: bool """ # if codecs has two elements (e.g.: ['vp8', 'vorbis']): 2 % 2 = 0 # if codecs has one element (e.g.: ['vp8']) 1 % 2 = 1 return bool(len(self.codecs) % 2)
Whether the stream is DASH. :rtype: bool
is_adaptive
python
pytube/pytube
pytube/streams.py
https://github.com/pytube/pytube/blob/master/pytube/streams.py
Unlicense
def parse_codecs(self) -> Tuple[Optional[str], Optional[str]]: """Get the video/audio codecs from list of codecs. Parse a variable length sized list of codecs and returns a constant two element tuple, with the video codec as the first element and audio as the second. Returns None if one...
Get the video/audio codecs from list of codecs. Parse a variable length sized list of codecs and returns a constant two element tuple, with the video codec as the first element and audio as the second. Returns None if one is not available (adaptive only). :rtype: tuple ...
parse_codecs
python
pytube/pytube
pytube/streams.py
https://github.com/pytube/pytube/blob/master/pytube/streams.py
Unlicense
def filesize(self) -> int: """File size of the media stream in bytes. :rtype: int :returns: Filesize (in bytes) of the stream. """ if self._filesize == 0: try: self._filesize = request.filesize(self.url) except HTTPError as e: ...
File size of the media stream in bytes. :rtype: int :returns: Filesize (in bytes) of the stream.
filesize
python
pytube/pytube
pytube/streams.py
https://github.com/pytube/pytube/blob/master/pytube/streams.py
Unlicense
def filesize_kb(self) -> float: """File size of the media stream in kilobytes. :rtype: float :returns: Rounded filesize (in kilobytes) of the stream. """ if self._filesize_kb == 0: try: self._filesize_kb = float(ceil(request.filesize(self....
File size of the media stream in kilobytes. :rtype: float :returns: Rounded filesize (in kilobytes) of the stream.
filesize_kb
python
pytube/pytube
pytube/streams.py
https://github.com/pytube/pytube/blob/master/pytube/streams.py
Unlicense
def filesize_mb(self) -> float: """File size of the media stream in megabytes. :rtype: float :returns: Rounded filesize (in megabytes) of the stream. """ if self._filesize_mb == 0: try: self._filesize_mb = float(ceil(request.filesize(self....
File size of the media stream in megabytes. :rtype: float :returns: Rounded filesize (in megabytes) of the stream.
filesize_mb
python
pytube/pytube
pytube/streams.py
https://github.com/pytube/pytube/blob/master/pytube/streams.py
Unlicense
def filesize_gb(self) -> float: """File size of the media stream in gigabytes. :rtype: float :returns: Rounded filesize (in gigabytes) of the stream. """ if self._filesize_gb == 0: try: self._filesize_gb = float(ceil(request.filesize(self....
File size of the media stream in gigabytes. :rtype: float :returns: Rounded filesize (in gigabytes) of the stream.
filesize_gb
python
pytube/pytube
pytube/streams.py
https://github.com/pytube/pytube/blob/master/pytube/streams.py
Unlicense
def filesize_approx(self) -> int: """Get approximate filesize of the video Falls back to HTTP call if there is not sufficient information to approximate :rtype: int :returns: size of video in bytes """ if self._monostate.duration and self.bitrate: bits_in_by...
Get approximate filesize of the video Falls back to HTTP call if there is not sufficient information to approximate :rtype: int :returns: size of video in bytes
filesize_approx
python
pytube/pytube
pytube/streams.py
https://github.com/pytube/pytube/blob/master/pytube/streams.py
Unlicense
def download( self, output_path: Optional[str] = None, filename: Optional[str] = None, filename_prefix: Optional[str] = None, skip_existing: bool = True, timeout: Optional[int] = None, max_retries: Optional[int] = 0 ) -> str: """Write the media stream ...
Write the media stream to disk. :param output_path: (optional) Output path for writing media file. If one is not specified, defaults to the current working directory. :type output_path: str or None :param filename: (optional) Output filename (stem only) for w...
download
python
pytube/pytube
pytube/streams.py
https://github.com/pytube/pytube/blob/master/pytube/streams.py
Unlicense
def stream_to_buffer(self, buffer: BinaryIO) -> None: """Write the media stream to buffer :rtype: io.BytesIO buffer """ bytes_remaining = self.filesize logger.info( "downloading (%s total bytes) file to buffer", self.filesize, ) for chunk in request....
Write the media stream to buffer :rtype: io.BytesIO buffer
stream_to_buffer
python
pytube/pytube
pytube/streams.py
https://github.com/pytube/pytube/blob/master/pytube/streams.py
Unlicense
def on_progress( self, chunk: bytes, file_handler: BinaryIO, bytes_remaining: int ): """On progress callback function. This function writes the binary data to the file, then checks if an additional callback is defined in the monostate. This is exposed to allow things like di...
On progress callback function. This function writes the binary data to the file, then checks if an additional callback is defined in the monostate. This is exposed to allow things like displaying a progress bar. :param bytes chunk: Segment of media file binary data, not yet...
on_progress
python
pytube/pytube
pytube/streams.py
https://github.com/pytube/pytube/blob/master/pytube/streams.py
Unlicense
def on_complete(self, file_path: Optional[str]): """On download complete handler function. :param file_path: The file handle where the media is being written to. :type file_path: str :rtype: None """ logger.debug("download finished") on_complete = s...
On download complete handler function. :param file_path: The file handle where the media is being written to. :type file_path: str :rtype: None
on_complete
python
pytube/pytube
pytube/streams.py
https://github.com/pytube/pytube/blob/master/pytube/streams.py
Unlicense
def __repr__(self) -> str: """Printable object representation. :rtype: str :returns: A string representation of a :class:`Stream <Stream>` object. """ parts = ['itag="{s.itag}"', 'mime_type="{s.mime_type}"'] if self.includes_video_track: parts.ext...
Printable object representation. :rtype: str :returns: A string representation of a :class:`Stream <Stream>` object.
__repr__
python
pytube/pytube
pytube/streams.py
https://github.com/pytube/pytube/blob/master/pytube/streams.py
Unlicense
def __init__( self, url: str, on_progress_callback: Optional[Callable[[Any, bytes, int], None]] = None, on_complete_callback: Optional[Callable[[Any, Optional[str]], None]] = None, proxies: Dict[str, str] = None, use_oauth: bool = False, allow_oauth_cache: bool = ...
Construct a :class:`YouTube <YouTube>`. :param str url: A valid YouTube watch URL. :param func on_progress_callback: (Optional) User defined callback function for stream download progress events. :param func on_complete_callback: (Optional) User d...
__init__
python
pytube/pytube
pytube/__main__.py
https://github.com/pytube/pytube/blob/master/pytube/__main__.py
Unlicense
def fmt_streams(self): """Returns a list of streams if they have been initialized. If the streams have not been initialized, finds all relevant streams and initializes them. """ self.check_availability() if self._fmt_streams: return self._fmt_streams ...
Returns a list of streams if they have been initialized. If the streams have not been initialized, finds all relevant streams and initializes them.
fmt_streams
python
pytube/pytube
pytube/__main__.py
https://github.com/pytube/pytube/blob/master/pytube/__main__.py
Unlicense
def check_availability(self): """Check whether the video is available. Raises different exceptions based on why the video is unavailable, otherwise does nothing. """ status, messages = extract.playability_status(self.watch_html) for reason in messages: if st...
Check whether the video is available. Raises different exceptions based on why the video is unavailable, otherwise does nothing.
check_availability
python
pytube/pytube
pytube/__main__.py
https://github.com/pytube/pytube/blob/master/pytube/__main__.py
Unlicense
def vid_info(self): """Parse the raw vid info and return the parsed result. :rtype: Dict[Any, Any] """ if self._vid_info: return self._vid_info innertube = InnerTube(use_oauth=self.use_oauth, allow_cache=self.allow_oauth_cache) innertube_response = innertub...
Parse the raw vid info and return the parsed result. :rtype: Dict[Any, Any]
vid_info
python
pytube/pytube
pytube/__main__.py
https://github.com/pytube/pytube/blob/master/pytube/__main__.py
Unlicense
def bypass_age_gate(self): """Attempt to update the vid_info by bypassing the age gate.""" innertube = InnerTube( client='ANDROID_EMBED', use_oauth=self.use_oauth, allow_cache=self.allow_oauth_cache ) innertube_response = innertube.player(self.video_id...
Attempt to update the vid_info by bypassing the age gate.
bypass_age_gate
python
pytube/pytube
pytube/__main__.py
https://github.com/pytube/pytube/blob/master/pytube/__main__.py
Unlicense
def caption_tracks(self) -> List[pytube.Caption]: """Get a list of :class:`Caption <Caption>`. :rtype: List[Caption] """ raw_tracks = ( self.vid_info.get("captions", {}) .get("playerCaptionsTracklistRenderer", {}) .get("captionTracks", []) ) ...
Get a list of :class:`Caption <Caption>`. :rtype: List[Caption]
caption_tracks
python
pytube/pytube
pytube/__main__.py
https://github.com/pytube/pytube/blob/master/pytube/__main__.py
Unlicense
def thumbnail_url(self) -> str: """Get the thumbnail url image. :rtype: str """ thumbnail_details = ( self.vid_info.get("videoDetails", {}) .get("thumbnail", {}) .get("thumbnails") ) if thumbnail_details: thumbnail_details ...
Get the thumbnail url image. :rtype: str
thumbnail_url
python
pytube/pytube
pytube/__main__.py
https://github.com/pytube/pytube/blob/master/pytube/__main__.py
Unlicense
def publish_date(self): """Get the publish date. :rtype: datetime """ if self._publish_date: return self._publish_date self._publish_date = extract.publish_date(self.watch_html) return self._publish_date
Get the publish date. :rtype: datetime
publish_date
python
pytube/pytube
pytube/__main__.py
https://github.com/pytube/pytube/blob/master/pytube/__main__.py
Unlicense
def title(self) -> str: """Get the video title. :rtype: str """ if self._title: return self._title try: self._title = self.vid_info['videoDetails']['title'] except KeyError: # Check_availability will raise the correct exception in mos...
Get the video title. :rtype: str
title
python
pytube/pytube
pytube/__main__.py
https://github.com/pytube/pytube/blob/master/pytube/__main__.py
Unlicense
def author(self) -> str: """Get the video author. :rtype: str """ if self._author: return self._author self._author = self.vid_info.get("videoDetails", {}).get( "author", "unknown" ) return self._author
Get the video author. :rtype: str
author
python
pytube/pytube
pytube/__main__.py
https://github.com/pytube/pytube/blob/master/pytube/__main__.py
Unlicense
def metadata(self) -> Optional[YouTubeMetadata]: """Get the metadata for the video. :rtype: YouTubeMetadata """ if self._metadata: return self._metadata else: self._metadata = extract.metadata(self.initial_data) return self._metadata
Get the metadata for the video. :rtype: YouTubeMetadata
metadata
python
pytube/pytube
pytube/__main__.py
https://github.com/pytube/pytube/blob/master/pytube/__main__.py
Unlicense
def __init__(self, url: str, proxies: Optional[Dict[str, str]] = None): """Construct a :class:`Channel <Channel>`. :param str url: A valid YouTube channel URL. :param proxies: (Optional) A dictionary of proxies to use for web requests. """ super().__init_...
Construct a :class:`Channel <Channel>`. :param str url: A valid YouTube channel URL. :param proxies: (Optional) A dictionary of proxies to use for web requests.
__init__
python
pytube/pytube
pytube/contrib/channel.py
https://github.com/pytube/pytube/blob/master/pytube/contrib/channel.py
Unlicense
def html(self): """Get the html for the /videos page. :rtype: str """ if self._html: return self._html self._html = request.get(self.videos_url) return self._html
Get the html for the /videos page. :rtype: str
html
python
pytube/pytube
pytube/contrib/channel.py
https://github.com/pytube/pytube/blob/master/pytube/contrib/channel.py
Unlicense
def playlists_html(self): """Get the html for the /playlists page. Currently unused for any functionality. :rtype: str """ if self._playlists_html: return self._playlists_html else: self._playlists_html = request.get(self.playlists_url) ...
Get the html for the /playlists page. Currently unused for any functionality. :rtype: str
playlists_html
python
pytube/pytube
pytube/contrib/channel.py
https://github.com/pytube/pytube/blob/master/pytube/contrib/channel.py
Unlicense
def community_html(self): """Get the html for the /community page. Currently unused for any functionality. :rtype: str """ if self._community_html: return self._community_html else: self._community_html = request.get(self.community_url) ...
Get the html for the /community page. Currently unused for any functionality. :rtype: str
community_html
python
pytube/pytube
pytube/contrib/channel.py
https://github.com/pytube/pytube/blob/master/pytube/contrib/channel.py
Unlicense
def featured_channels_html(self): """Get the html for the /channels page. Currently unused for any functionality. :rtype: str """ if self._featured_channels_html: return self._featured_channels_html else: self._featured_channels_html = request.ge...
Get the html for the /channels page. Currently unused for any functionality. :rtype: str
featured_channels_html
python
pytube/pytube
pytube/contrib/channel.py
https://github.com/pytube/pytube/blob/master/pytube/contrib/channel.py
Unlicense