Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import m3u8
- import requests
- print("hello")
- mus = "http://a.files.bbci.co.uk/media/live/manifesto/audio/simulcast/hls/uk/sbr_high/ak/bbc_6music.m3u8"
- m = m3u8.load(mus)
- r_cache = []
- for p in m.playlists:
- r1 = requests.get(p.uri)
- for a in r1.text.split('n'):
- if a and not a.startswith('#'):
- full = "{}/{}".format(p.base_path, a)
- print("Downloading {}".format(full))
- r2 = requests.get(full)
- r_cache.append(r2)
- for i, r in enumerate(r_cache):
- with open('file{}'.format(i), 'wb') as f:
- f.write(r.content)
- print("bye")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement