[nick] Add support for beta.nick.com (closes #11655)

This commit is contained in:
Sergey M․ 2017-01-10 22:32:34 +07:00 committed by motophil
parent 0485622b75
commit 46a83648e7
3 changed files with 55 additions and 1 deletions

View File

@ -330,6 +330,7 @@ from .gameone import (
from .gamersyde import GamersydeIE from .gamersyde import GamersydeIE
from .gamespot import GameSpotIE from .gamespot import GameSpotIE
from .gamestar import GameStarIE from .gamestar import GameStarIE
from .gaskrank import GaskrankIE
from .gazeta import GazetaIE from .gazeta import GazetaIE
from .gdcvault import GDCVaultIE from .gdcvault import GDCVaultIE
from .generic import GenericIE from .generic import GenericIE

View File

@ -0,0 +1,50 @@
# coding: utf-8
from __future__ import unicode_literals
import re
from .common import InfoExtractor
from ..utils import js_to_json
class GaskrankIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?gaskrank\.tv/tv(?:/[^/]+)+/(?P<id>[^/]+)\.htm'
_TEST = {
'url': 'http://www.gaskrank.tv/tv/motorrad-fun/strike-einparken-durch-anfaenger-crash-mit-groesserem-flurschaden.htm',
'md5': '200e28a405f6919b914a83f8adfc5739',
'info_dict': {
'id': '201601/26955',
'ext': 'mp4',
'title': 'Strike! Einparken können nur Männer - Flurschaden hält sich in Grenzen *lol*',
'thumbnail': r're:^https?://.*\.jpg$',
}
}
def _real_extract(self, url):
def fix_json(code):
return re.sub(r'}[\s]*?,[\s]*?}', r'}}', js_to_json(code))
display_id = self._match_id(url)
webpage = self._download_webpage(url, display_id)
video_id = self._search_regex(r'https?://movies\.gaskrank\.tv/([^-]*?)\.mp4', webpage, 'video id')
categories = self._search_regex(r'https?://(?:www\.)?gaskrank\.tv/tv(?:/([^/]+))+/[^/]+\.htm', url, 'categories', default=None)
title = self._search_regex(r'movieName[^\']*?\'([^\']*?)\'', webpage, 'title')
thumbnail = self._search_regex(r'poster[^\']*?\'([^\']*?)\'', webpage, 'thumbnail', default=None)
playlist = self._parse_json(
self._search_regex(r'playlist:[\s\S]*?\[([\s\S]*?)]', webpage, 'playlist', default='{}'),
video_id, transform_source=fix_json, fatal=False)
formats = []
for key in sorted(playlist):
formats.append({
'url': playlist[key]['src'],
'format_id': key,
'quality': playlist[key].get('quality'),
'resolution': playlist[key].get('quality')})
return {
'id': video_id,
'title': title,
'formats': formats,
'thumbnail': thumbnail,
'categories': categories,
'display_id': display_id,
}

View File

@ -10,7 +10,7 @@ from ..utils import update_url_query
class NickIE(MTVServicesInfoExtractor): class NickIE(MTVServicesInfoExtractor):
# None of videos on the website are still alive? # None of videos on the website are still alive?
IE_NAME = 'nick.com' IE_NAME = 'nick.com'
_VALID_URL = r'https?://(?:www\.)?nick(?:jr)?\.com/(?:videos/clip|[^/]+/videos)/(?P<id>[^/?#.]+)' _VALID_URL = r'https?://(?:(?:www|beta)\.)?nick(?:jr)?\.com/(?:[^/]+/)?(?:videos/clip|[^/]+/videos)/(?P<id>[^/?#.]+)'
_FEED_URL = 'http://udat.mtvnservices.com/service1/dispatch.htm' _FEED_URL = 'http://udat.mtvnservices.com/service1/dispatch.htm'
_TESTS = [{ _TESTS = [{
'url': 'http://www.nick.com/videos/clip/alvinnn-and-the-chipmunks-112-full-episode.html', 'url': 'http://www.nick.com/videos/clip/alvinnn-and-the-chipmunks-112-full-episode.html',
@ -57,6 +57,9 @@ class NickIE(MTVServicesInfoExtractor):
}, { }, {
'url': 'http://www.nickjr.com/paw-patrol/videos/pups-save-a-goldrush-s3-ep302-full-episode/', 'url': 'http://www.nickjr.com/paw-patrol/videos/pups-save-a-goldrush-s3-ep302-full-episode/',
'only_matching': True, 'only_matching': True,
}, {
'url': 'http://beta.nick.com/nicky-ricky-dicky-and-dawn/videos/nicky-ricky-dicky-dawn-301-full-episode/',
'only_matching': True,
}] }]
def _get_feed_query(self, uri): def _get_feed_query(self, uri):