]>
Commit | Line | Data |
---|---|---|
f35b84c8 | 1 | import re |
81082e04 PH |
2 | |
3 | from ..utils import ( | |
4 | compat_urllib_parse, | |
5 | determine_ext | |
6 | ) | |
f35b84c8 YK |
7 | from .common import InfoExtractor |
8 | ||
9 | ||
81082e04 PH |
10 | class EHowIE(InfoExtractor): |
11 | IE_NAME = u'eHow' | |
12 | _VALID_URL = r'(?:https?://)?(?:www\.)?ehow\.com/[^/_?]*_(?P<id>[0-9]+)' | |
f35b84c8 | 13 | _TEST = { |
b1082f01 YK |
14 | u'url': u'http://www.ehow.com/video_12245069_hardwood-flooring-basics.html', |
15 | u'file': u'12245069.flv', | |
16 | u'md5': u'9809b4e3f115ae2088440bcb4efbf371', | |
f35b84c8 | 17 | u'info_dict': { |
b1082f01 YK |
18 | u"title": u"Hardwood Flooring Basics", |
19 | u"description": u"Hardwood flooring may be time consuming, but its ultimately a pretty straightforward concept. Learn about hardwood flooring basics with help from a hardware flooring business owner in this free video...", | |
20 | u"uploader": u"Erick Nathan" | |
f35b84c8 YK |
21 | } |
22 | } | |
23 | ||
24 | def _real_extract(self, url): | |
25 | mobj = re.match(self._VALID_URL, url) | |
81082e04 | 26 | video_id = mobj.group('id') |
f35b84c8 | 27 | webpage = self._download_webpage(url, video_id) |
81082e04 | 28 | video_url = self._search_regex(r'(?:file|source)=(http[^\'"&]*)', |
f35b84c8 YK |
29 | webpage, u'video URL') |
30 | final_url = compat_urllib_parse.unquote(video_url) | |
f35b84c8 YK |
31 | uploader = self._search_regex(r'<meta name="uploader" content="(.+?)" />', |
32 | webpage, u'uploader') | |
46720279 | 33 | title = self._og_search_title(webpage).replace(' | eHow', '') |
81082e04 PH |
34 | ext = determine_ext(final_url) |
35 | ||
36 | return { | |
37 | '_type': 'video', | |
f35b84c8 YK |
38 | 'id': video_id, |
39 | 'url': final_url, | |
40 | 'ext': ext, | |
41 | 'title': title, | |
46720279 JMF |
42 | 'thumbnail': self._og_search_thumbnail(webpage), |
43 | 'description': self._og_search_description(webpage), | |
f35b84c8 | 44 | 'uploader': uploader, |
81082e04 | 45 | } |
f35b84c8 | 46 |