Skip to content

Commit

Permalink
[tunein] Use station API
Browse files Browse the repository at this point in the history
  • Loading branch information
Naglis Jonaitis committed Dec 1, 2014
1 parent 94aa25b commit 1434bff
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions youtube_dl/extractor/tunein.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ class TuneInIE(InfoExtractor):
|tun\.in/(?P<redirect_id>[A-Za-z0-9]+)
)
'''
_API_URL_TEMPLATE = 'http://tunein.com/tuner/tune/?stationId={0:}&tuneType=Station'

_INFO_DICT = {
'id': '34682',
Expand Down Expand Up @@ -56,13 +57,10 @@ def _real_extract(self, url):
mobj = re.match(self._VALID_URL, url)
station_id = mobj.group('id')

webpage = self._download_webpage(
url, station_id, note='Downloading station webpage')
station_info = self._download_json(
self._API_URL_TEMPLATE.format(station_id),
station_id, note='Downloading station JSON')

payload = self._html_search_regex(
r'(?m)TuneIn\.payload\s*=\s*(\{[^$]+?)$', webpage, 'JSON data')
json_data = json.loads(payload)
station_info = json_data['Station']['broadcast']
title = station_info['Title']
thumbnail = station_info.get('Logo')
location = station_info.get('Location')
Expand Down

0 comments on commit 1434bff

Please sign in to comment.