egghelp.org community Forum Index
[ egghelp.org home | forum home ]
egghelp.org community
Discussion of eggdrop bots, shell accounts and tcl scripts.
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Twitch.Tv / Justin.Tv stream links.

 
Post new topic   Reply to topic    egghelp.org community Forum Index -> Script Requests
View previous topic :: View next topic  
Author Message
bosseb
Voice


Joined: 24 Dec 2012
Posts: 8

PostPosted: Sat Feb 15, 2014 4:23 pm    Post subject: Twitch.Tv / Justin.Tv stream links. Reply with quote

Hi

The request is for a script that'll make eggdrop give out links to hls streams from twitch.tv/justin.tv
!tw esltv_sc2

or

!tw esltv_sc2 720p
!tw elstv_sc2 1080p
!tw elstv_sc2 source
!tw elstv_sc2 all

Mainly it should respond with the hls stream(s), and of course if nothing is live then it should respond with offline or something.
the reason for using the hls streams is that everyone can use them, you can watch them directly in vlc,mpc etc. thus not having to
defile your computer with adobe flash, and also giving you a lot more options with your video player.

being able to set default stream quality as configuration would be nice, as would being able to set min/max quality shown
and also what should be shown when there are no arguments provided.


Of course giving a bit of info about the stream would be nice as well (name/title/game/etc).

and having the links shortened would be nice as well (tinyurl or similar)
since they are quite long.

things that might help are listed below..

(Twitch: esltv_sc2 -- Polt vs. MaNa - Group C - IEM Cologne (StarCraft II: Heart of the Swarm), 32593 viewers)
^- this is already output from another twitch script (twitch.tcl by manellermus)


Below is a python script which takes streamname as argument and returns the link to the hls stream
http://www.johannesbader.ch/2014/01/find-video-url-of-twitch-tv-live-streams-or-past-broadcasts/
------------------------------------------------------------------------------------------------------
import requests
import json
import re
import argparse

USHER_API = 'http://usher.twitch.tv/select/{channel}.json' +\
'?nauthsig={sig}&nauth={token}&allow_source=true'
TOKEN_API = 'http://api.twitch.tv/api/channels/{channel}/access_token'

def get_token_and_signature(channel):
url = TOKEN_API.format(channel=channel)
r = requests.get(url)
txt = r.text

data = json.loads(txt)
sig = data['sig']
token = data['token']
return token, sig

def get_live_stream(channel):
token, sig = get_token_and_signature(channel)
url = USHER_API.format(channel=channel, sig=sig, token=token)
r = requests.get(url)
txt = r.text
for line in txt.split('\n'):
if re.match('https?://.*', line):
return line

if __name__=="__main__":
parser = argparse.ArgumentParser('get video url of twitch channel')
parser.add_argument('channel_name')
args = parser.parse_args()
print( get_live_stream(args.channel_name) )
----------------------------------------------------------------------------

This page: http://bog.no-ip.biz/sc2/stream2vlc.php lets a user select quality wanted
and then gives you a stream.

https://github.com/justintv/twitch-api
there is the twitch api..

:)
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    egghelp.org community Forum Index -> Script Requests All times are GMT - 4 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Forum hosting provided by Reverse.net

Powered by phpBB © 2001, 2005 phpBB Group
subGreen style by ktauber