diff --git a/src/you_get/common.py b/src/you_get/common.py index 8d4d2d76..ce796b93 100755 --- a/src/you_get/common.py +++ b/src/you_get/common.py @@ -1068,6 +1068,8 @@ def print_info(site_info, title, type, size): type_info = "Portable Network Graphics (%s)" % type elif type in ['image/gif']: type_info = "Graphics Interchange Format (%s)" % type + elif type in ['m3u8']: + type_info = 'M3U8 Playlist {}'.format(type) else: type_info = "Unknown type (%s)" % type @@ -1075,7 +1077,8 @@ def print_info(site_info, title, type, size): maybe_print("Site: ", site_info) maybe_print("Title: ", unescape_html(tr(title))) print("Type: ", type_info) - print("Size: ", round(size / 1048576, 2), "MiB (" + str(size) + " Bytes)") + if type != 'm3u8': + print("Size: ", round(size / 1048576, 2), "MiB (" + str(size) + " Bytes)") print() def mime_to_container(mime): diff --git a/src/you_get/extractors/miaopai.py b/src/you_get/extractors/miaopai.py index e9a6ff2d..72578118 100644 --- a/src/you_get/extractors/miaopai.py +++ b/src/you_get/extractors/miaopai.py @@ -5,6 +5,16 @@ __all__ = ['miaopai_download'] from ..common import * import urllib.error +def build_m3u8_list(m3u8_url): + path_len = len(m3u8_url.split('/')[-1]) + base_url = m3u8_url[:-path_len] + urls = [] + m3u8 = get_content(m3u8_url).split('\n') + for line in m3u8: + if len(line) > 0 and line[0] != '#': + urls.append(base_url+line) + return urls + def miaopai_download_by_fid(fid, output_dir = '.', merge = False, info_only = False, **kwargs): '''Source: Android mobile''' fake_headers_mobile = { @@ -19,10 +29,16 @@ def miaopai_download_by_fid(fid, output_dir = '.', merge = False, info_only = Fa mobile_page = get_content(page_url, headers=fake_headers_mobile) url = match1(mobile_page, r'