]> Raphaƫl G. Git Repositories - youtubedl/blob - youtube_dl/extractor/normalboots.py
Update changelog.
[youtubedl] / youtube_dl / extractor / normalboots.py
1 import re
2
3 from .common import InfoExtractor
4
5 from ..utils import (
6 ExtractorError,
7 unified_strdate,
8 )
9
10 class NormalbootsIE(InfoExtractor):
11 _VALID_URL = r'(?:http://)?(?:www\.)?normalboots\.com/video/(?P<videoid>[0-9a-z-]*)/?$'
12 _TEST = {
13 u'url': u'http://normalboots.com/video/home-alone-games-jontron/',
14 u'file': u'home-alone-games-jontron.mp4',
15 u'md5': u'8bf6de238915dd501105b44ef5f1e0f6',
16 u'info_dict': {
17 u'title': u'Home Alone Games - JonTron - NormalBoots',
18 u'description': u'Jon is late for Christmas. Typical. Thanks to: Paul Ritchey for Co-Writing/Filming: http://www.youtube.com/user/ContinueShow Michael Azzi for Christmas Intro Animation: http://michafrar.tumblr.com/ Jerrod Waters for Christmas Intro Music: http://www.youtube.com/user/xXJerryTerryXx Casey Ormond for \u2018Tense Battle Theme\u2019:\xa0http://www.youtube.com/Kiamet/',
19 u'uploader': u'JonTron',
20 u'upload_date': u'20140125',
21 }
22 }
23
24 def _real_extract(self, url):
25 mobj = re.match(self._VALID_URL, url)
26 if mobj is None:
27 raise ExtractorError(u'Invalid URL: %s' % url)
28 video_id = mobj.group('videoid')
29
30 info = {
31 'id': video_id,
32 'uploader': None,
33 'upload_date': None,
34 }
35
36 if url[:4] != 'http':
37 url = 'http://' + url
38
39 webpage = self._download_webpage(url, video_id)
40 video_title = self._og_search_title(webpage)
41 video_description = self._og_search_description(webpage)
42 video_thumbnail = self._og_search_thumbnail(webpage)
43 video_uploader = self._html_search_regex(r'Posted\sby\s<a\shref="[A-Za-z0-9/]*">(?P<uploader>[A-Za-z]*)\s</a>',
44 webpage, 'uploader')
45 raw_upload_date = self._html_search_regex('<span style="text-transform:uppercase; font-size:inherit;">[A-Za-z]+, (?P<date>.*)</span>',
46 webpage, 'date')
47 video_upload_date = unified_strdate(raw_upload_date)
48 video_upload_date = unified_strdate(raw_upload_date)
49
50 player_url = self._html_search_regex(r'<iframe\swidth="[0-9]+"\sheight="[0-9]+"\ssrc="(?P<url>[\S]+)"', webpage, 'url')
51 player_page = self._download_webpage(player_url, video_id)
52 video_url = u'http://player.screenwavemedia.com/' + self._html_search_regex(r"'file':\s'(?P<file>[0-9A-Za-z-_\.]+)'", player_page, 'file')
53
54 info['url'] = video_url
55 info['title'] = video_title
56 info['description'] = video_description
57 info['thumbnail'] = video_thumbnail
58 info['uploader'] = video_uploader
59 info['upload_date'] = video_upload_date
60
61 return info