| View previous topic :: View next topic |
| Author |
Message |
kathorga Voice
Joined: 05 Sep 2011 Posts: 14
|
Posted: Mon Sep 05, 2011 11:56 am Post subject: Parse metal-archives |
|
|
Does anyone has/or can make script reading from metal-archives.com?
I can post old script if anyone interested, they changed their page couple months ago and old one doesn't work anymore |
|
| Back to top |
|
 |
iRoc Guest
|
Posted: Mon Sep 05, 2011 1:59 pm Post subject: |
|
|
| post old version |
|
| Back to top |
|
 |
kathorga Voice
Joined: 05 Sep 2011 Posts: 14
|
Posted: Mon Sep 05, 2011 2:18 pm Post subject: |
|
|
| Code: | #nd script #
# Let your users search for artist and reply with genre and origin #
# Gets the data from metal-archives.com #
# Requirements: wget, iconv #
# Date: 2008-08-12 #
#####################################################################
bind pub - !band pub:band
proc pub:band {nick uhost hand chan arg} {
if {$arg == ""} {
putserv "PRIVMSG $chan :Usage : !band <name> | metal-archives.com"
return
}
#Take out the first letter
set letter [string range $arg 0 0]
set letter [string toupper $letter]
if {[string is digit $letter]} {
set letter "n"
}
#Get list of bands starting with that letter
if {[catch {exec wget -q -T 60 -t 1 -O - http://metal-archives.com/browseL.php?l=$letter} result]} {
putserv "PRIVMSG $chan :Error. couldn't reach metal-archives.com"
return
}
regsub -all -nocase {<br>} $result "\n" result2
set numberofartists 0
#Try to find the requested band
foreach line [split $result2 \n] {
if {[string match -nocase *\>$arg\<* $line]} {
set singleband $line
set numberofartists 1
} elseif {[string match -nocase *\>$arg\ \(*\<* $line]} {
regexp -nocase {<a(.*)>(.*)</a>} $line - donotcare line
lappend list $line
incr numberofartists
}
}
if {$numberofartists == 0} {
putserv "PRIVMSG $chan :Couldn't find that band"
} elseif {$numberofartists > 1} {
putserv "PRIVMSG $chan :There are several bands with that name. Type origin too."
set index 0
while {$index < $numberofartists} {
putserv "PRIVMSG $chan :[lindex $list $index]"
incr index
}
} elseif {$numberofartists == 1} { #Exactly one hit
regexp -nocase {<a href='(.*)'} $singleband - bandurl
if {[catch {exec wget -q -T 60 -t 1 -O - http://metal-archives.com/$bandurl} result]} {
putserv "PRIVMSG $chan :Error. couldn't reach metal-archives.com"
return
}
set list ""
regsub -all -nocase {<br>} $result "\n" result2
#Parse and extract the info we want
foreach line [split $result2 \n] {
if {[string match -nocase *</td* $line]} {
regsub -all {<([^<])*>} $line {} line
set line [string trim $line]
if {[string match (*) $line]} {
regexp -nocase {\((.*)\)} $line - town
set country "$country, $town"
set list [lreplace $list end end]
lappend list $country
} else {
if {[string match "" $line] != 1} {
lappend list $line
}
}
} elseif {[string match -nocase *browseC* $line]} {
regsub -all {<([^<])*>} $line {} line
set country [string trim $line]
lappend list $country
}
}
set endofinfo [lsearch $list Status*]
putserv "PRIVMSG $chan :\002[lindex $list 0]"
putserv "PRIVMSG $chan :[lindex $list 1]: [lindex $list 2]"
if {[string match -nocase *lyric* [lindex $list 3]]} {
putserv "PRIVMSG $chan :[lindex $list 3]: [lindex $list 4]"
set index 5
} else { #There's no info about lyrics. Skip it
set index 3
}
while {$index <= $endofinfo} {
putserv "PRIVMSG $chan :[lindex $list $index]: [lindex $list [expr $index+4]]"
incr index
}
#Find number of studio albums
set albums 0
foreach line [split $result2 \n] {
if {[string match -nocase *full-length* $line]} {
incr albums
}
}
if {$albums > 0} {
putserv "PRIVMSG $chan :Albums: $albums"
}
putserv "PRIVMSG $chan :URL: http://metal-archives.com/$bandurl"
}
}
putlog "Metal band script v1.0 loaded"
|
|
|
| Back to top |
|
 |
kathorga Voice
Joined: 05 Sep 2011 Posts: 14
|
Posted: Wed Oct 19, 2011 12:05 pm Post subject: |
|
|
| Any luck iRoc? |
|
| Back to top |
|
 |
speechles Revered One

Joined: 26 Aug 2006 Posts: 1398 Location: emerald triangle, california (coastal redwoods)
|
Posted: Wed Oct 19, 2011 9:35 pm Post subject: |
|
|
| Code: | | if {[catch {exec wget -q -T 60 -t 1 -O - http://metal-archives.com/browseL.php?l=$letter} result]} { |
| Code: | | if {[catch {exec wget -q -T 60 -t 1 -O - http://metal-archives.com/$bandurl} result]} { |
lollerskates
two words. http package. _________________ speechles' eggdrop tcl archive |
|
| Back to top |
|
 |
kathorga Voice
Joined: 05 Sep 2011 Posts: 14
|
Posted: Sat Oct 22, 2011 11:30 am Post subject: |
|
|
| not really working, i have done it before i posted first post |
|
| Back to top |
|
 |
Gordon Voice
Joined: 04 Apr 2007 Posts: 34
|
Posted: Sun Apr 07, 2013 7:58 pm Post subject: |
|
|
| can anyone look at it again? |
|
| Back to top |
|
 |
speechles Revered One

Joined: 26 Aug 2006 Posts: 1398 Location: emerald triangle, california (coastal redwoods)
|
Posted: Sun Apr 07, 2013 11:58 pm Post subject: |
|
|
| Code: | # Metal v1.0 2013-04-07
# metal-archives.com script
# (cl)2013 speechles
#
# TO ENABLE IN YOUR CHANNEL:
# .chanset #yourchan +metal
#
# TO SEARCH:
# ( use -search )
# !metal *band -search
# !metal -search *band*
# !metal band* -search
# !metal -search band
#
# TO DISPLAY RESULTS:
# ( don't use -search )
# !metal *band
# !metal *band*
# !metal band*
# !metal band
#
# speechles was here :P
package require http
setudef flag metal
namespace eval metal {
variable metal
# ---> start config
# trigger character
set metal(pref) "!"
# command used to reply to user
# this can be a list of space delimited commands
set metal(commands) "metal m"
# amount user can issue before throttle
set metal(throttle) 2
# throttle time
set metal(throttle_time) 30
# how many max results to display in search
set metal(amount) 3
# how many max albums to show in results pages
set metal(albums) 3
# url to metal page
set metal(page) http://www.metal-archives.com/search/ajax-band-search/?field=name&query=
# display line for many results
set metal(many) "\002%total\002 bands (showing first %amount)"
# display line for a few results
set metal(few) "\002%total\002 bands"
# display line for search
set metal(search) "\002%name\002 - %genre (%location) @ %url"
# display for no results found in search
set metal(no_results) "Sorry %nick, there are no results for %search."
# display character for splitting things
set metal(split) " | "
# script version
set metal(version) "1.0"
# In the future, maybe more of the display will be customizable
# through the config, until then... dance like an robot ;)
# <--- config ends
} |
| from irc wrote: | <speechles> !metal zoebea*
<bot> Zoebeast | Country of origin: Russia, Location: Saint Petersburg, Status: Active, Formed in: 2001, Genre: Death Metal/Grindcore, Lyrical themes: N/A, Current label: Coyote Records, Years active: 2001-present
<bot> Zoebeast | Members: ZDRCSD: Bass, Vocals; Professor: Drums; Enot: Guitars; Gorgonus: Guitars; Torden: Bass; Nik: Drums; Metallist: Drums; Kreator: Guitars (lead); Black Messiah: Guitars (lead); Dr. Death: Guitars (rhythm); Zaika: Vocals
<bot> Zoebeast | Albums: Incarnated Dreams; Full of Life; Unexpected Youth Pathology (...and 3 more)
<bot> Zoebeast | http://www.metal-archives.com/bands/Zoebeast/47781
<speechles> !metal zoebea* -search
<bot> 1 bands | Zoebeast - Death Metal/Grindcore (Russia) @ http://www.metal-archives.com/bands/Zoebeast/47781
<speechles> !metal zoebea*
<bot> 500 Ok ( http://www.metal-archives.com/search/ajax-band-search/?field=name&query=zoebea%2a )
<speechles> !metal zoebea* -search
<bot> speechles, you have been Throttled! You're going too fast and making my head spin! |
Here's a replacement for that script. That one was clumsy, using exec and wget??!!. It isn't exactly portable that way, user friendly, nor is it economical. This one is platform independent. It also mixes ajax calls with html calls to be more efficient.
I wasn't sure what exactly that other script output from the site. Never having seen what it did. This is my feeling of what should be output. If you need something more, let me know.
metal.tcl v1.0 _________________ speechles' eggdrop tcl archive |
|
| Back to top |
|
 |
kathorga Voice
Joined: 05 Sep 2011 Posts: 14
|
Posted: Thu Apr 18, 2013 9:33 am Post subject: |
|
|
Hmm It was announcing albums name something like:
<bot> band name | album name (year)
<bot> band name | album2 name (year)
etc
line by line
Would be you do it too? Your(i mean albums name) is listed in one line.
Rest is awesome. Thanks for reply
Also would be great to lookup any band if search result to f. ex. 10 same bands name. |
|
| Back to top |
|
 |
Gordon Voice
Joined: 04 Apr 2007 Posts: 34
|
Posted: Sat Apr 20, 2013 4:05 pm Post subject: |
|
|
| Quote: | # In the future, maybe more of the display will be customizable
# through the config, until then... dance like an robot  |
Id like to be able to set what bot should display, for example when i only want to see URL part..
Great job speechles. |
|
| Back to top |
|
 |
kathorga Voice
Joined: 05 Sep 2011 Posts: 14
|
|
| Back to top |
|
 |
disorder Voice
Joined: 16 Jun 2013 Posts: 1
|
Posted: Sun Jun 16, 2013 9:31 pm Post subject: metal.tcl |
|
|
| i got the same error, can this be fixed? |
|
| Back to top |
|
 |
kathorga Voice
Joined: 05 Sep 2011 Posts: 14
|
Posted: Sat Nov 02, 2013 6:43 am Post subject: |
|
|
I tested it on some linux distros, but only works on debian. All rest shows info like:
<@Bot> Illegal characters in url path ( http://www.metal-archives.com/bands/Iron_Maiden/25\ )
Speechles can you try fix it? |
|
| Back to top |
|
 |
speechles Revered One

Joined: 26 Aug 2006 Posts: 1398 Location: emerald triangle, california (coastal redwoods)
|
Posted: Sat Nov 02, 2013 4:49 pm Post subject: |
|
|
| Quote: | | Speechles can you try fix it? |
I can't replicate that error. It works for me.
| Quote: | <speechles> !metal iron maiden
Iron Maiden | Country of origin: United Kingdom; Location: London, England; Status: Active; Formed in: 1975; Genre: Heavy Metal/NWOBHM; Lyrical themes: History, Literature, War, Mythology, Space; Current label: EMI Records; Years active: 1975-present
Iron Maiden | Members: Steve Harris: Bass, Keyboards (1975-present); Dave Murray: Guitars (1976-1977, 1977-present); Adrian Smith: Guitars (1980-1990, 1999-present); Bruce Dickinson: Vocals (1981-1993, 1999-present); Nicko McBrain: Drums (1982-present); Janick Gers: Guitars (1990-present); Ron "Rebel" Matthews: Drums (1975-1977); Dave Sullivan: Guitars (1975-1976); Terry Rance: Guitars (1975-1976); Paul Mario
Iron Maiden | Albums: The Soundhouse Tapes; Running Free; Iron Maiden (...and 107 more)
Iron Maiden | http://www.metal-archives.com/bands/Iron_Maiden/25 |
http://ereader.kiczek.com/metal.tcl
If this _still_ isn't working. Please paste the "detail" line given to you when you sourced the script. Check your partyline for this line. If you just started the bot, get on partyline and .rehash and look for this line. | Code: | | Metal announcer.tcl v1.0 :: Http: 2.5.3;BotIsPatched: 0;EncodingSystem: iso8859-1;Tcl: 8.4;Eggdrop: 1.6.17;Suzi: NO |
What does yours say? _________________ speechles' eggdrop tcl archive |
|
| Back to top |
|
 |
kathorga Voice
Joined: 05 Sep 2011 Posts: 14
|
Posted: Sun Nov 03, 2013 1:29 pm Post subject: |
|
|
| Quote: | | If this _still_ isn't working. Please paste the "detail" line given to you when you sourced the script. Check your partyline for this line. If you just started the bot, get on partyline and .rehash and look for this line. |
I did .rehash and i got this:
| Code: | | metal announcer.tcl v1.0 loaded. |
I even installed same version of eggdrop (running eggdrop v1.6.17+SSL). Changed http.tcl to 2.7.5. Also same error. |
|
| Back to top |
|
 |
|