From e591fa4b338cafdff88e51d531ddf521e8c2595a Mon Sep 17 00:00:00 2001 From: Sarbajit Saha Date: Mon, 8 May 2017 14:57:54 +0530 Subject: [PATCH 1/2] NonkTube Add new extractor --- youtube_dl/extractor/extractors.py | 1 + youtube_dl/extractor/nonktube.py | 53 ++++++++++++++++++++++++++++++ 2 files changed, 54 insertions(+) create mode 100644 youtube_dl/extractor/nonktube.py diff --git a/youtube_dl/extractor/extractors.py b/youtube_dl/extractor/extractors.py index 1d7495910..968cca9d2 100644 --- a/youtube_dl/extractor/extractors.py +++ b/youtube_dl/extractor/extractors.py @@ -663,6 +663,7 @@ from .nintendo import NintendoIE from .njpwworld import NJPWWorldIE from .nobelprize import NobelPrizeIE from .noco import NocoIE +from .nonktube import NonkTubeIE from .noovo import NoovoIE from .normalboots import NormalbootsIE from .nosvideo import NosVideoIE diff --git a/youtube_dl/extractor/nonktube.py b/youtube_dl/extractor/nonktube.py new file mode 100644 index 000000000..df0cf48c4 --- /dev/null +++ b/youtube_dl/extractor/nonktube.py @@ -0,0 +1,53 @@ +# coding: utf-8 +from __future__ import unicode_literals + +from .common import InfoExtractor + +import re + + +class NonkTubeIE(InfoExtractor): + _VALID_URL = r'https?:\/\/(?:www\.)?nonktube\.com\/video\/(?P[0-9]+)\/[0-9a-zA-Z\-]*' + _TESTS = [{ + 'url': 'https://www.nonktube.com/video/118636/sensual-wife-uncensored-fucked-in-hairy-pussy-and-facialized', + 'md5': 'ccd2df2aef9f44e51773c8ea59de6fd1', + 'info_dict': { + 'id': '118636', + 'ext': 'mp4', + 'title': 'Sensual Wife Uncensored Fucked In Hairy Pussy And Facialized', + 'thumbnail': 'https://www.nonktube.com/media/videos/tmb_2/118636/default.jpg', + } + }, { + 'url': 'https://www.nonktube.com/video/118698/2-japanese-girls-sharing-one-dick-uncesnored', + 'md5': 'bb4bdd0a61f591e2f5f7429dc860327e', + 'info_dict': { + 'id': '118698', + 'ext': 'mp4', + 'title': '2 Japanese Girls Sharing One Dick Uncesnored', + 'thumbnail': 'https://www.nonktube.com/media/videos/tmb_2/118698/default.jpg', + } + }] + + def _real_extract(self, url): + mobj = re.match(self._VALID_URL, url) + + video_id = mobj.group('id') + webpage = self._download_webpage(url, video_id) + + title = self._html_search_regex( + [r'(.+?)(?: - NonkTube.com)'], + webpage, 'title') + + thumbnail = self._html_search_regex( + [r'' + re.escape(title) + r')'], + webpage, 'thumbnail', fatal=False) + + video_download_url = "https://cdn.nonktube.com/" + video_id + ".mp4" + + return { + 'id': video_id, + 'title': title, + 'thumbnail': thumbnail, + 'url': video_download_url, + 'ext': 'mp4', + } From d0ee1707638a1bddffc078c25a3f49f0642826f8 Mon Sep 17 00:00:00 2001 From: Sarbajit Saha Date: Mon, 8 May 2017 16:36:20 +0530 Subject: [PATCH 2/2] added more options for title extraction and added uploader and age limit fields --- youtube_dl/extractor/nonktube.py | 35 +++++++++++++++++++++++--------- 1 file changed, 25 insertions(+), 10 deletions(-) diff --git a/youtube_dl/extractor/nonktube.py b/youtube_dl/extractor/nonktube.py index df0cf48c4..6910e3cef 100644 --- a/youtube_dl/extractor/nonktube.py +++ b/youtube_dl/extractor/nonktube.py @@ -2,12 +2,11 @@ from __future__ import unicode_literals from .common import InfoExtractor - import re class NonkTubeIE(InfoExtractor): - _VALID_URL = r'https?:\/\/(?:www\.)?nonktube\.com\/video\/(?P[0-9]+)\/[0-9a-zA-Z\-]*' + _VALID_URL = r'https?://(?:www\.)?nonktube\.com\/video/(?P[0-9]+)/[0-9a-zA-Z\-]*' _TESTS = [{ 'url': 'https://www.nonktube.com/video/118636/sensual-wife-uncensored-fucked-in-hairy-pussy-and-facialized', 'md5': 'ccd2df2aef9f44e51773c8ea59de6fd1', @@ -16,6 +15,8 @@ class NonkTubeIE(InfoExtractor): 'ext': 'mp4', 'title': 'Sensual Wife Uncensored Fucked In Hairy Pussy And Facialized', 'thumbnail': 'https://www.nonktube.com/media/videos/tmb_2/118636/default.jpg', + 'uploader': 'https://www.nonktube.com/user/cumdrinkingwife', + 'age_limit': 18 } }, { 'url': 'https://www.nonktube.com/video/118698/2-japanese-girls-sharing-one-dick-uncesnored', @@ -25,29 +26,43 @@ class NonkTubeIE(InfoExtractor): 'ext': 'mp4', 'title': '2 Japanese Girls Sharing One Dick Uncesnored', 'thumbnail': 'https://www.nonktube.com/media/videos/tmb_2/118698/default.jpg', + 'uploader': 'https://www.nonktube.com/user/cumdrinkingwife', + 'age_limit': 18 } }] + DOWNLOAD_URL_TEMPLATE = 'https://cdn.nonktube.com/%s.mp4' + UPLOADER_URL_TEMPLATE = 'https://www.nonktube.com/user/%s' def _real_extract(self, url): - mobj = re.match(self._VALID_URL, url) + video_id = self._match_id(url) - video_id = mobj.group('id') webpage = self._download_webpage(url, video_id) + video_url = self.DOWNLOAD_URL_TEMPLATE % str(video_id) + title = self._html_search_regex( - [r'(.+?)(?: - NonkTube.com)'], - webpage, 'title') + [r'(?P<title>.+?) - NonkTube.com', + r'

(?P.+?)</h1>'], webpage, 'title', group='title') thumbnail = self._html_search_regex( - [r'<img src="(.+?)(?:" title="' + re.escape(title) + r'" alt="' + re.escape(title) + r'" width="160" height="120" />)'], - webpage, 'thumbnail', fatal=False) + [r'<img src="(?P<thumbnail>.+?)" title="' + re.escape(title) + r'" alt="' + re.escape(title) + r'" width="[0-9]*" height="[0-9]*" />'], + webpage, 'thumbnail', fatal=False, group='thumbnail') - video_download_url = "https://cdn.nonktube.com/" + video_id + ".mp4" + # only one link of format /user/ is present in every video which gives the uploader username + uploader = self._html_search_regex( + [r'<a href="/user/(?P<uploader_id>[0-9A-Za-z]+?)">'], + webpage, 'uploader', fatal=False, group='uploader_id') + if uploader is not None: + uploader = self.UPLOADER_URL_TEMPLATE % uploader + + age_limit = 18 return { 'id': video_id, 'title': title, + 'uploader': uploader, 'thumbnail': thumbnail, - 'url': video_download_url, + 'url': video_url, + 'age_limit': age_limit, 'ext': 'mp4', }