Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def get_twitch_gif(user):
- videos = get_json('https://api.twitch.tv/kraken/channels/{}/videos?limit=1&broadcasts=true&hls=true'.format(user))
- vidid = video['videos'][0]['_id']
- if vidid is None: return None
- vid = get_json('https://api.twitch.tv/kraken/videos/{}'.format(vidid))
- if 'v1/AUTH_system' not in vid['preview']: return None
- index = '/'.join(vid['preview'].split('/')[3:7])
- url = 'http://vod.ak.hls.ttvnw.net/{}/chunked/index-dvr.m3u8'.format(index)
- # the .m3u8 file contains enough information to work with here...
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement