Processing Ajax...

Title
Close Dialog

Message

Confirm
Close Dialog

Confirm
Close Dialog

Confirm
Close Dialog

duhow's profile on WallpaperFusion.com
Replace spotiuri with your Spotify URI track or Playlist.

Code

// using System.Net; // at beginning of code.

String spotiuri = "spotify:user:spotify:playlist:5O2ERf8kAYARVVdfCKZ9G7";
String spotibase = "https://abcdefghij.spotilocal.com:4370/";

WebClient web = new WebClient();
web.Headers.Add("Origin", "https://open.spotify.com");

String csrf = web.DownloadString(spotibase + "simplecsrf/token.json");
csrf = csrf.Substring(12);
csrf = csrf.Substring(0, 32);

String oauth = web.DownloadString("https://open.spotify.com/token");
oauth = oauth.Substring(6);
oauth = oauth.Substring(0, oauth.Length - 2);

web.DownloadString(spotibase + "remote/play.json?oauth=" + oauth + "&csrf=" + csrf + "&uri=" + spotiuri + "&context=" + spotiuri);
Feb 26, 2017 (modified Mar 8, 2017)  • #1
Keith Lammers (BFS)'s profile on WallpaperFusion.com
Thanks for sending this over! We'll add it to the repository :)
Feb 28, 2017  • #2
xcy7e's profile on WallpaperFusion.com
This one does not work. Am I missing someting? I added the code to an empty makro-code window and selected C#.

It says errors in Line 4 & 7
Mar 4, 2017  • #3
PabloMartinez's profile on WallpaperFusion.com
Yes, you missing a using directive System.Net
The entire script will look like this:

Code

using System;
using System.Drawing;
using System.Net;

public static class VoiceBotScript
{
public static void Run(IntPtr windowHandle)
{
            string spotiuri = "spotify:user:spotify:playlist:5O2ERf8kAYARVVdfCKZ9G7";
            string spotibase = "https://abcdefghij.spotilocal.com:4370/";

            WebClient web = new WebClient();
            web.Headers.Add("Origin", "https://open.spotify.com");

            string csrf = web.DownloadString(spotibase + "simplecsrf/token.json");
            csrf = csrf.Substring(12);
            csrf = csrf.Substring(0, 32);

            string oauth = web.DownloadString("https://open.spotify.com/token");
            oauth = oauth.Substring(6);
            oauth = oauth.Substring(0, oauth.Length - 2);

            web.DownloadString(spotibase + "remote/play.json?oauth=" + oauth + "&csrf=" + csrf + "&uri=" + spotiuri + "&context=" + spotiuri);
}
}
Mar 4, 2017  • #4
duhow's profile on WallpaperFusion.com
UPDATE: If you are getting a fake token, please add User-Agent field before getting OAuth token.

Code

web.Headers.Set("User-Agent", "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/56.0.2924.87 Safari/537.36");
Mar 13, 2017  • #5
Subscribe to this discussion topic using RSS
Was this helpful?  Login to Vote(1)  Login to Vote(-)