projects
/
youtube-dl
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
9880124
)
[facebook] Handle escaped swf params
author
Yen Chi Hsuan
<yan12125@gmail.com>
Thu, 10 Mar 2016 07:26:32 +0000
(15:26 +0800)
committer
Yen Chi Hsuan
<yan12125@gmail.com>
Thu, 10 Mar 2016 07:26:32 +0000
(15:26 +0800)
Fixes #8713
youtube_dl/extractor/facebook.py
patch
|
blob
|
history
diff --git
a/youtube_dl/extractor/facebook.py
b/youtube_dl/extractor/facebook.py
index b354c5521852c2f78a18f83a70b3b473839a84f2..49231d3e9e74a82e96121424ed8043607dab8b54 100644
(file)
--- a/
youtube_dl/extractor/facebook.py
+++ b/
youtube_dl/extractor/facebook.py
@@
-102,6
+102,15
@@
class FacebookIE(InfoExtractor):
'title': 'What the Flock Is Going On In New Zealand Credit: ViralHog',
'uploader': 'S. Saint',
},
'title': 'What the Flock Is Going On In New Zealand Credit: ViralHog',
'uploader': 'S. Saint',
},
+ }, {
+ 'note': 'swf params escaped',
+ 'url': 'https://www.facebook.com/barackobama/posts/10153664894881749',
+ 'md5': '97ba073838964d12c70566e0085c2b91',
+ 'info_dict': {
+ 'id': '10153664894881749',
+ 'ext': 'mp4',
+ 'title': 'Facebook video #10153664894881749',
+ },
}, {
'url': 'https://www.facebook.com/video.php?v=10204634152394104',
'only_matching': True,
}, {
'url': 'https://www.facebook.com/video.php?v=10204634152394104',
'only_matching': True,
@@
-189,11
+198,12
@@
class FacebookIE(InfoExtractor):
video_data = None
video_data = None
- BEFORE = '{swf.addParam(param[0], param[1]);});
\n
'
+ BEFORE = '{swf.addParam(param[0], param[1]);});'
AFTER = '.forEach(function(variable) {swf.addVariable(variable[0], variable[1]);});'
AFTER = '.forEach(function(variable) {swf.addVariable(variable[0], variable[1]);});'
- m = re.search(re.escape(BEFORE) + '(.*?)' + re.escape(AFTER), webpage)
+ m = re.search(re.escape(BEFORE) + '(
?:\n|\\\\n)(
.*?)' + re.escape(AFTER), webpage)
if m:
if m:
- data = dict(json.loads(m.group(1)))
+ swf_params = m.group(1).replace('\\\\', '\\').replace('\\"', '"')
+ data = dict(json.loads(swf_params))
params_raw = compat_urllib_parse_unquote(data['params'])
video_data = json.loads(params_raw)['video_data']
params_raw = compat_urllib_parse_unquote(data['params'])
video_data = json.loads(params_raw)['video_data']