1
1
mirror of https://github.com/ytdl-org/youtube-dl synced 2024-11-30 19:02:55 +01:00

[mtg] Add support for viafree URLs (#10358)

This commit is contained in:
Sergey M․ 2016-08-17 00:19:43 +07:00
parent 53fef319f1
commit 6e7e4a6edf
No known key found for this signature in database
GPG Key ID: 2C393E0F18A9236D

View File

@ -20,15 +20,24 @@ from ..utils import (
class TVPlayIE(InfoExtractor): class TVPlayIE(InfoExtractor):
IE_DESC = 'TV3Play and related services' IE_NAME = 'mtg'
_VALID_URL = r'''(?x)https?://(?:www\.)? IE_DESC = 'MTG services'
(?:tvplay(?:\.skaties)?\.lv/parraides| _VALID_URL = r'''(?x)
(?:
mtg:|
https?://
(?:www\.)?
(?:
tvplay(?:\.skaties)?\.lv/parraides|
(?:tv3play|play\.tv3)\.lt/programos| (?:tv3play|play\.tv3)\.lt/programos|
tv3play(?:\.tv3)?\.ee/sisu| tv3play(?:\.tv3)?\.ee/sisu|
tv(?:3|6|8|10)play\.se/program| (?:tv(?:3|6|8|10)play|viafree)\.se/program|
(?:(?:tv3play|viasat4play|tv6play)\.no|tv3play\.dk)/programmer| (?:(?:tv3play|viasat4play|tv6play|viafree)\.no|(?:tv3play|viafree)\.dk)/programmer|
play\.novatv\.bg/programi play\.novatv\.bg/programi
)/[^/]+/(?P<id>\d+) )
/(?:[^/]+/)+
)
(?P<id>\d+)
''' '''
_TESTS = [ _TESTS = [
{ {
@ -197,6 +206,14 @@ class TVPlayIE(InfoExtractor):
{ {
'url': 'http://tv3play.tv3.ee/sisu/kodu-keset-linna/238551?autostart=true', 'url': 'http://tv3play.tv3.ee/sisu/kodu-keset-linna/238551?autostart=true',
'only_matching': True, 'only_matching': True,
},
{
'url': 'http://www.viafree.se/program/underhallning/i-like-radio-live/sasong-1/676869',
'only_matching': True,
},
{
'url': 'mtg:418113',
'only_matching': True,
} }
] ]
@ -204,13 +221,13 @@ class TVPlayIE(InfoExtractor):
video_id = self._match_id(url) video_id = self._match_id(url)
video = self._download_json( video = self._download_json(
'http://playapi.mtgx.tv/v1/videos/%s' % video_id, video_id, 'Downloading video JSON') 'http://playapi.mtgx.tv/v3/videos/%s' % video_id, video_id, 'Downloading video JSON')
title = video['title'] title = video['title']
try: try:
streams = self._download_json( streams = self._download_json(
'http://playapi.mtgx.tv/v1/videos/stream/%s' % video_id, 'http://playapi.mtgx.tv/v3/videos/stream/%s' % video_id,
video_id, 'Downloading streams JSON') video_id, 'Downloading streams JSON')
except ExtractorError as e: except ExtractorError as e:
if isinstance(e.cause, compat_HTTPError) and e.cause.code == 403: if isinstance(e.cause, compat_HTTPError) and e.cause.code == 403: