]> Raphaƫl G. Git Repositories - youtubedl/blob - youtube_dl/extractor/teamfourstar.py
a8c6ed7beb25b49eb6dde31c892b74ca46ca3296
[youtubedl] / youtube_dl / extractor / teamfourstar.py
1 # coding: utf-8
2 from __future__ import unicode_literals
3
4 from .common import InfoExtractor
5 from .jwplatform import JWPlatformIE
6 from ..utils import unified_strdate
7
8
9 class TeamFourStarIE(InfoExtractor):
10 _VALID_URL = r'https?://(?:www\.)?teamfourstar\.com/(?P<id>[a-z0-9\-]+)'
11 _TEST = {
12 'url': 'http://teamfourstar.com/tfs-abridged-parody-episode-1-2/',
13 'info_dict': {
14 'id': '0WdZO31W',
15 'title': 'TFS Abridged Parody Episode 1',
16 'description': 'md5:d60bc389588ebab2ee7ad432bda953ae',
17 'ext': 'mp4',
18 'timestamp': 1394168400,
19 'upload_date': '20080508',
20 },
21 }
22
23 def _real_extract(self, url):
24 display_id = self._match_id(url)
25 webpage = self._download_webpage(url, display_id)
26
27 jwplatform_url = JWPlatformIE._extract_url(webpage)
28
29 video_title = self._html_search_regex(
30 r'<h1[^>]+class="entry-title"[^>]*>(?P<title>.+?)</h1>',
31 webpage, 'title')
32 video_date = unified_strdate(self._html_search_regex(
33 r'<span[^>]+class="meta-date date updated"[^>]*>(?P<date>.+?)</span>',
34 webpage, 'date', fatal=False))
35 video_description = self._html_search_regex(
36 r'(?s)<div[^>]+class="content-inner"[^>]*>.*?(?P<description><p>.+?)</div>',
37 webpage, 'description', fatal=False)
38 video_thumbnail = self._og_search_thumbnail(webpage)
39
40 return {
41 '_type': 'url_transparent',
42 'display_id': display_id,
43 'title': video_title,
44 'description': video_description,
45 'upload_date': video_date,
46 'thumbnail': video_thumbnail,
47 'url': jwplatform_url,
48 }