Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Fix downloading on Akamai when ABC provides streaming servers in auth…

… XML
  • Loading branch information...
commit f5b5c4cf8c5a17b137c8e62301d15fc7cafff6e5 1 parent 8df0299
@jeremyvisser jeremyvisser authored
Showing with 18 additions and 7 deletions.
  1. +3 −0  iview-cli
  2. +3 −1 iview/comm.py
  3. +2 −3 iview/config.py
  4. +10 −3 iview/parser.py
View
3  iview-cli
@@ -68,6 +68,7 @@ def print_auth():
print 'iView auth data:'
print '\tToken:', auth['token']
print '\tRTMP URL:', auth['rtmp_url']
+ print '\tPlaypath Prefix:', auth['playpath_prefix']
print '\tUnmetered:', str(auth['free'])
def download(url, output=None):
@@ -78,6 +79,8 @@ def subtitles(name, output=None):
# In this function, we print >> sys.stderr because we have the possibility
# of outputting subtitles to stdout, so we need to keep stdout clean.
+ config()
+
url = ''.join(name.split('.')[:-1])
if output is not None:
srt = output
View
4 iview/comm.py
@@ -98,7 +98,9 @@ def get_captions(url):
parse_subtitle(), which converts it to SRT format.
"""
- xml = maybe_fetch(config.captions_url % url)
+ captions_url = iview_config['captions_url'] + '%s.xml'
+
+ xml = maybe_fetch(captions_url % url)
return parser.parse_captions(xml)
def configure_socks_proxy():
View
5 iview/config.py
@@ -1,7 +1,7 @@
import os
version = '0.2'
-api_version = 374
+api_version = 383
# os.uname() is not available on Windows, so we make this optional.
try:
@@ -14,9 +14,8 @@
config_url = 'http://www.abc.net.au/iview/xml/config.xml?r=%d' % api_version
series_url = 'http://www.abc.net.au/iview/api/series_mrss.htm?id=%s'
-captions_url = 'http://www.abc.net.au/iview/captions/%s.xml'
-akamai_playpath_prefix = '/flash/playback/_definst_/'
+akamai_playpath_prefix = 'flash/playback/_definst_/'
# Used for "SWF verification", a stream obfuscation technique
swf_hash = '96cc76f1d5385fb5cda6e2ce5c73323a399043d0bb6c687edd807e5c73c42b37'
View
13 iview/parser.py
@@ -17,6 +17,8 @@ def parse_config(soup):
xml = BeautifulStoneSoup(soup)
# should look like "rtmp://cp53909.edgefcs.net/ondemand"
+ # Looks like the ABC don't always include this field.
+ # If not included, that's okay -- ABC usually gives us the server in the auth result as well.
rtmp_url = xml.find('param', attrs={'name':'server_streaming'}).get('value')
rtmp_chunks = rtmp_url.split('/')
@@ -27,6 +29,7 @@ def parse_config(soup):
'auth_url' : xml.find('param', attrs={'name':'auth'}).get('value'),
'api_url' : xml.find('param', attrs={'name':'api'}).get('value'),
'categories_url' : xml.find('param', attrs={'name':'categories'}).get('value'),
+ 'captions_url' : xml.find('param', attrs={'name':'captions'}).get('value'),
}
def parse_auth(soup):
@@ -40,7 +43,13 @@ def parse_auth(soup):
# should look like "rtmp://203.18.195.10/ondemand"
rtmp_url = xml.find('server').string
- playpath_prefix = ''
+ # at time of writing, either 'Akamai' (usually metered) or 'Hostworks' (usually unmetered)
+ stream_host = xml.find('host').string
+
+ if stream_host == 'Akamai':
+ playpath_prefix = config.akamai_playpath_prefix
+ else:
+ playpath_prefix = ''
if rtmp_url is not None:
# Being directed to a custom streaming server (i.e. for unmetered services).
@@ -55,8 +64,6 @@ def parse_auth(soup):
if not comm.iview_config:
comm.get_config()
- playpath_prefix = config.akamai_playpath_prefix
-
rtmp_url = comm.iview_config['rtmp_url']
rtmp_host = comm.iview_config['rtmp_host']
rtmp_app = comm.iview_config['rtmp_app']
Please sign in to comment.
Something went wrong with that request. Please try again.