]> Raphaƫl G. Git Repositories - youtubedl/blob - youtube_dl/extractor/ehow.py
Merge tag 'upstream/2015.05.15'
[youtubedl] / youtube_dl / extractor / ehow.py
1 from __future__ import unicode_literals
2
3 from ..compat import (
4 compat_urllib_parse,
5 )
6 from .common import InfoExtractor
7
8
9 class EHowIE(InfoExtractor):
10 IE_NAME = 'eHow'
11 _VALID_URL = r'https?://(?:www\.)?ehow\.com/[^/_?]*_(?P<id>[0-9]+)'
12 _TEST = {
13 'url': 'http://www.ehow.com/video_12245069_hardwood-flooring-basics.html',
14 'md5': '9809b4e3f115ae2088440bcb4efbf371',
15 'info_dict': {
16 'id': '12245069',
17 'ext': 'flv',
18 'title': 'Hardwood Flooring Basics',
19 'description': '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 'uploader': 'Erick Nathan',
21 }
22 }
23
24 def _real_extract(self, url):
25 video_id = self._match_id(url)
26 webpage = self._download_webpage(url, video_id)
27 video_url = self._search_regex(
28 r'(?:file|source)=(http[^\'"&]*)', webpage, 'video URL')
29 final_url = compat_urllib_parse.unquote(video_url)
30 uploader = self._html_search_meta('uploader', webpage)
31 title = self._og_search_title(webpage).replace(' | eHow', '')
32
33 return {
34 'id': video_id,
35 'url': final_url,
36 'title': title,
37 'thumbnail': self._og_search_thumbnail(webpage),
38 'description': self._og_search_description(webpage),
39 'uploader': uploader,
40 }