From 6766d7d7384f5ff694dd2eac9ab460b59ff43d2f Mon Sep 17 00:00:00 2001 From: Andrew Udvare Date: Tue, 20 Mar 2018 23:52:46 -0400 Subject: [PATCH 01/13] [cheeyvideosnet] Add new extractor --- youtube_dl/extractor/cheekyvideosnet.py | 41 +++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 youtube_dl/extractor/cheekyvideosnet.py diff --git a/youtube_dl/extractor/cheekyvideosnet.py b/youtube_dl/extractor/cheekyvideosnet.py new file mode 100644 index 000000000..cf6be2905 --- /dev/null +++ b/youtube_dl/extractor/cheekyvideosnet.py @@ -0,0 +1,41 @@ +# coding: utf-8 +from __future__ import unicode_literals + +from .common import InfoExtractor + + +class CheekyVideosIE(InfoExtractor): + _VALID_URL = r'https?://(?:www\.)?cheekyvideos\.net/(?P.*)\.html?$' + _TEST = { + 'url': 'https://yourextractor.com/watch/42', + 'md5': 'TODO: md5 sum of the first 10241 bytes of the video file (use --test)', + 'info_dict': { + 'id': '42', + 'ext': 'mp4', + 'title': 'Video title goes here', + 'thumbnail': r're:^https?://.*\.jpg$', + # TODO more properties, either as: + # * A value + # * MD5 checksum; start the string with md5: + # * A regular expression; start the string with re: + # * Any Python type (for example int or float) + } + } + + def _real_extract(self, url): + video_id = self._match_id(url) + webpage = self._download_webpage(url, video_id) + + title = self._html_search_regex(r'

(.+?)

', webpage, 'title') + video_url = self._html_search_regex(r']+.src="(videos/[^"]+)"', webpage, 'url') + uploader = video_id.split('/')[0] + video_id = video_id.split('/')[1] + url = 'https://cheekyvideos.net/%s/%s' % (uploader, video_url) + + return { + 'id': video_id, + 'title': title, + 'description': self._html_search_meta('description', webpage, display_name='description'), + 'uploader': uploader, + 'url': url, + } From 9e8a97c93c35d042db1084a40ddded421f57c9f3 Mon Sep 17 00:00:00 2001 From: Andrew Udvare Date: Tue, 20 Mar 2018 23:53:03 -0400 Subject: [PATCH 02/13] [pewtube] Add new extractor (may not be complete) --- youtube_dl/extractor/pewtube.py | 88 +++++++++++++++++++++++++++++++++ 1 file changed, 88 insertions(+) create mode 100644 youtube_dl/extractor/pewtube.py diff --git a/youtube_dl/extractor/pewtube.py b/youtube_dl/extractor/pewtube.py new file mode 100644 index 000000000..7f683f841 --- /dev/null +++ b/youtube_dl/extractor/pewtube.py @@ -0,0 +1,88 @@ +# coding: utf-8 +from __future__ import unicode_literals +from collections import OrderedDict +from datetime import datetime +import re +import subprocess as sp +import time + +from .common import InfoExtractor +from ..utils import CloudFlareSimpleJSChallengeMixin, int_or_none + + +class PewTubeIE(InfoExtractor, CloudFlareSimpleJSChallengeMixin): + _VALID_URL = r'https?://(?:www\.)?pew\.tube/user/[^/]+/(?P[^/]+)' + _TEST = { + 'url': 'https://pew.tube/user/MrBond/4jLJf06', + 'md5': 'TODO: md5 sum of the first 10241 bytes of the video file (use --test)', + 'info_dict': { + 'id': '4jLJf06', + 'ext': 'mp4', + 'title': 'Mr. Bond - Good Old Nationalist', + 'thumbnail': r're:^https?://.*\.jpg$', + # TODO more properties, either as: + # * A value + # * MD5 checksum; start the string with md5: + # * A regular expression; start the string with re: + # * Any Python type (for example int or float) + } + } + + def set_downloader(self, downloader): + self._downloader = downloader + if downloader: + class Handle503: + def http_error_503(self, request, response, code, msg, hdrs): + return response + self._downloader._opener.handle_error['http'][503] = [Handle503()] + + def _real_extract(self, url): + self._do_cloudflare_challenge('pew.tube', url, secure=True) + + video_id = self._match_id(url) + webpage = self._download_webpage(url, video_id) + + title = self._html_search_regex(r'

]+>([^<]+)

', webpage, 'title') + thumbnail = self._html_search_regex(r'