SciLor's Open Source Forums
http://forum.scilor.com/

CommunicationToken
http://forum.scilor.com/viewtopic.php?f=133&t=273
Page 1 of 1

Author:  Werewolve [ Wed Jul 21, 2010 11:07 pm ]
Post subject:  CommunicationToken

Hello,

i want built a own downloader to learn and get better in codeing ;)
My Problem is to get the CommunicationToken.

This is my code:

Code:
  private string _sessionId;
        private string _md5sessionId;
        private string _randomHex;
        private string _userId;
        private string _keyword;
        private string _revision;
        private string _client;
        private string _communikationtoken;

        public Form1()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            GetSessionId();
            GetMd5SessionId();
            GetRandomHex();
            GetUserId();
            this._keyword = ":quitStealinMahShit:";
            this._revision = "20100412.45";
            this._client = "gslite";

            GetCommuncationToken();
        }

        public void GetSessionId()
        {
            CookieCollection Cookies = new CookieCollection();
            HttpWebRequest request = (HttpWebRequest)WebRequest.Create("http://listen.grooveshark.com/");
            request.CookieContainer = new CookieContainer();
            HttpWebResponse response = (HttpWebResponse)request.GetResponse();
            Cookies = response.Cookies;
            this._sessionId = Cookies[0].Value.ToString();
        }

        public void GetMd5SessionId()
        {
            this._md5sessionId = Helper.ConvertMD5Hash(this._sessionId);
        }

        public void GetRandomHex()
        {
            this._randomHex = Helper.GetRandomHex();
        }

        public void GetUserId()
        {
            this._userId = Guid.NewGuid().ToString("D").ToUpper();
        }

        private void GetCommuncationToken()
        {
            //?????
        }


I know i must build a Json Object and send it with a Webrequest. In the Response is the Token.
I know too, that i can use the Newtonsoft.Json lib to build this object. But i dont know how!

Can someone help me a bit with the CommunicationToken?
Thanks! ;)

Author:  SciLor [ Thu Jul 22, 2010 1:45 am ]
Post subject:  Re: CommunicationToken

Iam am creating the Json query with:
Code:
            Dim jss As New JsonSerializer()
            Dim serialisedRequestContentBuilder As New StringBuilder()
            Using serializerRequestWriter As New StringWriter(serialisedRequestContentBuilder)
                jss.Serialize(serializerRequestWriter, SendObject)
            End Using
            Dim serializedRequestContent As String = serialisedRequestContentBuilder.ToString()




You must request the communication token from the server, just sniff some data with tamper data in firefox. The Secret key is the md5 hash of the SessionId.

If you want to write your own downloader/player, feel free to use my dll. But beware you are not allowed to republish your software including my dll. You will have to point to my website to download that

Author:  Werewolve [ Thu Jul 22, 2010 10:57 am ]
Post subject:  Re: CommunicationToken

okay thanks!

i create this Json Obj:

Code:
"{"header":{"client":"gslite","uuid":"AC76E39B-0E20-4477-AA20-F885A847F57E","clientRevision":"20100412.45","session":"956d8e45e89c74484319a1de681d0dd8"},"method":"getCommunicationToken","parameters":{"secretKey":"f683ab080fe774b9f93fe47190bf3cb2"}}"


looks this right?

I a send this to "https://cowbell.grooveshark.com/service.php", but how can i get the token out of the response? :)

Author:  SciLor [ Thu Jul 22, 2010 12:46 pm ]
Post subject:  Re: CommunicationToken

Its a json object again, just read it from the stream and read it onto a custom class with the same structure as the json object.

TO check if it is right just compare it to the "real" data send by grooveshark.com

Author:  Werewolve [ Thu Jul 22, 2010 1:18 pm ]
Post subject:  Re: CommunicationToken

But how can create a class for the parameters in the response? Because i dont know what paramters are in the response...

Author:  SciLor [ Thu Jul 22, 2010 1:29 pm ]
Post subject:  Re: CommunicationToken

Just download the data and print it out into your console or a messagebox :)

Page 1 of 1 All times are UTC + 1 hour [ DST ]
Powered by phpBB® Forum Software © phpBB Group
http://www.phpbb.com/