SCRIPT ID: SPOTIFY
With the use of Spotify API this script sends info about the Track, Artist or album Spotify URL to the chan it was detected on!
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;UPDATE v0.3 01/11/2016;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;Fixed some bugs in Track Artist and Album ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;Added Duration Value For tracks;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; Script by OrFeAsGr ;;;
;;; v0.3 01/11/2016 ;;;
;;; My website: http://humanity.ucoz.com ;;;
;;; When it finds a spotify link of artist, song or album it sends all of its info ;;;
;;; Thanks for using my script :) <3 ;;;
on *:text:*:#: {
var %x = 1
while (%x <= $numtok($strip($1-),32)) {
var %y = $gettok($strip($1-),%x,32)
if (*spotify.com/track* iswm %y) {
set %spotchan $chan | set %spotID $+(/v1/tracks/,$gettok(%y,$iif(*https* iswm %y, 4, 3),47)) | sockopen -e spotify api.spotify.com 443
}
if (*spotify.com/artist* iswm %y) {
set %spotchan $chan | set %spotID $+(/v1/artists/,$gettok(%y,$iif(*https* iswm %y, 4, 3),47)) | sockopen -e spotifyartist api.spotify.com 443
}
if (*spotify.com/album* iswm %y) {
set %spotchan $chan | set %spotID $+(/v1/albums/,$gettok(%y,$iif(*https* iswm %y, 4, 3),47)) | sockopen -e spotifyalbum api.spotify.com 443
}
inc %x
}
}
on *:SOCKOPEN:*: {
if (!%SPOTIFYversion) || (%SPOTIFYversion != v0.3) { set %SPOTIFYversion v0.3 }
if ($sockname == spotify) || ($sockname == spotifyartist) || ($sockname == spotifyalbum) {
sockwrite -nt $sockname GET %spotID HTTP/1.1
sockwrite -nt $sockname Host: api.spotify.com
sockwrite -nt $sockname Connection: Close
sockwrite $sockname $crlf
}
}
on *:SOCKREAD:*: {
if ($sockname == spotifyalbum) {
if ($sockerr) { msg %spotchan Error.. | sockclose $sockname }
var %spotreadalb
sockread %spotreadalb
if (*name* iswm %spotreadalb) {
inc %spotname 1
if (%spotname == 1) {
set %spotartist $remove($gettok(%spotreadalb,2,58),",$chr(44))
}
elseif (%spotname == 2) {
set %spotalbum $remove($gettok(%spotreadalb,2,58),",$chr(44))
unset %spotname
}
}
if (*release_date* iswm %spotreadalb) {
if (!%spotreldate) {
set %spotreldate 1
msg %spotchan 14-3Spotify Album Info14- 3Name14: %spotalbum 3Artist14: %spotartist 3Release date14: $remove($gettok(%spotreadalb,2,58),",$chr(44))
sockclose $sockname
unset %spot*
}
}
}
if ($sockname == spotifyartist) {
if ($sockerr) { msg %spotchan Error.. | sockclose $sockname }
var %spotreadart
sockread %spotreadart
;echo -at %spotreadart
if (*total* iswm %spotreadart) {
set %spotartfol $gettok(%spotreadart,2,58)
}
if (*genres* iswm %spotreadart) {
set %spotartgenre $remove($gettok(%spotreadart,2,91),",$+([,$chr(44)))
}
if (*name* iswm %spotreadart) {
set %spotartname $remove($gettok(%spotreadart,2,58),",$chr(44))
sockclose $sockname
msg %spotchan 14-3Spotify Artist Info14- 3Name14: %spotartname 3Genres14: %spotartgenre 3Followers14: %spotartfol
.timer 1 1 unset %spotart*
}
}
if ($sockname == spotify) {
if ($sockerr) { msg %spotchan Error.. | sockclose $sockname }
var %spotread
sockread %spotread
;echo -at %spotread
if (*available_markets" :* iswm %spotread) {
set %spotcn album
}
if (*artists" :* iswm %spotread) {
if (%spotalbum) {
set %spotcn artist
}
}
if (*duration_ms" :* iswm %spotread) { set %spotdur $replace($round($calc(($remove($gettok(%spotread,2,58),$chr(44)) / 1000) / 60),2),.,:) | set %spotcn track }
if (*name* iswm %spotread) {
if (%spotcn == album) {
set %spotalbum $remove($gettok(%spotread,2,58),",$chr(44))
}
elseif (%spotcn == artist) {
set %spotartist $addtok(%spotartist,$remove($gettok(%spotread,2,58),",$chr(44)),32)
set %spotcn album
}
elseif (%spotcn == track) {
set %spottrack $remove($gettok(%spotread,2,58),",$chr(44))
sockclose $sockname
msg %spotchan 14-3Spotify14- 3Track14: %spottrack 3Artist14: %spotartist 3Album14: %spotalbum $iif(%spotexp, 14|3Explicit14|3?14|, $null) 3Duration14: %spotdur
.timer 1 2 unset %spot*
}
}
elseif (*explicit* iswm %spotread) {
if (*true* iswm $gettok(%spotread,2,58)) {
set %spotexp 1
}
}
}
}
Or do you want to donate some bucks because you like my scripts??? Visit https://www.paypal.me/OrFeAsGr
Thx! ^_^
is this working i cant seem to get it to work.. i stupid all the other ones worked .. dunno any more