projects
/
youtube-dl
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
[vessel] Fix pep8 issue
[youtube-dl]
/
youtube_dl
/
extractor
/
funnyordie.py
diff --git
a/youtube_dl/extractor/funnyordie.py
b/youtube_dl/extractor/funnyordie.py
index ec6d96adaeff666bf0fea7fe78e766c6a6ac2808..dd87257c465983dcda30a6faf5dbd7bc0950560c 100644
(file)
--- a/
youtube_dl/extractor/funnyordie.py
+++ b/
youtube_dl/extractor/funnyordie.py
@@
-8,7
+8,7
@@
from ..utils import ExtractorError
class FunnyOrDieIE(InfoExtractor):
class FunnyOrDieIE(InfoExtractor):
- _VALID_URL = r'https?://(?:www\.)?funnyordie\.com/(?P<type>embed|videos)/(?P<id>[0-9a-f]+)(?:$|[?#/])'
+ _VALID_URL = r'https?://(?:www\.)?funnyordie\.com/(?P<type>embed|
articles|
videos)/(?P<id>[0-9a-f]+)(?:$|[?#/])'
_TESTS = [{
'url': 'http://www.funnyordie.com/videos/0732f586d7/heart-shaped-box-literal-video-version',
'md5': 'bcd81e0c4f26189ee09be362ad6e6ba9',
_TESTS = [{
'url': 'http://www.funnyordie.com/videos/0732f586d7/heart-shaped-box-literal-video-version',
'md5': 'bcd81e0c4f26189ee09be362ad6e6ba9',
@@
-21,7
+21,6
@@
class FunnyOrDieIE(InfoExtractor):
},
}, {
'url': 'http://www.funnyordie.com/embed/e402820827',
},
}, {
'url': 'http://www.funnyordie.com/embed/e402820827',
- 'md5': '29f4c5e5a61ca39dfd7e8348a75d0aad',
'info_dict': {
'id': 'e402820827',
'ext': 'mp4',
'info_dict': {
'id': 'e402820827',
'ext': 'mp4',
@@
-29,6
+28,9
@@
class FunnyOrDieIE(InfoExtractor):
'description': 'Please use this to sell something. www.jonlajoie.com',
'thumbnail': 're:^http:.*\.jpg$',
},
'description': 'Please use this to sell something. www.jonlajoie.com',
'thumbnail': 're:^http:.*\.jpg$',
},
+ }, {
+ 'url': 'http://www.funnyordie.com/articles/ebf5e34fc8/10-hours-of-walking-in-nyc-as-a-man',
+ 'only_matching': True,
}]
def _real_extract(self, url):
}]
def _real_extract(self, url):
@@
-48,7
+50,6
@@
class FunnyOrDieIE(InfoExtractor):
bitrates.sort()
formats = []
bitrates.sort()
formats = []
-
for bitrate in bitrates:
for link in links:
formats.append({
for bitrate in bitrates:
for link in links:
formats.append({
@@
-57,6
+58,13
@@
class FunnyOrDieIE(InfoExtractor):
'vbr': bitrate,
})
'vbr': bitrate,
})
+ subtitles = {}
+ for src, src_lang in re.findall(r'<track kind="captions" src="([^"]+)" srclang="([^"]+)"', webpage):
+ subtitles[src_lang] = [{
+ 'ext': src.split('/')[-1],
+ 'url': 'http://www.funnyordie.com%s' % src,
+ }]
+
post_json = self._search_regex(
r'fb_post\s*=\s*(\{.*?\});', webpage, 'post details')
post = json.loads(post_json)
post_json = self._search_regex(
r'fb_post\s*=\s*(\{.*?\});', webpage, 'post details')
post = json.loads(post_json)
@@
-67,4
+75,5
@@
class FunnyOrDieIE(InfoExtractor):
'description': post.get('description'),
'thumbnail': post.get('picture'),
'formats': formats,
'description': post.get('description'),
'thumbnail': post.get('picture'),
'formats': formats,
+ 'subtitles': subtitles,
}
}