]> git.bitcoin.ninja Git - youtube-dl/blob - youtube_dl/extractor/atttechchannel.py
[pornhub] Extract categories and tags (closes #10499)
[youtube-dl] / youtube_dl / extractor / atttechchannel.py
1 from __future__ import unicode_literals
2
3 from .common import InfoExtractor
4 from ..utils import unified_strdate
5
6
7 class ATTTechChannelIE(InfoExtractor):
8     _VALID_URL = r'https?://techchannel\.att\.com/play-video\.cfm/([^/]+/)*(?P<id>.+)'
9     _TEST = {
10         'url': 'http://techchannel.att.com/play-video.cfm/2014/1/27/ATT-Archives-The-UNIX-System-Making-Computers-Easier-to-Use',
11         'info_dict': {
12             'id': '11316',
13             'display_id': 'ATT-Archives-The-UNIX-System-Making-Computers-Easier-to-Use',
14             'ext': 'flv',
15             'title': 'AT&T Archives : The UNIX System: Making Computers Easier to Use',
16             'description': 'A 1982 film about UNIX is the foundation for software in use around Bell Labs and AT&T.',
17             'thumbnail': 're:^https?://.*\.jpg$',
18             'upload_date': '20140127',
19         },
20         'params': {
21             # rtmp download
22             'skip_download': True,
23         },
24     }
25
26     def _real_extract(self, url):
27         display_id = self._match_id(url)
28
29         webpage = self._download_webpage(url, display_id)
30
31         video_url = self._search_regex(
32             r"url\s*:\s*'(rtmp://[^']+)'",
33             webpage, 'video URL')
34
35         video_id = self._search_regex(
36             r'mediaid\s*=\s*(\d+)',
37             webpage, 'video id', fatal=False)
38
39         title = self._og_search_title(webpage)
40         description = self._og_search_description(webpage)
41         thumbnail = self._og_search_thumbnail(webpage)
42         upload_date = unified_strdate(self._search_regex(
43             r'[Rr]elease\s+date:\s*(\d{1,2}/\d{1,2}/\d{4})',
44             webpage, 'upload date', fatal=False), False)
45
46         return {
47             'id': video_id,
48             'display_id': display_id,
49             'url': video_url,
50             'ext': 'flv',
51             'title': title,
52             'description': description,
53             'thumbnail': thumbnail,
54             'upload_date': upload_date,
55         }