Skip to main content

Notice

Please note that most of the software linked on this forum is likely to be safe to use. If you are unsure, feel free to ask in the relevant topics, or send a private message to an administrator or moderator. To help curb the problems of false positives, or in the event that you do find actual malware, you can contribute through the article linked here.
Topic: Downloading biography from Last.fm into a text file (Read 2538 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

Downloading biography from Last.fm into a text file

Today I wrote a nice script which takes a biography from Last.fm and save it into a local text file.
I was using AutoHotKey for this task.
i know that this script have to be improved but right now, it doing the job.

you can download it here.

you can use it by "getbio.exe ATRIST+NAME" all files saved into a directory where the script located.

foo_run cmd ""C:\program file\foobar2000\biography\getbio.exe" $replace($replace(%artist%, ,+),&,and)"

here is the source (feel free to improve it and share it with us) 

Quote
#NoTrayIcon
SetWorkingDir, %A_ScriptDir%
; IfExist, %A_ScriptDir%/%1%.lrc
;    MsgBox, The drive exists.
IfNotExist, %A_ScriptDir%/%1%.lrc
    UrlDownloadToFile, http://www.last.fm/music/%1%/+wiki, %1%.tmp

output = %A_ScriptDir%/%1%.lrc
FileRead, html, %A_ScriptDir%/%1%.tmp

Loop, 400
{
StringReplace, html, html, `<br />`
StringReplace, html, html, `n
}

RegExMatch(html,"`<div class=""f"">`(.*?)CCC", bio)

Loop, 30
{
StringReplace, bio, bio, `n

}

StringReplace, bio, bio, <div style="margin-top:20px; border-top:1px solid #CCC
bio := RegExReplace(bio, "  ")
bio := RegExReplace(bio, "<.*?>")
bio := RegExReplace(bio, "&quot;")

FileAppend, %bio%, %output%
FileDelete, %1%.tmp


Improved code

ps, sorry for my English.