]> Raphaƫl G. Git Repositories - youtubedl/blob - youtube_dl/extractor/pornotube.py
Clarify use of mplayer.
[youtubedl] / youtube_dl / extractor / pornotube.py
1 import re
2
3 from .common import InfoExtractor
4 from ..utils import (
5 compat_urllib_parse,
6
7 unified_strdate,
8 )
9
10
11 class PornotubeIE(InfoExtractor):
12 _VALID_URL = r'^(?:https?://)?(?:\w+\.)?pornotube\.com(/c/(?P<channel>[0-9]+))?(/m/(?P<videoid>[0-9]+))(/(?P<title>.+))$'
13
14 def _real_extract(self, url):
15 mobj = re.match(self._VALID_URL, url)
16
17 video_id = mobj.group('videoid')
18 video_title = mobj.group('title')
19
20 # Get webpage content
21 webpage = self._download_webpage(url, video_id)
22
23 # Get the video URL
24 VIDEO_URL_RE = r'url: "(?P<url>http://video[0-9].pornotube.com/.+\.flv)",'
25 video_url = self._search_regex(VIDEO_URL_RE, webpage, u'video url')
26 video_url = compat_urllib_parse.unquote(video_url)
27
28 #Get the uploaded date
29 VIDEO_UPLOADED_RE = r'<div class="video_added_by">Added (?P<date>[0-9\/]+) by'
30 upload_date = self._html_search_regex(VIDEO_UPLOADED_RE, webpage, u'upload date', fatal=False)
31 if upload_date: upload_date = unified_strdate(upload_date)
32
33 info = {'id': video_id,
34 'url': video_url,
35 'uploader': None,
36 'upload_date': upload_date,
37 'title': video_title,
38 'ext': 'flv',
39 'format': 'flv'}
40
41 return [info]