mirror of
https://github.com/soimort/you-get.git
synced 2025-02-11 20:52:31 +03:00
[weibo]weibo videos is m3u8 instead of mp4 now
This commit is contained in:
parent
d0a7655727
commit
353a6a6730
@ -1068,6 +1068,8 @@ def print_info(site_info, title, type, size):
|
|||||||
type_info = "Portable Network Graphics (%s)" % type
|
type_info = "Portable Network Graphics (%s)" % type
|
||||||
elif type in ['image/gif']:
|
elif type in ['image/gif']:
|
||||||
type_info = "Graphics Interchange Format (%s)" % type
|
type_info = "Graphics Interchange Format (%s)" % type
|
||||||
|
elif type in ['m3u8']:
|
||||||
|
type_info = 'M3U8 Playlist {}'.format(type)
|
||||||
|
|
||||||
else:
|
else:
|
||||||
type_info = "Unknown type (%s)" % type
|
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("Site: ", site_info)
|
||||||
maybe_print("Title: ", unescape_html(tr(title)))
|
maybe_print("Title: ", unescape_html(tr(title)))
|
||||||
print("Type: ", type_info)
|
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()
|
print()
|
||||||
|
|
||||||
def mime_to_container(mime):
|
def mime_to_container(mime):
|
||||||
|
@ -5,6 +5,16 @@ __all__ = ['miaopai_download']
|
|||||||
from ..common import *
|
from ..common import *
|
||||||
import urllib.error
|
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):
|
def miaopai_download_by_fid(fid, output_dir = '.', merge = False, info_only = False, **kwargs):
|
||||||
'''Source: Android mobile'''
|
'''Source: Android mobile'''
|
||||||
fake_headers_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)
|
mobile_page = get_content(page_url, headers=fake_headers_mobile)
|
||||||
url = match1(mobile_page, r'<video id=.*?src=[\'"](.*?)[\'"]\W')
|
url = match1(mobile_page, r'<video id=.*?src=[\'"](.*?)[\'"]\W')
|
||||||
title = match1(mobile_page, r'<title>([^<]+)</title>')
|
title = match1(mobile_page, r'<title>([^<]+)</title>')
|
||||||
type_, ext, size = url_info(url)
|
if not '.m3u8' in url:
|
||||||
print_info(site_info, title, type_, size)
|
type_, ext, size = url_info(url)
|
||||||
if not info_only:
|
print_info(site_info, title, type_, size)
|
||||||
download_urls([url], title.replace('\n',''), ext, total_size=None, output_dir=output_dir, merge=merge)
|
if not info_only:
|
||||||
|
download_urls([url], title.replace('\n',''), ext, total_size=None, output_dir=output_dir, merge=merge)
|
||||||
|
else:
|
||||||
|
urls = build_m3u8_list(url)
|
||||||
|
print_info(site_info, title, 'm3u8', 0)
|
||||||
|
if not info_only:
|
||||||
|
download_urls(urls, title.replace('\n', ''), 'mp4', total_size=None, output_dir=output_dir, merge=merge)
|
||||||
|
|
||||||
#----------------------------------------------------------------------
|
#----------------------------------------------------------------------
|
||||||
def miaopai_download(url, output_dir = '.', merge = False, info_only = False, **kwargs):
|
def miaopai_download(url, output_dir = '.', merge = False, info_only = False, **kwargs):
|
||||||
|
Loading…
Reference in New Issue
Block a user