Skip to content

Instantly share code, notes, and snippets.

@rornor
Last active December 13, 2015 23:59
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save rornor/aa2ada8bdc93144abd03 to your computer and use it in GitHub Desktop.
Full lasf.fm bio script for foobar2000 Biography View
On Error resume Next
With CreateObject("MSXML2.DOMDocument.6.0")
.async = false
.load("http://developer.echonest.com/api/v4/artist/biographies?api_key=PKDMY7Z0SGFBW" & UCase(Right("denial", 4)) & "&license=cc-by-sa&format=xml&name=" & UTF8Encode(WScript.Arguments.Item(0)))
WScript.Echo Replace(Replace(.selectSingleNode("/response/biographies/biography/text[../site='last.fm']").text, ". ", "." & vbCrLf & vbCrLf), ". ", "." & vbCrLf & vbCrLf)
End With
Function UTF8Encode(s)
With CreateObject("ADODB.Stream")
.Open
.Type = 2
.Charset = "utf-8"
.WriteText s
.Flush
.Position = 0
.Type = 1
.Read = 3
For i = 1 To .Size-3
UTF8Encode = UTF8Encode & "%" & Hex(AscB(.Read(1)))
Next
.Close
End With
End Function
@rornor
Copy link
Author

rornor commented Feb 25, 2013

Version with text caching can be found here: https://gist.github.com/e8adee2d94cac17840b3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment