mirror of
https://github.com/soimort/you-get.git
synced 2025-02-10 12:12:26 +03:00
[facebook] fix #1203
This commit is contained in:
parent
fc83718e58
commit
13dc2e9d61
@ -5,24 +5,21 @@ __all__ = ['facebook_download']
|
|||||||
from ..common import *
|
from ..common import *
|
||||||
import json
|
import json
|
||||||
|
|
||||||
|
|
||||||
def facebook_download(url, output_dir='.', merge=True, info_only=False, **kwargs):
|
def facebook_download(url, output_dir='.', merge=True, info_only=False, **kwargs):
|
||||||
html = get_html(url)
|
html = get_html(url)
|
||||||
|
|
||||||
title = r1(r'<title id="pageTitle">(.+) \| Facebook</title>', html)
|
title = r1(r'<title id="pageTitle">(.+)</title>', html)
|
||||||
s2 = parse.unquote(unicodize(r1(r'\["params","([^"]*)"\]', html)))
|
sd_urls = [
|
||||||
data = json.loads(s2)
|
unicodize(str.replace(i, '\\/', '/'))
|
||||||
video_data = data["video_data"]["progressive"]
|
for i in re.findall(r'"sd_src_no_ratelimit":"([^"]*)"', html)
|
||||||
for fmt in ["hd_src", "sd_src"]:
|
]
|
||||||
src = video_data[0][fmt]
|
|
||||||
if src:
|
|
||||||
break
|
|
||||||
|
|
||||||
type, ext, size = url_info(src, True)
|
type, ext, size = url_info(sd_urls[0], True)
|
||||||
|
size = urls_size(sd_urls)
|
||||||
|
|
||||||
print_info(site_info, title, type, size)
|
print_info(site_info, title, type, size)
|
||||||
if not info_only:
|
if not info_only:
|
||||||
download_urls([src], title, ext, size, output_dir, merge=merge)
|
download_urls(sd_urls, title, ext, size, output_dir, merge=False)
|
||||||
|
|
||||||
site_info = "Facebook.com"
|
site_info = "Facebook.com"
|
||||||
download = facebook_download
|
download = facebook_download
|
||||||
|
Loading…
Reference in New Issue
Block a user