]> jfr.im git - yt-dlp.git/blame - youtube_dl/extractor/ehow.py
added an IE for Ehow videos
[yt-dlp.git] / youtube_dl / extractor / ehow.py
CommitLineData
f35b84c8
YK
1import re
2from ..utils import compat_urllib_parse
3from .common import InfoExtractor
4
5
6class EhowIE(InfoExtractor):
7 _VALID_URL = r'(?:http://)?(?:www\.)?ehow\.com/([^/]+)'
8 _TEST = {
9 u'url': u'http://www.break.com/video/when-girls-act-like-guys-2468056',
10 u'file': u'2468056.mp4',
11 u'md5': u'a3513fb1547fba4fb6cfac1bffc6c46b',
12 u'info_dict': {
13 u"title": u"When Girls Act Like D-Bags"
14 }
15 }
16
17 def _real_extract(self, url):
18 mobj = re.match(self._VALID_URL, url)
19 video_id = mobj.group(1).split("_")[1]
20 webpage = self._download_webpage(url, video_id)
21 video_url = self._search_regex(r'[^A-Za-z0-9]?(?:file|source)=(http[^\'"&]*)',
22 webpage, u'video URL')
23 final_url = compat_urllib_parse.unquote(video_url)
24 thumbnail_url = self._search_regex(r'<meta property="og:image" content="(.+?)" />',
25 webpage, u'thumbnail URL')
26 uploader = self._search_regex(r'<meta name="uploader" content="(.+?)" />',
27 webpage, u'uploader')
28 title = self._search_regex(r'<meta property="og:title" content="(.+?)" />',
29 webpage, u'Video title').replace(' | eHow','')
30 description = self._search_regex(r'<meta property="og:description" content="(.+?)" />',
31 webpage, u'video description')
32 ext = final_url.split('.')[-1]
33 return [{
34 'id': video_id,
35 'url': final_url,
36 'ext': ext,
37 'title': title,
38 'thumbnail': thumbnail_url,
39 'description': description,
40 'uploader': uploader,
41 }]
42