Advertisement
Xzempt

Untitled

May 26th, 2013
142
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.53 KB | None | 0 0
  1. on *:TEXT:*:#opers,#Calmdown: {
  2. if ($regex($1-,/(http\://open\.spotify\.com/track/.+)/)) { %data = $regml(1) | spotify | %spotify.chan = $chan | %spotify.track = $gettok($gettok(%data,4,47),1,32) }
  3. }
  4.  
  5. alias spotify {
  6. %s = sockwrite -tn
  7. sockopen spotify open.spotify.com 80
  8. }
  9.  
  10. on *:SOCKOPEN:spotify: {
  11. echo -a $gettok($gettok(%data,4,47),1,32)
  12. %s $sockname GET /track/ $+ $gettok($gettok(%data,4,47),1,32) HTTP/1.1
  13. %s $sockname Host: open.spotify.com $+ $str($crlf,2)
  14. }
  15.  
  16. on *:SOCKREAD:spotify: {
  17. var %spotify | sockread %spotify | tokenize 32 %spotify
  18. if ($sockerr > 0) { echo -a Socket Error. }
  19. if (%spotify) {
  20. if ($regex(%spotify,/(<h1 itemprop="name">.+</h1>)/)) { set -u5 %spotify.title $nohtml($regml(1)) }
  21. if ($regex(%spotify,/(<h2> by <a href="/artist/.+">.+</a></h2>)/)) { set -u5 %spotify.artist $nohtml($regml(1)) }
  22. if ($regex(%spotify, /(<a href="/track/.+">)/)) {
  23. if ($regml(1) == <a href="/track/ $+ %spotify.track $+ ">) {
  24. set -u5 %spotify.duration on
  25. }
  26. if (%spotify.duration == on) && ($regex(%spotify,/(<span class="duration"><meta itemprop="duration" content=".+"/>.+</span>)/)) {
  27. echo -a 04 $regml(1)
  28. }
  29. }
  30. ;if (%spotify.artist) && (%spotify.title) { msg %spotify.chan 14 $+ $nohtml(%spotify.title) 07~14 $nohtml(%spotify.artist) }
  31. else { ;echo -a $1- }
  32. }
  33. else { ;echo -a 04Unknown error. }
  34. }
  35. alias -l nohtml {
  36. var %x, %i = $regsub($1-,/(^[^<]*>|<[^>]*>|<[^>]*$)/g,$null,%x), %x = $remove(%x,&nbsp;,&#039;)
  37. return %x
  38. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement