From c754794071865101d37fbb8638ec5c3e8ec8d2d4 Mon Sep 17 00:00:00 2001 From: nekobit1 Date: Sat, 2 Feb 2019 09:27:22 -0500 Subject: [PATCH] [mp4upload] Add new extractor --- youtube_dl/extractor/extractors.py | 1 + youtube_dl/extractor/mp4upload.py | 39 ++++++++++++++++++++++++++++++ 2 files changed, 40 insertions(+) create mode 100644 youtube_dl/extractor/mp4upload.py diff --git a/youtube_dl/extractor/extractors.py b/youtube_dl/extractor/extractors.py index b40be42e6..e10ca2dff 100644 --- a/youtube_dl/extractor/extractors.py +++ b/youtube_dl/extractor/extractors.py @@ -673,6 +673,7 @@ from .motorsport import MotorsportIE from .movieclips import MovieClipsIE from .moviezine import MoviezineIE from .movingimage import MovingImageIE +from .mp4upload import MP4UploadIE from .msn import MSNIE from .mtv import ( MTVIE, diff --git a/youtube_dl/extractor/mp4upload.py b/youtube_dl/extractor/mp4upload.py new file mode 100644 index 000000000..a91d5b094 --- /dev/null +++ b/youtube_dl/extractor/mp4upload.py @@ -0,0 +1,39 @@ +# coding: utf-8 +from __future__ import unicode_literals + +from .common import InfoExtractor +import re + +class MP4UploadIE(InfoExtractor): + _VALID_URL = r'https?://(?:www\.)?mp4upload\.com/embed-(?P[a-z0-9]+).html' + _TEST = { + 'url': 'https://mp4upload.com/embed-4d25ernqkj91.html', + 'info_dict': { + 'id': '4d25ernqkj91', + 'ext': 'mp4', + 'title': '4d25ernqkj91' + } + } + + def _real_extract(self, url): + video_id = self._match_id(url) + webpage = self._download_webpage(url, video_id) + + title = video_id + + # Needed for both port and full video id + videohotlink = re.findall(r'\|video\|(.*?)\|(.*?)\|', webpage) + + # All the info we actually need in its order + subdomain = re.search(r'\|([^\|]*?)\|complete\|', webpage).group(1) + port = [x[1] for x in videohotlink][0] + fullid = [x[0] for x in videohotlink][0] + + # Compile full domain + theurl = "https://"+subdomain+".mp4upload.com:"+port+"/d/"+fullid+"/video.mp4" + + return { + 'id': video_id, + 'title': title, + 'url': theurl + } \ No newline at end of file