From cb6aa8907effcf2d87d5ab285a991487a0f06bce Mon Sep 17 00:00:00 2001 From: zgvidwck Date: Wed, 14 Jun 2017 22:12:14 +0800 Subject: [PATCH 1/2] [bitporno] Add new extractor --- youtube_dl/extractor/bitporno.py | 37 ++++++++++++++++++++++++++++++ youtube_dl/extractor/extractors.py | 1 + 2 files changed, 38 insertions(+) create mode 100644 youtube_dl/extractor/bitporno.py diff --git a/youtube_dl/extractor/bitporno.py b/youtube_dl/extractor/bitporno.py new file mode 100644 index 000000000..3a3d49d49 --- /dev/null +++ b/youtube_dl/extractor/bitporno.py @@ -0,0 +1,37 @@ +# coding: utf-8 +from __future__ import unicode_literals + +from .common import InfoExtractor +from ..utils import ExtractorError + + +class BitpornoIE(InfoExtractor): + _VALID_URL = r'https?://(?:www\.)?bitporno\.com/\?v=(?P\w+)' + _TEST = { + 'url': 'https://www.bitporno.com/?v=FGJWRHQKWB', + 'info_dict': { + 'id': 'FGJWRHQKWB', + 'title': 'SpyFam 2017 06 12 Lana Rhoades XXX 1080p MP4-KTR', + 'ext': 'mp4', + }, + } + + def _real_extract(self, url): + video_id = self._match_id(url) + webpage = self._download_webpage(url, video_id) + + self.report_extraction(video_id) + + # There were 1080p videos in Bitporno.com. It seems there've gone. + # Now there are still 360/480/720p, this extractor only support 720p. + # 2017.06 + tmp_str = self._html_search_regex(r'"file":"(https:.*?\.mp4)","label":"720p"', webpage, 'file_720p') + if not tmp_str: + raise ExtractorError('Note: this Bitporno extractor only support 720p videos.') + true_url = tmp_str[tmp_str.rfind('https'):].replace("\\", "") + print('Note: this Bitporno extractor only support 720p videos.\nVideo url: ' + true_url) + return { + 'id': video_id, + 'title': self._og_search_title(webpage), + 'url': true_url, + } diff --git a/youtube_dl/extractor/extractors.py b/youtube_dl/extractor/extractors.py index 7e45232dd..e14242601 100644 --- a/youtube_dl/extractor/extractors.py +++ b/youtube_dl/extractor/extractors.py @@ -115,6 +115,7 @@ from .bilibili import ( ) from .biobiochiletv import BioBioChileTVIE from .biqle import BIQLEIE +from .bitporno import BitpornoIE from .bleacherreport import ( BleacherReportIE, BleacherReportCMSIE, From fc42d22abad0719ac5724be70f4dfd1dcdbe6609 Mon Sep 17 00:00:00 2001 From: zgvidwck Date: Wed, 14 Jun 2017 22:29:33 +0800 Subject: [PATCH 2/2] [bitporno] Add new extractor --- youtube_dl/extractor/bitporno.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/youtube_dl/extractor/bitporno.py b/youtube_dl/extractor/bitporno.py index 3a3d49d49..1385039f3 100644 --- a/youtube_dl/extractor/bitporno.py +++ b/youtube_dl/extractor/bitporno.py @@ -29,9 +29,10 @@ class BitpornoIE(InfoExtractor): if not tmp_str: raise ExtractorError('Note: this Bitporno extractor only support 720p videos.') true_url = tmp_str[tmp_str.rfind('https'):].replace("\\", "") - print('Note: this Bitporno extractor only support 720p videos.\nVideo url: ' + true_url) + # print('Note: this Bitporno extractor only support 720p videos.\nVideo url: ' + true_url) return { 'id': video_id, - 'title': self._og_search_title(webpage), + 'title': self._og_search_title(webpage) or \ + self._html_search_regex(r'(.+?)', webpage, 'title'), 'url': true_url, }