Sign in to follow this  
Followers 0
nend

Get biography

1 post in this topic

#1 ·  Posted (edited)

Just a small function voor getting the biography from a artist. :D

CODE
#include <INet.au3>

$artist = "Drop kick murphys"

ConsoleWrite(Get_biography($artist) & @CRLF)

Func Get_biography($artist)

$link = _INetGetSource ("http://www.last.fm/music/" & $artist & "/+wiki")

$countstart = StringInStr($link, "<h1>Biography", 0, 1) + 139

$start = StringTrimLeft($link, $countstart)

$total = StringLen($start)

$countend = StringInStr($start, "-- #wiki -->", 0, 1)

$Content = StringTrimRight($start, $total - $countend + 10)

If $Content = "" Then

Return

EndIf

$Content = StringStripCr($Content)

$Content = StringRegExpReplace($Content, '<head>(.|\n)+?</head>','')

$Content = StringRegExpReplace($Content, '<script>(.|\n)+?</script>','')

$Content = StringRegExpReplace($Content, '<(.|\n)+?>','')

$Content = StringReplace($Content, '&lt;','<')

$Content = StringReplace($Content, '&gt;','>')

$Content = StringReplace($Content, '&nbsp;',' ')

$Content = StringReplace($Content, '&copy;','©')

$Content = StringReplace($Content, '‘','')

$Content = StringReplace($Content, '’','')

$Content = StringReplace($Content, '“','')

$Content = StringReplace($Content, '”','')

$Content = StringReplace($Content, '&amp;','&')

$Content = StringReplace($Content, '. ','. ' & @CRLF)

$Content = StringReplace($Content, 'â','')

$Content = StringReplace($Content, 'â','-')

$Content = StringReplace($Content, '\r',' ')

while StringInStr($Content,' ')

$Content = StringReplace($Content, ' ',' ')

wend

$Content = StringReplace($Content, ' ' & @Lf,@Lf)

while StringInStr($Content,@Lf & @Lf)

$Content = StringReplace($Content, @Lf & @Lf, @Lf)

wend

$Content = StringStripWS($Content, 3)

Return($Content)

Endfunc

Edited by nend

Share this post


Link to post
Share on other sites



Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0