Advertisement
Guest User

Untitled

a guest
May 25th, 2016
54
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.58 KB | None | 0 0
  1. import m3u8
  2. import requests
  3.  
  4. print("hello")
  5.  
  6. mus = "http://a.files.bbci.co.uk/media/live/manifesto/audio/simulcast/hls/uk/sbr_high/ak/bbc_6music.m3u8"
  7. m = m3u8.load(mus)
  8. r_cache = []
  9. for p in m.playlists:
  10. r1 = requests.get(p.uri)
  11. for a in r1.text.split('n'):
  12. if a and not a.startswith('#'):
  13. full = "{}/{}".format(p.base_path, a)
  14. print("Downloading {}".format(full))
  15. r2 = requests.get(full)
  16. r_cache.append(r2)
  17.  
  18. for i, r in enumerate(r_cache):
  19. with open('file{}'.format(i), 'wb') as f:
  20. f.write(r.content)
  21.  
  22. print("bye")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement