1
0
Fork 0
mirror of https://gitlab.com/dstftw/youtube-dl.git synced 2020-11-16 09:42:26 +00:00

Clean up porno IEs

This commit is contained in:
Philipp Hagemeister 2013-01-12 15:17:04 +01:00
parent 6017964580
commit 565f751967

View file

@ -3732,29 +3732,9 @@ class YouPornIE(InfoExtractor):
def __init__(self, downloader=None): def __init__(self, downloader=None):
InfoExtractor.__init__(self, downloader) InfoExtractor.__init__(self, downloader)
# def report_id(self, video_id):
# """Report finding video ID"""
# self._downloader.to_screen(u'[youporn] Video ID: %s' % video_id)
# def report_webpage(self, url):
# """Report downloading page"""
# self._downloader.to_screen(u'[youporn] Downloaded page: %s' % url)
# def report_title(self, video_title):
# """Report dfinding title"""
# self._downloader.to_screen(u'[youporn] Title: %s' % video_title)
# def report_uploader(self, uploader):
# """Report dfinding title"""
# self._downloader.to_screen(u'[youporn] Uploader: %s' % uploader)
# def report_upload_date(self, video_date):
# """Report finding date"""
# self._downloader.to_screen(u'[youporn] Date: %s' % video_date)
def _print_formats(self, formats): def _print_formats(self, formats):
"""Print all available formats""" """Print all available formats"""
print('Available formats:') print(u'Available formats:')
print(u'ext\t\tformat') print(u'ext\t\tformat')
print(u'---------------------------------') print(u'---------------------------------')
for format in formats: for format in formats:
@ -3773,10 +3753,8 @@ class YouPornIE(InfoExtractor):
return return
video_id = mobj.group('videoid') video_id = mobj.group('videoid')
#self.report_id(video_id)
webpage = self._download_webpage(url, video_id) webpage = self._download_webpage(url, video_id)
#self.report_webpage(url)
# Get the video title # Get the video title
VIDEO_TITLE_RE = r'videoTitleArea">(?P<title>.*)</h1>' VIDEO_TITLE_RE = r'videoTitleArea">(?P<title>.*)</h1>'
@ -3785,7 +3763,6 @@ class YouPornIE(InfoExtractor):
self._downloader.trouble(u'ERROR: unable to extract video title') self._downloader.trouble(u'ERROR: unable to extract video title')
return return
video_title = result.group('title').strip() video_title = result.group('title').strip()
#self.report_title(video_title)
# Get the video date # Get the video date
VIDEO_DATE_RE = r'Date:</b>(?P<date>.*)</li>' VIDEO_DATE_RE = r'Date:</b>(?P<date>.*)</li>'
@ -3794,7 +3771,6 @@ class YouPornIE(InfoExtractor):
self._downloader.trouble(u'ERROR: unable to extract video date') self._downloader.trouble(u'ERROR: unable to extract video date')
return return
upload_date = result.group('date').strip() upload_date = result.group('date').strip()
#self.report_upload_date(upload_date)
# Get the video uploader # Get the video uploader
VIDEO_UPLOADER_RE = r'Submitted:</b>(?P<uploader>.*)</li>' VIDEO_UPLOADER_RE = r'Submitted:</b>(?P<uploader>.*)</li>'
@ -3804,7 +3780,6 @@ class YouPornIE(InfoExtractor):
return return
video_uploader = result.group('uploader').strip() video_uploader = result.group('uploader').strip()
video_uploader = clean_html( video_uploader ) video_uploader = clean_html( video_uploader )
#self.report_uploader(video_uploader)
# Get all of the formats available # Get all of the formats available
DOWNLOAD_LIST_RE = r'(?s)<ul class="downloadList">(?P<download_list>.*?)</ul>' DOWNLOAD_LIST_RE = r'(?s)<ul class="downloadList">(?P<download_list>.*?)</ul>'
@ -3857,10 +3832,8 @@ class YouPornIE(InfoExtractor):
return return
req_format = self._downloader.params.get('format', None) req_format = self._downloader.params.get('format', None)
#format_limit = self._downloader.params.get('format_limit', None)
self._downloader.to_screen(u'[youporn] Format: %s' % req_format) self._downloader.to_screen(u'[youporn] Format: %s' % req_format)
if req_format is None or req_format == 'best': if req_format is None or req_format == 'best':
return [formats[0]] return [formats[0]]
elif req_format == 'worst': elif req_format == 'worst':
@ -3878,28 +3851,8 @@ class YouPornIE(InfoExtractor):
class PornotubeIE(InfoExtractor): class PornotubeIE(InfoExtractor):
"""Information extractor for pornotube.com.""" """Information extractor for pornotube.com."""
_VALID_URL = r'^(?:https?://)?(?:\w+\.)?pornotube\.com(/c/(?P<channel>[0-9]+))?(/m/(?P<videoid>[0-9]+))(/(?P<title>.+))$' _VALID_URL = r'^(?:https?://)?(?:\w+\.)?pornotube\.com(/c/(?P<channel>[0-9]+))?(/m/(?P<videoid>[0-9]+))(/(?P<title>.+))$'
# def __init__(self, downloader=None):
# InfoExtractor.__init__(self, downloader)
# def report_extract_entry(self, url):
# """Report downloading extry"""
# self._downloader.to_screen(u'[pornotube] Downloading entry: %s' % url.decode('utf-8'))
# def report_date(self, upload_date):
# """Report finding uploaded date"""
# self._downloader.to_screen(u'[pornotube] Entry date: %s' % upload_date)
# def report_webpage(self, url):
# """Report downloading page"""
# self._downloader.to_screen(u'[pornotube] Downloaded page: %s' % url)
# def report_title(self, video_title):
# """Report downloading extry"""
# self._downloader.to_screen(u'[pornotube] Title: %s' % video_title.decode('utf-8'))
def _real_extract(self, url): def _real_extract(self, url):
mobj = re.match(self._VALID_URL, url) mobj = re.match(self._VALID_URL, url)
if mobj is None: if mobj is None:
@ -3908,11 +3861,9 @@ class PornotubeIE(InfoExtractor):
video_id = mobj.group('videoid') video_id = mobj.group('videoid')
video_title = mobj.group('title') video_title = mobj.group('title')
#self.report_title(video_title);
# Get webpage content # Get webpage content
webpage = self._download_webpage(url, video_id) webpage = self._download_webpage(url, video_id)
#self.report_webpage(url)
# Get the video URL # Get the video URL
VIDEO_URL_RE = r'url: "(?P<url>http://video[0-9].pornotube.com/.+\.flv)",' VIDEO_URL_RE = r'url: "(?P<url>http://video[0-9].pornotube.com/.+\.flv)",'
@ -3921,7 +3872,6 @@ class PornotubeIE(InfoExtractor):
self._downloader.trouble(u'ERROR: unable to extract video url') self._downloader.trouble(u'ERROR: unable to extract video url')
return return
video_url = compat_urllib_parse.unquote(result.group('url')) video_url = compat_urllib_parse.unquote(result.group('url'))
#self.report_extract_entry(video_url)
#Get the uploaded date #Get the uploaded date
VIDEO_UPLOADED_RE = r'<div class="video_added_by">Added (?P<date>[0-9\/]+) by' VIDEO_UPLOADED_RE = r'<div class="video_added_by">Added (?P<date>[0-9\/]+) by'
@ -3930,7 +3880,6 @@ class PornotubeIE(InfoExtractor):
self._downloader.trouble(u'ERROR: unable to extract video title') self._downloader.trouble(u'ERROR: unable to extract video title')
return return
upload_date = result.group('date') upload_date = result.group('date')
#self.report_date(upload_date);
info = {'id': video_id, info = {'id': video_id,
'url': video_url, 'url': video_url,
@ -3938,10 +3887,7 @@ class PornotubeIE(InfoExtractor):
'upload_date': upload_date, 'upload_date': upload_date,
'title': video_title, 'title': video_title,
'ext': 'flv', 'ext': 'flv',
'format': 'flv', 'format': 'flv'}
'thumbnail': None,
'description': None,
'player_url': None}
return [info] return [info]
@ -3949,28 +3895,11 @@ class PornotubeIE(InfoExtractor):
class YouJizzIE(InfoExtractor): class YouJizzIE(InfoExtractor):
"""Information extractor for youjizz.com.""" """Information extractor for youjizz.com."""
_VALID_URL = r'^(?:https?://)?(?:\w+\.)?youjizz\.com/videos/(?P<videoid>[^.]+).html$' _VALID_URL = r'^(?:https?://)?(?:\w+\.)?youjizz\.com/videos/(?P<videoid>[^.]+).html$'
def __init__(self, downloader=None): def __init__(self, downloader=None):
InfoExtractor.__init__(self, downloader) InfoExtractor.__init__(self, downloader)
# def report_extract_entry(self, url):
# """Report downloading extry"""
# self._downloader.to_screen(u'[youjizz] Downloading entry: %s' % url.decode('utf-8'))
# def report_webpage(self, url):
# """Report downloading page"""
# self._downloader.to_screen(u'[youjizz] Downloaded page: %s' % url)
# def report_title(self, video_title):
# """Report downloading extry"""
# self._downloader.to_screen(u'[youjizz] Title: %s' % video_title.decode('utf-8'))
# def report_embed_page(self, embed_page):
# """Report downloading extry"""
# self._downloader.to_screen(u'[youjizz] Embed Page: %s' % embed_page.decode('utf-8'))
def _real_extract(self, url): def _real_extract(self, url):
mobj = re.match(self._VALID_URL, url) mobj = re.match(self._VALID_URL, url)
if mobj is None: if mobj is None:
@ -3981,7 +3910,6 @@ class YouJizzIE(InfoExtractor):
# Get webpage content # Get webpage content
webpage = self._download_webpage(url, video_id) webpage = self._download_webpage(url, video_id)
#self.report_webpage(url)
# Get the video title # Get the video title
VIDEO_TITLE_RE = r'<title>(?P<title>.*)</title>' VIDEO_TITLE_RE = r'<title>(?P<title>.*)</title>'
@ -3990,7 +3918,6 @@ class YouJizzIE(InfoExtractor):
self._downloader.trouble(u'ERROR: unable to extract video title') self._downloader.trouble(u'ERROR: unable to extract video title')
return return
video_title = result.group('title').strip() video_title = result.group('title').strip()
#self.report_title(video_title)
# Get the embed page # Get the embed page
EMBED_PAGE_RE = r'http://www.youjizz.com/videos/embed/(?P<videoid>[0-9]+)' EMBED_PAGE_RE = r'http://www.youjizz.com/videos/embed/(?P<videoid>[0-9]+)'
@ -4001,7 +3928,6 @@ class YouJizzIE(InfoExtractor):
embed_page_url = result.group(0).strip() embed_page_url = result.group(0).strip()
video_id = result.group('videoid') video_id = result.group('videoid')
#self.report_embed_page(embed_page_url)
webpage = self._download_webpage(embed_page_url, video_id) webpage = self._download_webpage(embed_page_url, video_id)
@ -4012,7 +3938,6 @@ class YouJizzIE(InfoExtractor):
self._downloader.trouble(u'ERROR: unable to extract video url') self._downloader.trouble(u'ERROR: unable to extract video url')
return return
video_url = result.group('source') video_url = result.group('source')
#self.report_extract_entry(video_url)
info = {'id': video_id, info = {'id': video_id,
'url': video_url, 'url': video_url,