<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en-gb">
	<link rel="self" type="application/atom+xml" href="https://forum.eggheads.org/app.php/feed/topic/19620" />

	<title>egghelp/eggheads community</title>
	<subtitle>Discussion of eggdrop bots, shell accounts and tcl scripts.</subtitle>
	<link href="https://forum.eggheads.org/index.php" />
	<updated>2014-02-15T16:23:08-04:00</updated>

	<author><name><![CDATA[egghelp/eggheads community]]></name></author>
	<id>https://forum.eggheads.org/app.php/feed/topic/19620</id>

		<entry>
		<author><name><![CDATA[bosseb]]></name></author>
		<updated>2014-02-15T16:23:08-04:00</updated>

		<published>2014-02-15T16:23:08-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=102596#p102596</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=102596#p102596"/>
		<title type="html"><![CDATA[Twitch.Tv / Justin.Tv stream links.]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=102596#p102596"><![CDATA[
Hi<br><br>The request is for a script that'll make eggdrop give out links to hls streams from twitch.tv/justin.tv<br>!tw esltv_sc2 <br><br>or<br><br>!tw esltv_sc2 720p<br>!tw elstv_sc2 1080p<br>!tw elstv_sc2 source<br>!tw elstv_sc2 all<br><br>Mainly it should respond with the hls stream(s), and of course if nothing is live then it should respond with offline or something.<br>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<br>defile your computer with adobe flash, and also giving you a lot more options with your video player. <br><br>being able to set default stream quality as configuration would be nice, as would being able to set min/max quality shown<br>and also what should be shown when there are no arguments provided. <br><br><br>Of course giving a bit of info about the stream would be nice as well (name/title/game/etc). <br><br>and having the links shortened would be nice as well (tinyurl or similar)<br>since they are quite long.<br><br>things that might help are listed below..<br><br>(Twitch: esltv_sc2 -- Polt vs. MaNa - Group C - IEM Cologne (StarCraft II: Heart of the Swarm), 32593 viewers)<br>^- this is already output from another twitch script (twitch.tcl by manellermus)<br><br><br>Below is a python script which takes streamname as argument and returns the link to the hls stream <br><a href="http://www.johannesbader.ch/2014/01/find-video-url-of-twitch-tv-live-streams-or-past-broadcasts/" class="postlink">http://www.johannesbader.ch/2014/01/fin ... roadcasts/</a><br>------------------------------------------------------------------------------------------------------<br>import requests<br>import json<br>import re<br>import argparse<br> <br>USHER_API = '<a href="http://usher.twitch.tv/select/%7Bchannel%7D.json" class="postlink">http://usher.twitch.tv/select/{channel}.json</a>' +\<br>    '?nauthsig={sig}&amp;nauth={token}&amp;allow_source=true'<br>TOKEN_API = '<a href="http://api.twitch.tv/api/channels/%7Bchannel%7D/access_token" class="postlink">http://api.twitch.tv/api/channels/{chan ... cess_token</a>'<br> <br>def get_token_and_signature(channel):<br>    url = TOKEN_API.format(channel=channel)<br>    r = requests.get(url)<br>    txt = r.text<br> <br>    data = json.loads(txt)<br>    sig = data['sig']<br>    token = data['token']<br>    return token, sig<br> <br>def get_live_stream(channel):<br>    token, sig = get_token_and_signature(channel)<br>    url = USHER_API.format(channel=channel, sig=sig, token=token)<br>    r = requests.get(url)<br>    txt = r.text<br>    for line in txt.split('\n'):<br>        if re.match('https?://.*', line):<br>            return line<br> <br>if __name__=="__main__":<br>    parser = argparse.ArgumentParser('get video url of twitch channel')<br>    parser.add_argument('channel_name')<br>    args = parser.parse_args()<br>    print( get_live_stream(args.channel_name) )<br>----------------------------------------------------------------------------<br><br>This page: <a href="http://bog.no-ip.biz/sc2/stream2vlc.php" class="postlink">http://bog.no-ip.biz/sc2/stream2vlc.php</a>  lets a user select quality wanted<br>and then gives you a stream. <br><br><a href="https://github.com/justintv/twitch-api" class="postlink">https://github.com/justintv/twitch-api</a><br>there is the twitch api..<br><br>:)<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=12165">bosseb</a> — Sat Feb 15, 2014 4:23 pm</p><hr />
]]></content>
	</entry>
	</feed>
