[hearthisat] Detect invalid download links (fixes #9440)
This commit is contained in:
parent
79298173c5
commit
cec9727c7f
|
@ -7,6 +7,7 @@ from .common import InfoExtractor
|
||||||
from ..compat import compat_urlparse
|
from ..compat import compat_urlparse
|
||||||
from ..utils import (
|
from ..utils import (
|
||||||
HEADRequest,
|
HEADRequest,
|
||||||
|
KNOWN_EXTENSIONS,
|
||||||
sanitized_Request,
|
sanitized_Request,
|
||||||
str_to_int,
|
str_to_int,
|
||||||
urlencode_postdata,
|
urlencode_postdata,
|
||||||
|
@ -17,7 +18,7 @@ from ..utils import (
|
||||||
class HearThisAtIE(InfoExtractor):
|
class HearThisAtIE(InfoExtractor):
|
||||||
_VALID_URL = r'https?://(?:www\.)?hearthis\.at/(?P<artist>[^/]+)/(?P<title>[A-Za-z0-9\-]+)/?$'
|
_VALID_URL = r'https?://(?:www\.)?hearthis\.at/(?P<artist>[^/]+)/(?P<title>[A-Za-z0-9\-]+)/?$'
|
||||||
_PLAYLIST_URL = 'https://hearthis.at/playlist.php'
|
_PLAYLIST_URL = 'https://hearthis.at/playlist.php'
|
||||||
_TEST = {
|
_TESTS = [{
|
||||||
'url': 'https://hearthis.at/moofi/dr-kreep',
|
'url': 'https://hearthis.at/moofi/dr-kreep',
|
||||||
'md5': 'ab6ec33c8fed6556029337c7885eb4e0',
|
'md5': 'ab6ec33c8fed6556029337c7885eb4e0',
|
||||||
'info_dict': {
|
'info_dict': {
|
||||||
|
@ -34,7 +35,25 @@ class HearThisAtIE(InfoExtractor):
|
||||||
'duration': 71,
|
'duration': 71,
|
||||||
'categories': ['Experimental'],
|
'categories': ['Experimental'],
|
||||||
}
|
}
|
||||||
}
|
}, {
|
||||||
|
# 'download' link redirects to the original webpage
|
||||||
|
'url': 'https://hearthis.at/twitchsf/dj-jim-hopkins-totally-bitchin-80s-dance-mix/',
|
||||||
|
'md5': '5980ceb7c461605d30f1f039df160c6e',
|
||||||
|
'info_dict': {
|
||||||
|
'id': '811296',
|
||||||
|
'ext': 'mp3',
|
||||||
|
'title': 'TwitchSF - DJ Jim Hopkins - Totally Bitchin\' 80\'s Dance Mix!',
|
||||||
|
'description': 'Listen to DJ Jim Hopkins - Totally Bitchin\' 80\'s Dance Mix! by TwitchSF on hearthis.at - Dance',
|
||||||
|
'upload_date': '20160328',
|
||||||
|
'timestamp': 1459186146,
|
||||||
|
'thumbnail': 're:^https?://.*\.jpg$',
|
||||||
|
'comment_count': int,
|
||||||
|
'view_count': int,
|
||||||
|
'like_count': int,
|
||||||
|
'duration': 4360,
|
||||||
|
'categories': ['Dance'],
|
||||||
|
},
|
||||||
|
}]
|
||||||
|
|
||||||
def _real_extract(self, url):
|
def _real_extract(self, url):
|
||||||
m = re.match(self._VALID_URL, url)
|
m = re.match(self._VALID_URL, url)
|
||||||
|
@ -90,6 +109,7 @@ class HearThisAtIE(InfoExtractor):
|
||||||
ext_handle = self._request_webpage(
|
ext_handle = self._request_webpage(
|
||||||
ext_req, display_id, note='Determining extension')
|
ext_req, display_id, note='Determining extension')
|
||||||
ext = urlhandle_detect_ext(ext_handle)
|
ext = urlhandle_detect_ext(ext_handle)
|
||||||
|
if ext in KNOWN_EXTENSIONS:
|
||||||
formats.append({
|
formats.append({
|
||||||
'format_id': 'download',
|
'format_id': 'download',
|
||||||
'vcodec': 'none',
|
'vcodec': 'none',
|
||||||
|
|
Loading…
Reference in New Issue