[thesixtyone] Modernize

master
Yen Chi Hsuan 2015-06-25 16:19:04 +08:00
parent 2182ab5187
commit 381c067755
1 changed files with 3 additions and 7 deletions

View File

@ -1,9 +1,6 @@
# coding: utf-8 # coding: utf-8
from __future__ import unicode_literals from __future__ import unicode_literals
import json
import re
from .common import InfoExtractor from .common import InfoExtractor
from ..utils import unified_strdate from ..utils import unified_strdate
@ -70,14 +67,13 @@ class TheSixtyOneIE(InfoExtractor):
} }
def _real_extract(self, url): def _real_extract(self, url):
mobj = re.match(self._VALID_URL, url) song_id = self._match_id(url)
song_id = mobj.group('id')
webpage = self._download_webpage( webpage = self._download_webpage(
self._SONG_URL_TEMPLATE.format(song_id), song_id) self._SONG_URL_TEMPLATE.format(song_id), song_id)
song_data = json.loads(self._search_regex( song_data = self._parse_json(self._search_regex(
r'"%s":\s(\{.*?\})' % song_id, webpage, 'song_data')) r'"%s":\s(\{.*?\})' % song_id, webpage, 'song_data'), song_id)
if self._search_regex(r'(t61\.s3_audio_load\s*=\s*1\.0;)', webpage, 's3_audio_load marker', default=None): if self._search_regex(r'(t61\.s3_audio_load\s*=\s*1\.0;)', webpage, 's3_audio_load marker', default=None):
song_data['audio_server'] = 's3.amazonaws.com' song_data['audio_server'] = 's3.amazonaws.com'