From b55ee18ff3a9642fe25a977e1152472877294493 Mon Sep 17 00:00:00 2001 From: Philipp Hagemeister Date: Thu, 22 Jan 2015 12:04:07 +0100 Subject: [PATCH] [hearthisat] Add support for more high-quality download links --- youtube_dl/extractor/hearthisat.py | 49 ++++++++++++++++++++++-------- youtube_dl/utils.py | 8 +++++ 2 files changed, 45 insertions(+), 12 deletions(-) diff --git a/youtube_dl/extractor/hearthisat.py b/youtube_dl/extractor/hearthisat.py index c1177a9c5..d83072c1a 100644 --- a/youtube_dl/extractor/hearthisat.py +++ b/youtube_dl/extractor/hearthisat.py @@ -4,10 +4,15 @@ from __future__ import unicode_literals import re from .common import InfoExtractor -from ..compat import compat_urllib_request +from ..compat import ( + compat_urllib_request, + compat_urlparse, +) from ..utils import ( + HEADRequest, str_to_int, urlencode_postdata, + urlhandle_detect_ext, ) @@ -16,10 +21,10 @@ class HearThisAtIE(InfoExtractor): _PLAYLIST_URL = 'https://hearthis.at/playlist.php' _TEST = { 'url': 'https://hearthis.at/moofi/dr-kreep', - 'md5': 'd594c573227a89f4256f0b03e68c80cc', + 'md5': 'ab6ec33c8fed6556029337c7885eb4e0', 'info_dict': { 'id': '150939', - 'ext': 'mp3', + 'ext': 'wav', 'title': 'Moofi - Dr. Kreep', 'thumbnail': 're:^https?://.*\.jpg$', 'timestamp': 1421564134, @@ -67,18 +72,38 @@ class HearThisAtIE(InfoExtractor): timestamp = str_to_int(self._search_regex( r']+class="calctime"[^>]+data-time="(\d+)', webpage, 'timestamp', fatal=False)) - track_url = self._search_regex( - r']+data-mp3="([^"]+)"', webpage, 'track URL') - - formats = [{ - 'format_id': 'mp3', - 'url': track_url, - 'vcodec': 'none', - }] + formats = [] + mp3_url = self._search_regex( + r'(?s)[^"]+)"', cd) + if m: + e = determine_ext(m.group('filename'), default_ext=None) + if e: + return e + return getheader('Content-Type').split("/")[1] -- 2.22.2