mirror of
https://codeberg.org/polarisfm/youtube-dl
synced 2025-01-08 14:17:54 +01:00
[narando] add separate [narando:player] extractor
This commit is contained in:
parent
200ad7687a
commit
f8a4a38880
@ -672,7 +672,10 @@ from .myvi import (
|
|||||||
MyviEmbedIE,
|
MyviEmbedIE,
|
||||||
)
|
)
|
||||||
from .myvidster import MyVidsterIE
|
from .myvidster import MyVidsterIE
|
||||||
from .narando import NarandoIE
|
from .narando import (
|
||||||
|
NarandoIE,
|
||||||
|
NarandoPlayerIE,
|
||||||
|
)
|
||||||
from .nationalgeographic import (
|
from .nationalgeographic import (
|
||||||
NationalGeographicVideoIE,
|
NationalGeographicVideoIE,
|
||||||
NationalGeographicIE,
|
NationalGeographicIE,
|
||||||
|
@ -4,6 +4,33 @@ from __future__ import unicode_literals
|
|||||||
from .common import InfoExtractor
|
from .common import InfoExtractor
|
||||||
|
|
||||||
|
|
||||||
|
class NarandoPlayerIE(InfoExtractor):
|
||||||
|
IE_NAME = "narando:player"
|
||||||
|
_VALID_URL = r'https://narando.com/widget\?r=(?P<id>\w+)'
|
||||||
|
_TEST = {
|
||||||
|
'url': 'https://narando.com/widget?r=b2t4t789kxgy9g7ms4rwjvvw',
|
||||||
|
'md5': 'd20f671f0395bab8f8285d1f6e8f965e',
|
||||||
|
'info_dict': {
|
||||||
|
'id': 'b2t4t789kxgy9g7ms4rwjvvw',
|
||||||
|
'ext': 'mp3',
|
||||||
|
'title': 'An ihrem Selbstlob erkennt man sie',
|
||||||
|
'url': 'https://static.narando.com/sounds/10492/original.mp3',
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
def _real_extract(self, url):
|
||||||
|
video_id = self._match_id(url)
|
||||||
|
webpage = self._download_webpage('https://narando.com/widget?r=' + video_id, video_id)
|
||||||
|
title = self._html_search_regex(r'<title>narando \| (.+?)</title>', webpage, 'title')
|
||||||
|
download_url = self._html_search_regex(r'.<div class="stream_url hide">\s*([^?]*)', webpage, 'download_url')
|
||||||
|
|
||||||
|
return {
|
||||||
|
'id': video_id,
|
||||||
|
'title': title,
|
||||||
|
'url': download_url,
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
class NarandoIE(InfoExtractor):
|
class NarandoIE(InfoExtractor):
|
||||||
IE_NAME = "narando"
|
IE_NAME = "narando"
|
||||||
_VALID_URL = r'https?://(?:www\.)?narando\.com/articles/(?P<id>([a-zA-Z]|-)+)'
|
_VALID_URL = r'https?://(?:www\.)?narando\.com/articles/(?P<id>([a-zA-Z]|-)+)'
|
||||||
@ -22,48 +49,17 @@ class NarandoIE(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('https://narando.com/articles/' + video_id, video_id)
|
webpage = self._download_webpage('https://narando.com/articles/' + video_id, video_id)
|
||||||
|
|
||||||
title = self._html_search_regex(r'<h1 class="visible-xs h3">(.+?)</h1>', webpage, 'title')
|
title = self._html_search_regex(r'<h1 class="visible-xs h3">(.+?)</h1>', webpage, 'title')
|
||||||
|
|
||||||
player_id = self._html_search_regex(r'[\n\r].*https:\/\/narando.com\/r\/\s*([^"]*)', webpage, 'player_id')
|
player_id = self._html_search_regex(r'[\n\r].*https:\/\/narando.com\/r\/\s*([^"]*)', webpage, 'player_id')
|
||||||
player_page = self._download_webpage('https://narando.com/widget?r=' + player_id, player_id)
|
player_url = 'https://narando.com/widget?r=' + player_id
|
||||||
download_url = self._html_search_regex(r'.<div class="stream_url hide">\s*([^?]*)', player_page, 'url')
|
|
||||||
# download_url = NarandoPlayerIE()._real_extract('https://narando.com/widget?r=' + player_id)['url']
|
|
||||||
description = self._html_search_regex(r'<meta content="(.+?)" property="og:description" />', webpage, 'description')
|
description = self._html_search_regex(r'<meta content="(.+?)" property="og:description" />', webpage, 'description')
|
||||||
|
|
||||||
return {
|
return {
|
||||||
'display_id': video_id,
|
'display_id': video_id,
|
||||||
'id': player_id,
|
'id': player_id,
|
||||||
'title': title,
|
'title': title,
|
||||||
'url': download_url,
|
'url': player_url,
|
||||||
'description': description,
|
'description': description,
|
||||||
|
'_type': 'url',
|
||||||
}
|
}
|
||||||
|
|
||||||
"""to be implemented later
|
|
||||||
class NarandoPlayerIE(InfoExtractor):
|
|
||||||
IE_NAME = "narando:player"
|
|
||||||
_VALID_URL = r'https://narando.com/widget\?r=(?P<id>\w+)'
|
|
||||||
_TEST = {
|
|
||||||
'url': 'https://narando.com/widget?r=b2t4t789kxgy9g7ms4rwjvvw',
|
|
||||||
'md5': 'd20f671f0395bab8f8285d1f6e8f965e',
|
|
||||||
'info_dict': {
|
|
||||||
'id': 'b2t4t789kxgy9g7ms4rwjvvw',
|
|
||||||
'ext': 'mp3',
|
|
||||||
'title': 'An ihrem Selbstlob erkennt man sie',
|
|
||||||
'url': 'https://static.narando.com/sounds/10492/original.mp3',
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
def _real_extract(self, url):
|
|
||||||
video_id = self._match_id(url)
|
|
||||||
webpage = self._download_webpage('https://narando.com/widget?r=' + video_id, video_id)
|
|
||||||
title = self._html_search_regex(r'<title>narando \| (.+?)</title>', webpage, 'title')
|
|
||||||
|
|
||||||
download_url = self._html_search_regex(r'.<div class="stream_url hide">\s*([^?]*)', webpage, 'download_url')
|
|
||||||
return {
|
|
||||||
'id': video_id,
|
|
||||||
'title': title,
|
|
||||||
'url': download_url,
|
|
||||||
}
|
|
||||||
"""
|
|
||||||
|
Loading…
Reference in New Issue
Block a user