1
0
mirror of https://codeberg.org/polarisfm/youtube-dl synced 2025-02-17 01:17:54 +01:00
make parameters like uploader optional if not available
implement djivideos extractor
change skypixel extractor so it uses djivideos as a generic embed
This commit is contained in:
Loknar 2017-09-12 23:31:37 +00:00
parent 45bc915507
commit 05a0e8fb1e
3 changed files with 75 additions and 28 deletions

View File

@ -0,0 +1,59 @@
# coding: utf-8
from __future__ import unicode_literals
from .common import InfoExtractor
class DJIVideosIE(InfoExtractor):
"""InfoExtractor for djivideos.com"""
_VALID_URL = r'https?://(?:www\.)?djivideos\.com/video_play/(?P<id>[^&#]+)'
_TESTS = [
{
'url': 'https://www.djivideos.com/video_play/3d844cad-c722-4fdb-a270-a588d2ff6245',
'info_dict': {
'id': '3d844cad-c722-4fdb-a270-a588d2ff6245',
# 'md5': 'b7d012bfd1a9a3bb5dbe0a3e32e48d28',
'ext': 'mp4',
'title': 'djivideos-3d844cad-c722-4fdb-a270-a588d2ff6245',
'thumbnail': 'http://dn-djidl2.qbox.me/cloud/c89382b0b8dc75ea9f07354e098e0971/2.jpg',
}
},
{
'url': 'https://www.djivideos.com/video_play/02a59336-89bc-43f1-920d-40b24d96407a',
'info_dict': {
'id': '02a59336-89bc-43f1-920d-40b24d96407a',
# 'md5': '7b2edcf58ddd0d14ef08bd73f8630929',
'ext': 'mp4',
'title': 'djivideos-02a59336-89bc-43f1-920d-40b24d96407a',
'thumbnail': 'http://dn-djidl2.qbox.me/cloud/3c1a3aea1bdc042362a36ed482edb3ae/2.jpg',
}
}
]
def _real_extract(self, url):
video_id = self._match_id(url)
webpage = self._download_webpage(url, video_id)
title = 'djivideos-%s' % (video_id, )
video_definitions_json = self._simple_search_between(
webpage, u'JSON.parse(\'', u'\');')
assert(video_definitions_json is not None)
video_definitions = self._parse_json(video_definitions_json, video_id)
video_url = video_definitions[-1]['src']
video_url_params = video_url.find('?sign=')
if video_url_params != -1:
video_url = video_url[:video_url_params]
thumbnail = self._simple_search_between(
webpage, u'poster: "', u'",')
if thumbnail is not None:
url_params = thumbnail.find('?sign=')
if url_params != -1:
thumbnail = thumbnail[:url_params]
return {
'id': video_id,
'url': video_url,
'ext': 'mp4',
'title': title,
'thumbnail': thumbnail,
}

View File

@ -291,6 +291,7 @@ from .discoverynetworks import DiscoveryNetworksDeIE
from .discoveryvr import DiscoveryVRIE from .discoveryvr import DiscoveryVRIE
from .disney import DisneyIE from .disney import DisneyIE
from .dispeak import DigitallySpeakingIE from .dispeak import DigitallySpeakingIE
from .djivideos import DJIVideosIE
from .dropbox import DropboxIE from .dropbox import DropboxIE
from .dw import ( from .dw import (
DWIE, DWIE,

View File

@ -5,35 +5,33 @@ from .common import InfoExtractor
class SkypixelIE(InfoExtractor): class SkypixelIE(InfoExtractor):
"""InfoExtractor for Skypixel.com""" """InfoExtractor for skypixel.com (generic embed for djivideos)"""
_VALID_URL = r'https?://(?:www\.)?skypixel\.com/share/video/(?P<id>[^&#]+)' _VALID_URL = r'https?://(?:www\.)?skypixel\.com/share/video/(?P<id>[^&#]+)'
_TESTS = [ _TESTS = [
{ {
'url': 'https://skypixel.com/share/video/check-out-my-latest-artwork-4f90b8ac-e7c3-4ed8-82c2-203addfd629e', 'url': 'https://skypixel.com/share/video/check-out-my-latest-artwork-4f90b8ac-e7c3-4ed8-82c2-203addfd629e',
'info_dict': { 'info_dict': {
'id': 'check-out-my-latest-artwork-4f90b8ac-e7c3-4ed8-82c2-203addfd629e', 'id': '3d844cad-c722-4fdb-a270-a588d2ff6245',
'url': 'http://dn-djidl2.qbox.me/cloud/c89382b0b8dc75ea9f07354e098e0971/720.mp4',
'ext': 'mp4', 'ext': 'mp4',
'title': 'Check out my latest artwork!', 'title': 'Check out my latest artwork!',
'uploader': 'Alby98', 'uploader': 'Alby98',
'thumbnail': 'http://dn-djidl2.qbox.me/cloud/c89382b0b8dc75ea9f07354e098e0971/2.jpg',
}, },
'params': { 'params': {
'noplaylist': True,
'skip_download': True, 'skip_download': True,
} }
}, },
{ {
'url': 'https://www.skypixel.com/share/video/undirfellsrett-i-vatnsdal-8-9-2017', 'url': 'https://www.skypixel.com/share/video/undirfellsrett-i-vatnsdal-8-9-2017',
'info_dict': { 'info_dict': {
'id': 'undirfellsrett-i-vatnsdal-8-9-2017', 'id': '02a59336-89bc-43f1-920d-40b24d96407a',
'url': 'http://dn-djidl2.qbox.me/cloud/3c1a3aea1bdc042362a36ed482edb3ae/1080.mp4',
'ext': 'mp4', 'ext': 'mp4',
'title': 'Undirfellsrétt í Vatnsdal 8/9/2017', 'title': 'Undirfellsrétt í Vatnsdal 8/9/2017',
'uploader': 'Flokmundur', 'uploader': 'Flokmundur',
'thumbnail': 'http://dn-djidl2.qbox.me/cloud/3c1a3aea1bdc042362a36ed482edb3ae/2.jpg',
}, },
'params': { 'params': {
'noplaylist': True,
'skip_download': True, 'skip_download': True,
} }
} }
@ -42,33 +40,22 @@ class SkypixelIE(InfoExtractor):
def _real_extract(self, url): def _real_extract(self, url):
video_id = self._match_id(url) video_id = self._match_id(url)
webpage = self._download_webpage(url, video_id) webpage = self._download_webpage(url, video_id)
title = self._og_search_title(webpage).strip() title = self._og_search_title(webpage).strip().replace(' | SkyPixel.com', '')
title = title.replace(' | SkyPixel.com', '')
uploader = self._simple_search_between( uploader = self._simple_search_between(
webpage, u'<span itemprop="author">', u'</span>') webpage, u'<span itemprop="author">', u'</span>')
assert(uploader is not None) url = self._simple_search_between(
djivideos_url = self._simple_search_between(
webpage, u'<iframe frameborder="0" scrolling="no" src="', u'">') webpage, u'<iframe frameborder="0" scrolling="no" src="', u'">')
assert(djivideos_url is not None) assert(url is not None)
djivideos_webpage = self._download_webpage( url_params = url.find('?autoplay=')
djivideos_url, 'djivideos.com[%s]' % (video_id, )) if url_params != -1:
video_definitions_json = self._simple_search_between( url = url[:url_params]
djivideos_webpage, u'JSON.parse(\'', u'\');')
assert(video_definitions_json is not None)
video_definitions = self._parse_json(video_definitions_json, video_id)
video_url = video_definitions[-1]['src']
thumbnail = self._simple_search_between(
djivideos_webpage, u'poster: "', u'",')
if thumbnail is not None:
url_params_start = thumbnail.find('?sign=')
if url_params_start != -1:
thumbnail = thumbnail[:url_params_start]
return { return {
'_type': 'url_transparent',
'ie_key': 'DJIVideos',
'id': video_id, 'id': video_id,
'url': video_url, 'url': url,
'ext': 'mp4', 'ext': 'mp4',
'title': title, 'title': title,
'uploader': uploader, 'uploader': uploader
'thumbnail': thumbnail,
} }