mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-12-15 15:52:38 +00:00
[pandoratv] Add support for new URL format (closes #15131)
This commit is contained in:
parent
37941fe204
commit
64287560e4
1 changed files with 22 additions and 6 deletions
|
@ -1,6 +1,8 @@
|
||||||
# coding: utf-8
|
# coding: utf-8
|
||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
|
import re
|
||||||
|
|
||||||
from .common import InfoExtractor
|
from .common import InfoExtractor
|
||||||
from ..compat import (
|
from ..compat import (
|
||||||
compat_str,
|
compat_str,
|
||||||
|
@ -18,7 +20,13 @@ from ..utils import (
|
||||||
class PandoraTVIE(InfoExtractor):
|
class PandoraTVIE(InfoExtractor):
|
||||||
IE_NAME = 'pandora.tv'
|
IE_NAME = 'pandora.tv'
|
||||||
IE_DESC = '판도라TV'
|
IE_DESC = '판도라TV'
|
||||||
_VALID_URL = r'https?://(?:.+?\.)?channel\.pandora\.tv/channel/video\.ptv\?'
|
_VALID_URL = r'''(?x)
|
||||||
|
https?://
|
||||||
|
(?:
|
||||||
|
(?:www\.)?pandora\.tv/view/(?P<user_id>[^/]+)/(?P<id>\d+)| # new format
|
||||||
|
(?:.+?\.)?channel\.pandora\.tv/channel/video\.ptv\? # old format
|
||||||
|
)
|
||||||
|
'''
|
||||||
_TESTS = [{
|
_TESTS = [{
|
||||||
'url': 'http://jp.channel.pandora.tv/channel/video.ptv?c1=&prgid=53294230&ch_userid=mikakim&ref=main&lot=cate_01_2',
|
'url': 'http://jp.channel.pandora.tv/channel/video.ptv?c1=&prgid=53294230&ch_userid=mikakim&ref=main&lot=cate_01_2',
|
||||||
'info_dict': {
|
'info_dict': {
|
||||||
|
@ -53,9 +61,17 @@ class PandoraTVIE(InfoExtractor):
|
||||||
# Test metadata only
|
# Test metadata only
|
||||||
'skip_download': True,
|
'skip_download': True,
|
||||||
},
|
},
|
||||||
|
}, {
|
||||||
|
'url': 'http://www.pandora.tv/view/mikakim/53294230#36797454_new',
|
||||||
|
'only_matching': True,
|
||||||
}]
|
}]
|
||||||
|
|
||||||
def _real_extract(self, url):
|
def _real_extract(self, url):
|
||||||
|
mobj = re.match(self._VALID_URL, url)
|
||||||
|
user_id = mobj.group('user_id')
|
||||||
|
video_id = mobj.group('id')
|
||||||
|
|
||||||
|
if not user_id or not video_id:
|
||||||
qs = compat_urlparse.parse_qs(compat_urlparse.urlparse(url).query)
|
qs = compat_urlparse.parse_qs(compat_urlparse.urlparse(url).query)
|
||||||
video_id = qs.get('prgid', [None])[0]
|
video_id = qs.get('prgid', [None])[0]
|
||||||
user_id = qs.get('ch_userid', [None])[0]
|
user_id = qs.get('ch_userid', [None])[0]
|
||||||
|
|
Loading…
Reference in a new issue