collectionslkp.blogg.se

M3u file format
M3u file format





:type extension: str or list :rtype: None """ def retrieve_by_extension ( self, extension : Union ): """Select only streams information with a certain extension/s. It can be a string or list of extension/s. :param extension: Name of the extension like mp4, m3u8 etc. It removes stream information from streams information list based on extension/s provided. :rtype: None """ def remove_by_extension ( self, extension : Union ) """Remove stream information with certain extension/s. :type nested_key: bool :rtype: None """ def reset_operations ( self ): """Reset the stream information list to initial state before various operations. :type retrieve: bool :param nested_key: True/False for if the key is nested or not. Default: "-" :type key_splitter: str :param retrieve: True to retrieve and False for removing based on key. :type filters: str or list :param key_splitter: A splitter to split the nested keys. key='name', key='language-name' :type key: str :param filters: List of filter/s to perform the retrieve or remove operation.

m3u file format

It retrieves/removes stream information from streams information list using filter/s on key. If it is not enforced, non-existing fields are ignored :type enforce_schema: bool :param check_live: To check if the stream links are working or not :type check_live: bool :rtype: None """ def filter_by ( self, key : str, filters : Union, key_splitter : str = "-", retrieve : bool = True, nested_key : bool = False ): """Filter streams infomation. :param path: Path can be a url or local filepath :type path: str :param enforce_schema: If the schema is forced, non-existing fields in a stream are filled with None/null. It downloads the file from the given url or use the local file path to get the content and parses line by line to a structured format of streams information. to_file ( 'pawan.json' ) Usage from m3u_parser import M3uParser url = "/home/pawan/Downloads/ru.m3u" useragent = "Mozilla/5.0 (X11 Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/.75 Safari/537.36" parser = M3uParser ( timeout = 5, useragent = useragent )įunctions def parse_m3u ( self, path : str, check_live : bool = True, enforce_schema : bool = False ): """Parses the content of local file/URL. filter_by ( 'status', 'GOOD' ) print ( len ( parser. Pipenv install m3u-parser Example from m3u_parser import M3uParser url = "/home/pawan/Downloads/ru.m3u" useragent = "Mozilla/5.0 (X11 Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/.75 Safari/537.36" parser = M3uParser ( timeout = 5, useragent = useragent ) parser.

m3u file format

It parses the contents of m3u file to a list of streams information which can be saved as a JSON/CSV file.Ĭheck go-m3u-parser also.







M3u file format