]>
git.frykholm.com Git - svtplaydump.git/blob - tv4playdump.py
5f20b4a89c9ad2b385ab18a01deedc56d7f70b4a
5 def get_hls_playlist(url
):
6 ret
= requests
.get(url
).json()
7 #import pdb;pdb.set_trace()
9 if isinstance(ret
['playback']['items']['item'], list):
10 videourl
= sorted(ret
['playback']['items']['item'], key
=lambda k
: int(k
['bitrate']))[-1]['url']
12 videourl
= ret
['playback']['items']['item']['url']
15 res
= requests
.get("http://webapi.tv4play.se/video/programs/search.json?categoryids=pokemon&start=0&rows=1000").json()
17 #import pdb;pdb.set_trace()
18 for vid
in res
['results']:
20 video
['title'] = vid
['name']
21 video
['description'] = vid
['lead']
22 video
['url'] = get_hls_playlist("http://premium.tv4play.se/api/web/asset/{}/play.json?protocol=hls&videoFormat=MP4+WVM+SMI".format(vid
['href']))
23 video
['filename'] = "{} {}.ts".format(vid
['ontime'],vid
['name'])
25 basename
= video
['filename'].split('.ts')[0]
26 if os
.path
.exists(basename
+'.mkv'):
27 print("Skipping {}".format(basename
))
29 svtplaydump
.download_from_playlist(video
)
30 svtplaydump
.remux(video
)