X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=blobdiff_plain;f=youtube_dl%2Fextractor%2Fhearthisat.py;h=7d8698655666f8de4e8850ac2684a16dd28810af;hb=9f0ee2a3883ec6f6fdccba90085cb925aaa2f617;hp=c1177a9c5914e32d5a630fbb4167b3ec032cfc15;hpb=e5763a7a7e630cfd94b8993a9592cb3243890e0c;p=youtube-dl diff --git a/youtube_dl/extractor/hearthisat.py b/youtube_dl/extractor/hearthisat.py index c1177a9c5..7d8698655 100644 --- a/youtube_dl/extractor/hearthisat.py +++ b/youtube_dl/extractor/hearthisat.py @@ -4,10 +4,13 @@ from __future__ import unicode_literals import re from .common import InfoExtractor -from ..compat import compat_urllib_request +from ..compat import compat_urlparse from ..utils import ( + HEADRequest, + sanitized_Request, str_to_int, urlencode_postdata, + urlhandle_detect_ext, ) @@ -16,10 +19,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, @@ -42,7 +45,7 @@ class HearThisAtIE(InfoExtractor): r'intTrackId\s*=\s*(\d+)', webpage, 'track ID') payload = urlencode_postdata({'tracks[]': track_id}) - req = compat_urllib_request.Request(self._PLAYLIST_URL, payload) + req = sanitized_Request(self._PLAYLIST_URL, payload) req.add_header('Content-type', 'application/x-www-form-urlencoded') track = self._download_json(req, track_id, 'Downloading playlist')[0] @@ -67,18 +70,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)