# \[WS\] RateYourMusic

**URL:** https://community.mp3tag.de/t/ws-rateyourmusic/8995
**Category:** Web Sources Scripts
**Created:** [September 21, 2009, 11:30am UTC](https://community.mp3tag.de/t/ws-rateyourmusic/8995 "2009-09-21T11:30:28Z")
**Posts on this page:** 20
**Page:** 5

<div class="post-metadata">

### Author: ![nathbot](https://community.mp3tag.de/user_avatar/community.mp3tag.de/nathbot/32/9028_2.png) [@nathbot](https://community.mp3tag.de/u/nathbot)
#### Post date: [January 28, 2023, 2:40pm UTC](https://community.mp3tag.de/t/ws-rateyourmusic/8995/81 "2023-01-28T14:40:35Z")

</div>

Hi @waterproof ,  
that's odd... so please don't mind me asking some obvious questions (beyond "Have you tried turning it off and on?" 😄 which unfortunately can't apply here).

1. Do you have the latest version of the script? (see my last message with version 2022-11-06 above) I'm asking because there is no killtag command on line 96... I'm not 100% sure the line number is reliable in error messages but who knows.

2. Which version of Mp3tag do you have? "Killtag" is definitely an existing command (cf [Developing Tag Sources – Mp3tag Documentation](https://docs.mp3tag.de/tag-sources/development/)) but perhaps it was added in a version more recent than yours... I had version 3.18 when I worked on the script in November, now I got 3.19 and it's still working for me.

3. If 1) and 2) check out, do you mind saying which album you searched for so I can try to reproduce the issue? With all the different types of albums, I may have missed a case during my last fixes.

---

<div class="post-metadata">

### Author: ![Florian](https://community.mp3tag.de/user_avatar/community.mp3tag.de/florian/32/5759_2.png) [@Florian](https://community.mp3tag.de/u/Florian)
#### Post date: [January 28, 2023, 2:42pm UTC](https://community.mp3tag.de/t/ws-rateyourmusic/8995/82 "2023-01-28T14:42:38Z")

</div>

> [@waterproof](#):
>
> unknown command 'killtag'

> [@nathbot](#):
>
> Which version of Mp3tag do you have?

It's pobably from the Mac version. I've just checked and `killtag` is not (yet) implemented there.

---

<div class="post-metadata">

### Author: ![waterproof](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/w/f19dbf/32.png) [@waterproof](https://community.mp3tag.de/u/waterproof)
#### Post date: [January 28, 2023, 3:03pm UTC](https://community.mp3tag.de/t/ws-rateyourmusic/8995/83 "2023-01-28T15:03:04Z")

</div>

That is it. Any plans to implement it in the near future ?

@nathbot is "Killtag" necessary to fetch genre tags from RYM or could I edit the script to make it work ?

---

<div class="post-metadata">

### Author: ![Florian](https://community.mp3tag.de/user_avatar/community.mp3tag.de/florian/32/5759_2.png) [@Florian](https://community.mp3tag.de/u/Florian)
#### Post date: [January 28, 2023, 3:13pm UTC](https://community.mp3tag.de/t/ws-rateyourmusic/8995/84 "2023-01-28T15:13:09Z")

</div>

> [@waterproof](#):
>
> Any plans to implement it in the near future ?

Yes, I'll add it with the next release now that I know it's used out in the wild.

---

<div class="post-metadata">

### Author: ![nathbot](https://community.mp3tag.de/user_avatar/community.mp3tag.de/nathbot/32/9028_2.png) [@nathbot](https://community.mp3tag.de/u/nathbot)
#### Post date: [January 28, 2023, 4:10pm UTC](https://community.mp3tag.de/t/ws-rateyourmusic/8995/85 "2023-01-28T16:10:45Z")

</div>

Thanks @Florian!  
In the meantime @waterproof, I tried using RegexReplace as an alternative. I did it quick and dirty so it might not be full-proof, but if it unblocks you until the next Mac update... try replacing the whole source code with this:

> **Click to expand code**
>
> ```auto
> # Mp3tag (v2.40+) parsing for RateYourMusic
> # created by dano
> #
> # This file should be in your sources dir. 
> # On Windows XP it's C:\Documents and Settings\*username*\Application Data\Mp3tag\data\sources
> #	
> #	-> DO NOT COPY/MODIFY AND REDISTRIBUTE THIS WITHOUT PERMISSION <- 
> #
> # update for RYM 2022 by nathbot
> # v5.0
> # v5.1
> # add RYM primary genres, secondary genres, description; fix for Various Artists
> # 2022-11-06
> # Fix details import when Released date has a year with no link
> # Integrate fix from User_name on separate RYM primary/secondary genre tags
> # Fix bug when getting artists in Various Artists releases
> 
> [Name]=RateYourMusic
> [BasedOn]=rateyourmusic.com
> [IndexUrl]=http://rateyourmusic.com/httprequest?searchterm=%s&type=l&page=1&action=Search&rym_ajax_req=1&request_token=
> [AlbumUrl]=http://rateyourmusic.com
> [WordSeperator]=+
> [IndexFormat]=%Cover%|%Artist%|%_url%|%Album%|%Year%|%Type%|%Publisher%|%Description%
> [SearchBy]=%album%
> [Encoding]=url-utf-8
> 
> [ParserScriptIndex]=...
> # ###################################################################
> # I N D E X
> # ###################################################################
> # debug "on" "debug_RateYourMusic_search.out" "10"
> # debugwriteinput "RateYourMusic_search.html"
> 
> findline "<table><tr class=\"infobox\">" 
> do	
> # Cover
> findinline "<table><tr class=\"infobox\">" 
> moveline 1
> findinline "<td class=\"page_search_img_cell\">"
> if "<div"
> moveline 2 1
> findinline "data-src=\"" 1 1
> if "//"
> say "Yes"
> moveline 4 1
> endif
> else
> moveline 2 1
> endif
> say "|"
>     
> # Artist
> # Always get artist name in latin characters
> RegexpReplace "(<a [^\<\>]+? class=\"artist\">)([^\<\>]+?<span class="subtext">\[)(.+?)(\]</span>)" "\1\3"
> # In case there are two artists, merge them into one name
> RegexpReplace "(class=\"artist\">[^\<\>]+?)</a> / <a [^\<\>]+? class=\"artist\">([^\<\>]+?</a>)" "\1 / \2"
> 
> findinline "class=\"artist\">"
> sayuntil "</a"
> say "|"
> 	
> # URL
> GoToChar 1
> findinline "<i><a"
> findinline "href=\""
> sayuntil "\""
> say "|"
> 	
> # Album
> GoToChar 1
> findinline "searchpage\">"
> sayuntil "<"
> say "|"			
> 	
> # Year
> moveline 2 1
> findline "width:4em;\">"
> findinline ">"
> sayuntil "<"
> say "|"
> 	
> # Type
> moveline 2 1
> findinline ">"
> sayuntil "<"
> say "|"
> 	
> 	
> ## Publisher	
> moveline 2 1
> sayregexp "(?<=\"label\">)[^<]+(?=<)" ", " 
> say "|"
> 	
> ## Desc
> 
> moveline 1 1
> findinline "</td>" 1
> if "<tr><td colspan=\"5\">"
> RegexpReplace "</?b[^>]*>" ""
> RegexpReplace "</?span[^>]*>" ""
> RegexpReplace "</?a[^>]*>" ""
> gotochar 1
> findinline "colspan=\"5\">" 1 1
> sayuntil "</td"
> endif
> 
> saynewline
> 	
> moveline 1 1
> moveline -1 1
> findinline "</table></td></tr></table></td></tr></table>" 1 1
> # unspace
> while " <br /><table>" 100
> 
> [ParserScriptAlbum]=...
> # ###################################################################
> # A L B U M
> # ###################################################################
> # debug "on" "debug_albumdetails.out" "10"
> # debugwriteinput "RateYourMusic_albumdetails.html"
> 
> # #######################
> # Album
> # #######################
> outputto "Album"
> findline "<div class=\"release_page\" itemprop=\"mainEntity\" itemscope itemtype=\"http://schema.org/MusicAlbum\">"
> findline "itemprop=\"name\""
> findinline "<meta content=\""
> sayuntil "\""
> 
> # #######################
> # RateYourMusic Album URL
> # #######################
> outputto "RateYourMusic Album URL"
> say "http://rateyourmusic.com"
> findline "itemprop=\"url\""
> findinline "<meta content=\""
> sayuntil "\""
> 
> # #######################
> # RateYourMusic Cover
> # #######################
> findline "alt=\"Cover art for "
> moveline -1 1
> findinline "src=\""
> outputto "Coverurl"
> say "http:"
> sayuntil "\""
> 
> # #######################
> # RateYourMusic Artist URL
> # #######################
> outputto "RateYourMusic Artist URL"
> say "http://rateyourmusic.com"
> gotoline 1
> findline "itemtype=\"http://schema.org/MusicGroup\">"
> findinline "itemprop=\"name\" href=\""
> sayuntil "\""
> 
> gotoline 1
> findline "<table class=\"album_info\">"
> 
> # #######################
> # Year
> # #######################
> findline "<th class=\"info_hdr\">Released"
> RegexpReplace "</?b[^>]*>" ""
> RegexpReplace "</?a[^>]*>" ""
> findinline "<td colspan="2">"
> findInLine " "
> findInLine " "
> OutputTo "YEAR"
> SayNextNumber
> 
> # #######################
> # Full date
> # #######################
> findline "<th class=\"info_hdr\">Released" 1
> # ## Remove tags in date
> RegexpReplace "</?a[^>]*>" ""
> RegexpReplace "</?b[^>]*>" ""
> # ### change order to year-month-day
> Replace " " " "
> RegexpReplace "([0-9]+) ([A-Za-z]+) ([0-9]+)" "\3-\2-\1"
> # ### replace month string by numbers
> Replace "January" "01"
> Replace "February" "02"
> Replace "March" "03"
> Replace "April" "04"
> Replace "May" "05"
> Replace "June" "06"
> Replace "July" "07"
> Replace "August" "08"
> Replace "September" "09"
> Replace "October" "10"
> Replace "November" "11"
> Replace "December" "12"
> # ## Add leading zero to days 1-9
> RegexpReplace "([0-9]{4}-[0-9]{2}-)([0-9][\s]*<)" "\10\2"
> OutputTo "FULLDATE"
> findinline "<td colspan=\"2\">" 1
> SayUntil "</td>"
> 
> # #######################
> # Genre(s)
> # #######################
> gotoline 1
> findline "class=\"release_genres\""
> # ## Primary genres
> findline "<span class=\"release_pri_genres\">"
> OutputTo "GENRE"
> sayregexp "(?<=/\">)[^<]+(?=</a)" "; "
> # ## Secondary genres
> findline "<br />"
> findinline "<br />"
> if "<span class=\"release_sec_genres\">"
> findline "<span class=\"release_sec_genres\">"
> findinline "<span class=\"release_sec_genres\">"
> if "<a "
> say "; "
> sayregexp "(?<=/\">)[^<]+(?=</a)" "; "
> endif
> endif
> 
> # #######################
> # Separate RYM Primary Genre tag (courtesy of User_name)
> # #######################
> gotoline 1
> findline "class=\"release_genres\""
> findline "<span class=\"release_pri_genres\">"
> OutputTo "RATEYOURMUSIC PRIMARY GENRE"
> # Note from nathbot: here the ";" separator can be changed to whatever you prefer. For "\\", enter "\\\\".
> sayregexp "(?<=/\">)[^<]+(?=</a)" ";"
> 
> # #######################
> # Separate RYM Secondary Genre tag (courtesy of User_name)
> # #######################
> findline "<br />"
> findinline "<br />"
> if "<span class=\"release_sec_genres\">"
> OutputTo "RATEYOURMUSIC SECONDARY GENRE"
> findline "<span class=\"release_sec_genres\">"
> # Note from nathbot: here the ";" separator can be changed to whatever you prefer. For "\\", enter "\\\\".
> sayregexp "(?<=/\">)[^<]+(?=</a)" ";"
> endif
> 
> # #######################
> # Descriptors (courtesy of User_name)
> # #######################
> gotoline 1
> OutputTo "RATEYOURMUSIC DESCRIPTORS"
> findline "<span class=\"release_pri_descriptors\">"
> Replace "<span class=\"release_pri_descriptors\">" ""
> # Note from nathbot: here the ";" separator can be changed to whatever you prefer. For "\\", enter "\\\\".
> Replace ", " ";"
> SayUntil "</span>"
> 
> gotoline 1
> findline "<table class=\"album_info\">"
> findline "<span itemprop=\"byArtist\""
> 
> # Artist and tracks
> 
> # Always get artist name in latin characters
> RegexpReplace "(<a [^\<\>]+? class=\"artist\">)([^\<\>]+?<span class="subtext">\[)(.+?)(\]</span>)" "\1\3"
> 
> findinline "class=\"artist\""
> movechar 1
> if "Various Artists"
> 
> ############################
> # Various Artists
> ############################
> 
> outputto "ALBUMARTIST"
> sayuntil "</a"
> 
> # Tracks
> gotoline 1
> findline "section_main_info section_outer"
> findline "show-for-small"
> MoveLine 1
> findline "show-for-small"
> MoveLine 1
> findline "show-for-small"
> findInLine "show-for-small"
> if "\"><div class=\"section_tracklisting\">"
> findline "section_tracklisting"
> findline "id=\"tracks_mobile\""
> JoinUntil "track_preview_tracks_mobile"
> 
> # Always get artist name in latin characters
> RegexpReplace "(<a [^\<\>]+? class=\"artist\">)([^\<\>]+?<span class="subtext">\[)(.+?)(\]</span>)" "\1\3"
> 
> # Clean up spaces between tags
> RegexpReplace "[\s\t]+<" "<"
> RegexpReplace ">[\s\t]+" ">"
> # Get rid of "disc one", "disc two"... lines
> RegexpReplace "<span class=\"rendered_text\"><strong class=\"rymfmt\">Disc[^\<\>]+?</strong></span>" ""
> # Remove tables
> RegexpReplace "<table[^\<\>]+?>.+?</table>" ""
> # Multiple artists on the track: join them with ;
> RegexpReplace "</a>(&amp;|and|,)<a [^\<\>]+? class=\"artist\">" "; "
> RegexpReplace "</a>/<a [^\<\>]+? class=\"artist\">" "; "
> 
> # Remove some unused stuff
> RegexpReplace "<div class="credits_roles">[^\<\>]+?</div>" ""
> 
> GoToChar 1
> 
> # Track artist
> 
> outputto "Artist"
> 		
> do
> 
> findInLine "<span class=\"rendered_text\">"
> if "<a"
> findInLine "class="\artist\">"
> SayUntil "</a>"
> movechar 4
> if "&amp;"
> Say " "
> SayUntil " - "
> endif
> else
> # No artist
> Say "No Artist"
> endif
> Say "|"
> findInLine "</li>"
> if "<li class=\"track\">"
> else
> findInLine "</li>" 1 1
> endif
> 
> while "<li class=\"track\">"
> 
> GoToChar 1
> # Erase any artist name before we get track names
> RegexpReplace "(<span class=\"rendered_text\">)<a[^\<\>]*? class=\"artist\">[^\<\>]+?</a>([^\<\>]+?</span>)" "\1\2"
> RegexpReplace "(<span class=\"rendered_text\">)&amp;[^\-]+?- " "\1"
> RegexpReplace "(<span class=\"rendered_text\">)- ([^\<\>]+?</span>)" "\1\2"
> 
> # Track title
> outputto "Tracks"
> 		
> do
> 
> findInLine "\"rendered_text\">" 1
> SayUntil "</span>"
> 
> # Is there a Featuring?
> findInLine "<div style=\"clear:both;\"></div></div>"
> 
> if "</li>"
> # No credits
> else
> findInLine "<ul class=\"credits\">"
> if "<li class=\"featured_credit\"><b>feat.</b>"
> Say " (feat. "
> findInLine "class=\"artist\">"
> SayUntil "</a>"
> Say ")"
> endif
> findInLine "</ul>"
> endif
> 
> Say "|"
> findInLine "</li>"
> 
> while "<li class=\"track\">"
> else
> # no tracks
> endif
> 
> else
> outputto "ALBUMARTIST"
> ############################
> # Not Various Artists
> ############################
> 
> # Album artist
> 
> # In case there are two artists, merge them into one name for Album Artist
> gotochar 1
> RegexpReplace "(class=\"artist\">[^\<\>]+?)</a> &amp; <a [^\<\>]+? class=\"artist\">([^\<\>]+?</a>)" "\1 / \2"
> RegexpReplace "(class=\"artist\">[^\<\>]+?)</a> / <a [^\<\>]+? class=\"artist\">([^\<\>]+?</a>)" "\1 / \2"
> 	
> # Write tag
> # findinline "class=\"artist\">"
> outputto "ALBUMARTIST"
> # sayuntil "</a>"
> # sayregexp "(?<=class=\"artist\">)(.*?)(?=</a>)" ";"
> 	
> do
> findInLine "class=\"artist\">"
> sayuntil "</a>"
> findInLine "</a>"
> if "<br />"
> say ";"
> endif
> while "<br />"
> 
> # Tracks
> ############
> gotoline 1
> findline "section_main_info section_outer"
> findline "show-for-small"
> MoveLine 1
> findline "show-for-small"
> MoveLine 1
> findline "show-for-small"
> findInLine "show-for-small"
> if "\"><div class=\"section_tracklisting\">"
> findline "section_tracklisting"
> findline "id=\"tracks_mobile\""
> JoinUntil "track_preview_tracks_mobile"
> 
> # Always get artist name in latin characters
> RegexpReplace "(<a [^\<\>]+? class=\"artist\">)([^\<\>]+?<span class="subtext">\[)(.+?)(\]</span>)" "\1\3"
> 
> # Clean up spaces between tags
> RegexpReplace "[\s\t]+<" "<"
> RegexpReplace ">[\s\t]+" ">"
> # Get rid of "disc one", "disc two"... lines
> RegexpReplace "<li class=\"track\"><div class=\"tracklist_line\" style=\"width:100%;\"><span class=\"tracklist_num\"></span><span class=\"tracklist_title\"><span><span class=\"rendered_text\"><b>[^\<\>]+?</b></span></span><span class=\"tracklist_duration\" data-inseconds=\"0\"></span></span><div style=\"clear:both;\"></div></div></li>" ""
> # Remove tables
> RegexpReplace "<table[^\<\>]+?>.+?</table>" ""
> # Multiple artists on the track: join them with ;
> RegexpReplace "</a>&amp;<a [^\<\>]+? class=\"artist\">" "; "
> RegexpReplace "</a>/<a [^\<\>]+? class=\"artist\">" "; "
> 
> # See if tracks have individual artist (like in a split with 2 artists)
> findinline "<span class=\"rendered_text\">"
> if "<a title=\"[Artist"
> outputto "Artist"
> RegexpReplace "<span class=\"rendered_text\">([^\>\<].+?)</span>" "<span class=\"rendered_text\"><a class=\"artist\">No artist</a> - \1</span>"
> RegexpReplace "(<span class=\"rendered_text\"><a [^\<\>]+?) (class=\"artist\">)([^\<\>]+?<span class="subtext">\[)?(.+?)(\]</span>)?" "\1 class=\"main artist\">\4"
> gotochar 1
> findinline "<li class=\"track\">"
> do
> findInLine "class=\"main artist\">"
> sayuntil "</a>"
> findInLine "</li>"
> say "|"
> while "<li class=\"track\">"
> # sayregexp "(?<=class=\"main artist\">)(.*?)(?=</a>)" "|"
> else
> outputto "Artist"
> sayOutput "ALBUMARTIST"
> endif
> 
> GoToChar 1
> # Erase any artist name before we get track names
> RegexpReplace "(<span class=\"rendered_text\">)<a[^\<\>]*? class=\"main artist\">[^\<\>]+?</a>- ([^\<\>]+?</span>)" "\1\2"
> 
> # Track title
> outputto "Tracks"
> 
> do
> 
> findInLine "class=\"rendered_text\">"
> SayUntil "</span>"
> 
> # Is there a Featuring?
> findInLine "<div style=\"clear:both;\"></div></div>"
> 
> if "</li>"
> # No credits
> else
> findInLine "<ul class=\"credits\">"
> if "<li class=\"featured_credit\"><b>feat.</b>"
> Say " (feat. "
> findInLine "class=\"artist\">"
> SayUntil "</a>"
> Say ")"
> endif
> findInLine "</ul>"
> endif
> 
> Say "|"
> findInLine "</li>"
> 
> while "<li class=\"track\">"
> 		
> else
> # no tracks
> endif
> endif
> 
> ```

---

<div class="post-metadata">

### Author: ![waterproof](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/w/f19dbf/32.png) [@waterproof](https://community.mp3tag.de/u/waterproof)
#### Post date: [January 30, 2023, 9:45am UTC](https://community.mp3tag.de/t/ws-rateyourmusic/8995/86 "2023-01-30T09:45:39Z")

</div>

Thanks @nathbot !

Now the request goes through with some albums, but most of the time I get : ERROR(L59/findinline): text not found. When the request is activated, I almost never get the right album in the list of suggestions, though.

---

<div class="post-metadata">

### Author: ![Florian](https://community.mp3tag.de/user_avatar/community.mp3tag.de/florian/32/5759_2.png) [@Florian](https://community.mp3tag.de/u/Florian)
#### Post date: [February 3, 2023, 11:14am UTC](https://community.mp3tag.de/t/ws-rateyourmusic/8995/87 "2023-02-03T11:14:29Z")

</div>

While working on adding support for the `KillTag` command on macOS, I've noticed a small issue with the script:

`findInLine "class="\artist\">"` should be  
`findInLine "class=\"artist\">"`

---

<div class="post-metadata">

### Author: ![Florian](https://community.mp3tag.de/user_avatar/community.mp3tag.de/florian/32/5759_2.png) [@Florian](https://community.mp3tag.de/u/Florian)
#### Post date: [February 6, 2023, 10:19am UTC](https://community.mp3tag.de/t/ws-rateyourmusic/8995/88 "2023-02-06T10:19:40Z")

</div>

> [@Florian](#):
>
> I've just checked and `killtag` is not (yet) implemented there.

This is now fixed with Mp3tag for Mac v1.7.4. Thanks for pointing!

---

<div class="post-metadata">

### Author: ![chthonic](https://community.mp3tag.de/user_avatar/community.mp3tag.de/chthonic/32/13561_2.png) [@chthonic](https://community.mp3tag.de/u/chthonic)
#### Post date: [March 17, 2023, 9:07pm UTC](https://community.mp3tag.de/t/ws-rateyourmusic/8995/89 "2023-03-17T21:07:57Z")

</div>

I'm getting this error when I try to find artists with Japanese characters in them. I tried with only english letters and it works fine. It searches the artist, finds the artist, but gives out this error when selecting the artist to get the metadata from.

![Screenshot 2023-03-17 140530](https://community.mp3tag.de/uploads/default/original/2X/9/9111be60fab5d6760f1cf05883b3416036f3df6a.png)

---

<div class="post-metadata">

### Author: ![nathbot](https://community.mp3tag.de/user_avatar/community.mp3tag.de/nathbot/32/9028_2.png) [@nathbot](https://community.mp3tag.de/u/nathbot)
#### Post date: [March 18, 2023, 11:57am UTC](https://community.mp3tag.de/t/ws-rateyourmusic/8995/90 "2023-03-18T11:57:48Z")

</div>

Update: [RateYourMusic 2023-03-18]  
([Dropbox - RateYourMusic\_20230318.zip - Simplify your life](https://www.dropbox.com/s/8y26dgmw4iv031s/RateYourMusic_20230318.zip?dl=0))

@waterproof Today I've been getting 0 results on all my album searches with a "text not found" error on line 59 like you. Here is an update that fixes it, let me know if it's still not OK for you.

@chthonic I can reproduce your problem, it's clearly an encoding issue, even though the debug info for the search results does show the URL correctly encoded for Japanese results:  
Yes|Mao Denda|/release/single/傳田真央/one-last-kiss/|One Last Kiss|2001|CD||  
(not exactly the URL you were trying to get, but I don't think it matters)

I'm afraid I don't know how to fix it...

@Florian Can you help, by any chance?

---

<div class="post-metadata">

### Author: ![Florian](https://community.mp3tag.de/user_avatar/community.mp3tag.de/florian/32/5759_2.png) [@Florian](https://community.mp3tag.de/u/Florian)
#### Post date: [March 22, 2023, 4:40pm UTC](https://community.mp3tag.de/t/ws-rateyourmusic/8995/91 "2023-03-22T16:40:31Z")

</div>

Yes, it's an encoding issue that seems to be special to this site. The problem is, that the fragment `/release/single/傳田真央/one-last-kiss/` is not part of a [valid URL](https://www.ietf.org/rfc/rfc3986.txt).

Mp3tag expects the invalid parts of a URL (the Japanese characters in this case) to be percent-encoded at this stage. I'm not sure how to handle this yet — without breaking other things.

I've also noticed that the issue I've [mentioned above](https://community.mp3tag.de/t/ws-rateyourmusic/8995/87) is still present with this version of the script and that it produces an error if the text in L447 isn't found.

---

<div class="post-metadata">

### Author: ![zeka](https://community.mp3tag.de/user_avatar/community.mp3tag.de/zeka/32/13892_2.png) [@zeka](https://community.mp3tag.de/u/zeka)
#### Post date: [May 25, 2023, 11:20am UTC](https://community.mp3tag.de/t/ws-rateyourmusic/8995/92 "2023-05-25T11:20:45Z")

</div>

Hey there, I'm super new to regex. I've been trying to edit this script all evening to no avail.

Is there a way to edit the script so that it doesn't fetch secondary genres and to only fetch the first primary genre listed?

Thanks in advance!

---

<div class="post-metadata">

### Author: ![ohrenkino](https://community.mp3tag.de/user_avatar/community.mp3tag.de/ohrenkino/32/4843_2.png) [@ohrenkino](https://community.mp3tag.de/u/ohrenkino)
#### Post date: [May 25, 2023, 12:36pm UTC](https://community.mp3tag.de/t/ws-rateyourmusic/8995/93 "2023-05-25T12:36:31Z")

</div>

If you do not succeed with regular expressions in the script ...  
You could create an action to remove duplicate fields after you have used the script:

> **[Remove Duplicate Fields – Mp3tag Documentation](https://docs.mp3tag.de/actions/remove-duplicate-fields/)**
>
> Documentation on the Remove Duplicate Fields action type that can be performed as Quick Action or as reusable workflow from Action Groups. Mp3tag is the universal Tag Editor.

---

<div class="post-metadata">

### Author: ![User\_name](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/u/bbce88/32.png) [@User\_name](https://community.mp3tag.de/u/User_name)
#### Post date: [May 25, 2023, 2:43pm UTC](https://community.mp3tag.de/t/ws-rateyourmusic/8995/94 "2023-05-25T14:43:11Z")

</div>

I just did this to get only the first primary genre.  
I haven't tested it much, and I don't know much about scripting, so there may be errors.

> **Click to expand code**
>
> ```auto
> # #######################
> # First RYM Primary Genre tag
> # #######################
> gotoline 1
> findline "class=\"release_genres\""
> findline "<span class=\"release_pri_genres\">"
> OutputTo "RATEYOURMUSIC FIRST PRIMARY GENRE"
> findinline "<span class=\"release_pri_genres\">"
> if "<a class=\"genre\""
> findinline "a class=\"genre\""
> findinline "\">"
> sayuntil "</a>"
> endif
> 
> ```

---

<div class="post-metadata">

### Author: ![zeka](https://community.mp3tag.de/user_avatar/community.mp3tag.de/zeka/32/13892_2.png) [@zeka](https://community.mp3tag.de/u/zeka)
#### Post date: [May 25, 2023, 7:23pm UTC](https://community.mp3tag.de/t/ws-rateyourmusic/8995/95 "2023-05-25T19:23:50Z")

</div>

```auto
# Mp3tag (v2.40+) parsing for RateYourMusic
# created by dano
#
# This file should be in your sources dir. 
# On Windows XP it's C:\Documents and Settings\*username*\Application Data\Mp3tag\data\sources
#	
#	-> DO NOT COPY/MODIFY AND REDISTRIBUTE THIS WITHOUT PERMISSION <- 
#
# update for RYM 2022 by nathbot
# v5.0
# v5.1
# add RYM primary genres, secondary genres, description; fix for Various Artists
# 2022-11-06
# Fix details import when Released date has a year with no link
# Integrate fix from User_name on separate RYM primary/secondary genre tags
# Fix bug when getting artists in Various Artists releases

[Name]=RateYourMusic
[BasedOn]=rateyourmusic.com
[IndexUrl]=http://rateyourmusic.com/httprequest?searchterm=%s&type=l&page=1&action=Search&rym_ajax_req=1&request_token=
[AlbumUrl]=http://rateyourmusic.com
[WordSeperator]=+
[IndexFormat]=%Cover%|%Artist%|%_url%|%Album%|%Year%|%Type%|%Publisher%|%Description%
[SearchBy]=%album%
[Encoding]=url-utf-8

[ParserScriptIndex]=...
# ###################################################################
# I N D E X
# ###################################################################
# debug "on" "debug_RateYourMusic_search.out" "10"
# debugwriteinput "RateYourMusic_search.html"

findline "<table><tr class=\"infobox\">" 
do	
	# Cover
	findinline "<table><tr class=\"infobox\">" 
	moveline 1
	findinline "<td class=\"page_search_img_cell\">"
	if "<div"
		moveline 2 1
		findinline "data-src=\"" 1 1
		if "//"
			say "Yes"
			moveline 4 1
		endif
	else
		moveline 2 1
	endif
	say "|"
    
	# Artist
	# Always get artist name in latin characters
	RegexpReplace "(<a [^\<\>]+? class=\"artist\">)([^\<\>]+?<span class="subtext">\[)(.+?)(\]</span>)" "\1\3"
	# In case there are two artists, merge them into one name
	RegexpReplace "(class=\"artist\">[^\<\>]+?)</a> / <a [^\<\>]+? class=\"artist\">([^\<\>]+?</a>)" "\1 / \2"

	findLine "<td style=\""
	findinline "class=\"artist\">"
	sayuntil "</a"
	say "|"
	
	# URL
	GoToChar 1
	findinline "<i><a"
	findinline "href=\""
	sayuntil "\""
	say "|"
	
	# Album
	GoToChar 1
  findinline "searchpage\">"
	sayuntil "<"
	say "|"			
	
	# Year
	moveline 2 1
	findline "width:4em;\">"
	findinline ">"
	sayuntil "<"
	say "|"
	
	# Type
	moveline 2 1
	findinline ">"
	sayuntil "<"
	say "|"
	
	
	## Publisher	
	moveline 2 1
	sayregexp "(?<=\"label\">)[^<]+(?=<)" ", " 
	say "|"
	
	## Desc

	moveline 1 1
	findinline "</td>" 1
	if "<tr><td colspan=\"5\">"
		killtag "b"
		killtag "/b"
		killtag "span"
		killtag "/span"
		killtag "a"
		killtag "/a"
		gotochar 1
		findinline "colspan=\"5\">" 1 1
		sayuntil "</td"
	endif

	saynewline
	
	moveline 1 1
	moveline -1 1
	findinline "</table></td></tr></table></td></tr></table>" 1 1
	# unspace
while " <br /><table>" 100

[ParserScriptAlbum]=...
# ###################################################################
# A L B U M
# ###################################################################
# debug "on" "debug_albumdetails.out" "10"
# debugwriteinput "RateYourMusic_albumdetails.html"

# #######################
# Album
# #######################
outputto "Album"
findline "<div class=\"release_page\" itemprop=\"mainEntity\" itemscope itemtype=\"http://schema.org/MusicAlbum\">"
findline "itemprop=\"name\""
findinline "<meta content=\""
sayuntil "\""

# #######################
# RateYourMusic Album URL
# #######################
outputto "RateYourMusic Album URL"
say "http://rateyourmusic.com"
findline "itemprop=\"url\""
findinline "<meta content=\""
sayuntil "\""

# #######################
# RateYourMusic Cover
# #######################
findline "alt=\"Cover art for "
moveline -1 1
findinline "src=\""
outputto "Coverurl"
say "http:"
sayuntil "\""

# #######################
# RateYourMusic Artist URL
# #######################
outputto "RateYourMusic Artist URL"
say "http://rateyourmusic.com"
gotoline 1
findline "itemtype=\"http://schema.org/MusicGroup\">"
findinline "itemprop=\"name\" href=\""
sayuntil "\""

gotoline 1
findline "<table class=\"album_info\">"

# #######################
# Year
# #######################
findline "<th class=\"info_hdr\">Released"
KillTag "a"
KillTag "/a"
KillTag "b"
KillTag "/b"
findinline "<td colspan="2">"
findInLine " "
findInLine " "
OutputTo "YEAR"
SayNextNumber

# #######################
# Full date
# #######################
findline "<th class=\"info_hdr\">Released" 1
# ## Remove tags in date
KillTag "a"
KillTag "/a"
KillTag "b"
KillTag "/b"
# ### change order to year-month-day
Replace " " " "
RegexpReplace "([0-9]+) ([A-Za-z]+) ([0-9]+)" "\3-\2-\1"
# ### replace month string by numbers
Replace "January" "01"
Replace "February" "02"
Replace "March" "03"
Replace "April" "04"
Replace "May" "05"
Replace "June" "06"
Replace "July" "07"
Replace "August" "08"
Replace "September" "09"
Replace "October" "10"
Replace "November" "11"
Replace "December" "12"
# ## Add leading zero to days 1-9
RegexpReplace "([0-9]{4}-[0-9]{2}-)([0-9][\s]*<)" "\10\2"
OutputTo "FULLDATE"
findinline "<td colspan=\"2\">" 1
SayUntil "</td>"

# #######################
# First RYM Primary Genre tag
# #######################
gotoline 1
findline "class=\"release_genres\""
findline "<span class=\"release_pri_genres\">"
OutputTo "GENRE"
findinline "<span class=\"release_pri_genres\">"
if "<a class=\"genre\""
	findinline "a class=\"genre\""
	findinline "\">"
	sayuntil "</a>"
endif

# #######################
# Descriptors (courtesy of User_name)
# #######################
gotoline 1
OutputTo "RATEYOURMUSIC DESCRIPTORS"
findline "<span class=\"release_pri_descriptors\">"
Replace "<span class=\"release_pri_descriptors\">" ""
# Note from nathbot: here the ";" separator can be changed to whatever you prefer. For "\\", enter "\\\\".
Replace ", " ";"
SayUntil "</span>"

gotoline 1
findline "<table class=\"album_info\">"
findline "<span itemprop=\"byArtist\""

# Artist and tracks

# Always get artist name in latin characters
RegexpReplace "(<a [^\<\>]+? class=\"artist\">)([^\<\>]+?<span class="subtext">\[)(.+?)(\]</span>)" "\1\3"

findinline "class=\"artist\""
movechar 1
if "Various Artists"

	############################
	# Various Artists
	############################

	outputto "ALBUMARTIST"
	sayuntil "</a"

	# Tracks
	gotoline 1
	findline "section_main_info section_outer"
	findline "show-for-small"
	MoveLine 1
	findline "show-for-small"
	MoveLine 1
	findline "show-for-small"
	findInLine "show-for-small"
	if "\"><div class=\"section_tracklisting\">"
		findline "section_tracklisting"
		findline "id=\"tracks_mobile\""
		JoinUntil "track_preview_tracks_mobile"

		# Always get artist name in latin characters
		RegexpReplace "(<a [^\<\>]+? class=\"artist\">)([^\<\>]+?<span class="subtext">\[)(.+?)(\]</span>)" "\1\3"

		# Clean up spaces between tags
		RegexpReplace "[\s\t]+<" "<"
		RegexpReplace ">[\s\t]+" ">"
		# Get rid of "disc one", "disc two"... lines
		RegexpReplace "<span class=\"rendered_text\"><strong class=\"rymfmt\">Disc[^\<\>]+?</strong></span>" ""
		# Remove tables
		RegexpReplace "<table[^\<\>]+?>.+?</table>" ""
		# Multiple artists on the track: join them with ;
		RegexpReplace "</a>(&amp;|and|,)<a [^\<\>]+? class=\"artist\">" "; "
		RegexpReplace "</a>/<a [^\<\>]+? class=\"artist\">" "; "

		# Remove some unused stuff
		RegexpReplace "<div class="credits_roles">[^\<\>]+?</div>" ""

		GoToChar 1

		# Track artist

		outputto "Artist"
		
		do

			findInLine "<span class=\"rendered_text\">"
			if "<a"
				findInLine "class="\artist\">"
				SayUntil "</a>"
				movechar 4
				if "&amp;"
					Say " "
					SayUntil " - "
				endif
			else
				# No artist
				Say "No Artist"
			endif
			Say "|"
			findInLine "</li>"
			if "<li class=\"track\">"
			else
				findInLine "</li>" 1 1
			endif

		while "<li class=\"track\">"

		GoToChar 1
		# Erase any artist name before we get track names
		RegexpReplace "(<span class=\"rendered_text\">)<a[^\<\>]*? class=\"artist\">[^\<\>]+?</a>([^\<\>]+?</span>)" "\1\2"
		RegexpReplace "(<span class=\"rendered_text\">)&amp;[^\-]+?- " "\1"
		RegexpReplace "(<span class=\"rendered_text\">)- ([^\<\>]+?</span>)" "\1\2"

		# Track title
		outputto "Tracks"
		
		do

			findInLine "\"rendered_text\">" 1
			SayUntil "</span>"

			# Is there a Featuring?
			findInLine "<div style=\"clear:both;\"></div></div>"

			if "</li>"
				# No credits
			else
				findInLine "<ul class=\"credits\">"
				if "<li class=\"featured_credit\"><b>feat.</b>"
					Say " (feat. "
					findInLine "class=\"artist\">"
					SayUntil "</a>"
					Say ")"
				endif
				findInLine "</ul>"
			endif

			Say "|"
			findInLine "</li>"

		while "<li class=\"track\">"
	else
		# no tracks
	endif

else
	outputto "ALBUMARTIST"
	############################
	# Not Various Artists
	############################

	# Album artist

	# In case there are two artists, merge them into one name for Album Artist
	gotochar 1
	RegexpReplace "(class=\"artist\">[^\<\>]+?)</a> &amp; <a [^\<\>]+? class=\"artist\">([^\<\>]+?</a>)" "\1 / \2"
	RegexpReplace "(class=\"artist\">[^\<\>]+?)</a> / <a [^\<\>]+? class=\"artist\">([^\<\>]+?</a>)" "\1 / \2"
	
	# Write tag
	# findinline "class=\"artist\">"
	outputto "ALBUMARTIST"
	# sayuntil "</a>"
	# sayregexp "(?<=class=\"artist\">)(.*?)(?=</a>)" ";"
	
	do
		findInLine "class=\"artist\">"
		sayuntil "</a>"
		findInLine "</a>"
		if "<br />"
			say ";"
		endif
	while "<br />"

	# Tracks
	############
	gotoline 1
	findline "section_main_info section_outer"
	findline "show-for-small"
	MoveLine 1
	findline "show-for-small"
	MoveLine 1
	findline "show-for-small"
	findInLine "show-for-small"
	if "\"><div class=\"section_tracklisting\">"
		findline "section_tracklisting"
		findline "id=\"tracks_mobile\""
		JoinUntil "track_preview_tracks_mobile"

		# Always get artist name in latin characters
		RegexpReplace "(<a [^\<\>]+? class=\"artist\">)([^\<\>]+?<span class="subtext">\[)(.+?)(\]</span>)" "\1\3"

		# Clean up spaces between tags
		RegexpReplace "[\s\t]+<" "<"
		RegexpReplace ">[\s\t]+" ">"
		# Get rid of "disc one", "disc two"... lines
		RegexpReplace "<li class=\"track\"><div class=\"tracklist_line\" style=\"width:100%;\"><span class=\"tracklist_num\"></span><span class=\"tracklist_title\"><span><span class=\"rendered_text\"><b>[^\<\>]+?</b></span></span><span class=\"tracklist_duration\" data-inseconds=\"0\"></span></span><div style=\"clear:both;\"></div></div></li>" ""
		# Remove tables
		RegexpReplace "<table[^\<\>]+?>.+?</table>" ""
		# Multiple artists on the track: join them with ;
		RegexpReplace "</a>&amp;<a [^\<\>]+? class=\"artist\">" "; "
		RegexpReplace "</a>/<a [^\<\>]+? class=\"artist\">" "; "

		# See if tracks have individual artist (like in a split with 2 artists)
		findinline "<span class=\"rendered_text\">"
		if "<a title=\"[Artist"
			outputto "Artist"
			RegexpReplace "<span class=\"rendered_text\">([^\>\<].+?)</span>" "<span class=\"rendered_text\"><a class=\"artist\">No artist</a> - \1</span>"
			RegexpReplace "(<span class=\"rendered_text\"><a [^\<\>]+?) (class=\"artist\">)([^\<\>]+?<span class="subtext">\[)?(.+?)(\]</span>)?" "\1 class=\"main artist\">\4"
			gotochar 1
			findinline "<li class=\"track\">"
			do
				findInLine "class=\"main artist\">"
				sayuntil "</a>"
				findInLine "</li>"
				say "|"
			while "<li class=\"track\">"
			# sayregexp "(?<=class=\"main artist\">)(.*?)(?=</a>)" "|"
		else
			outputto "Artist"
			sayOutput "ALBUMARTIST"
		endif

		GoToChar 1
		# Erase any artist name before we get track names
		RegexpReplace "(<span class=\"rendered_text\">)<a[^\<\>]*? class=\"main artist\">[^\<\>]+?</a>- ([^\<\>]+?</span>)" "\1\2"

		# Track title
		outputto "Tracks"

		do

			findInLine "class=\"rendered_text\">"
			SayUntil "</span>"

			# Is there a Featuring?
			findInLine "<div style=\"clear:both;\"></div></div>"

			if "</li>"
				# No credits
			else
				findInLine "<ul class=\"credits\">"
				if "<li class=\"featured_credit\"><b>feat.</b>"
					Say " (feat. "
					findInLine "class=\"artist\">"
					SayUntil "</a>"
					Say ")"
				endif
				findInLine "</ul>"
			endif

			Say "|"
			findInLine "</li>"

		while "<li class=\"track\">"
		
	else
		# no tracks
	endif
endif

```

Thank you! This did it!

---

<div class="post-metadata">

### Author: ![nathbot](https://community.mp3tag.de/user_avatar/community.mp3tag.de/nathbot/32/9028_2.png) [@nathbot](https://community.mp3tag.de/u/nathbot)
#### Post date: [June 11, 2023, 9:00pm UTC](https://community.mp3tag.de/t/ws-rateyourmusic/8995/96 "2023-06-11T21:00:53Z")

</div>

Hi @Florian ,  
I'm a bit late... for some reason I stopped receiving email notifications.  
I updated the script with the fix you mentioned, thanks for noticing.

> **[RateYourMusic\_20230611.zip](https://www.dropbox.com/s/0vjy052xfvvkeqs/RateYourMusic_20230611.zip?dl=0)**
>
> Shared with Dropbox

About the URL encoding issue, any chance you can add a function that encodes a URL to a valid one? (like encodeURI in Javascript)  
In theory it should then work with something like /release/single/%E5%82%B3%E7%94%B0%E7%9C%9F%E5%A4%AE/one-last-kiss/

---

<div class="post-metadata">

### Author: ![Habanero](https://community.mp3tag.de/user_avatar/community.mp3tag.de/habanero/32/8241_2.png) [@Habanero](https://community.mp3tag.de/u/Habanero)
#### Post date: [July 21, 2023, 11:59pm UTC](https://community.mp3tag.de/t/ws-rateyourmusic/8995/97 "2023-07-21T23:59:35Z")

</div>

Would it be possible to pull the Classifier (labeled internally as Descriptor:XXXXX) name as well? It's useful for doujin music because it contains the release events. For example, [Comiket](https://rateyourmusic.com/classifiers/Comiket+85/).

---

<div class="post-metadata">

### Author: ![User\_name](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/u/bbce88/32.png) [@User\_name](https://community.mp3tag.de/u/User_name)
#### Post date: [July 22, 2023, 1:50am UTC](https://community.mp3tag.de/t/ws-rateyourmusic/8995/98 "2023-07-22T01:50:48Z")

</div>

I've done this, but I've hardly tested it. I don't know if there can be several Classifiers (in which case it won't work).

> **Click to expand code**
>
> ```auto
> # #######################
> # RateYourMusic Classifier
> # #######################
> gotoline 1
> findline "<span class=\"release_info_classifiers\">"
> findinline "<span class=\"release_info_classifiers\">"
> if "<a title=\"[Descriptor"
> outputto "RATEYOURMUSIC CLASSIFIER"
> findinline "href=\""
> findinline "\">"
> sayuntil "</a>"
> endif
> 
> ```

You can insert this block after the _RateYourMusic Artist URL_ block, on line 165-166 in the last update of the _Search by Album.src_ file.

---

<div class="post-metadata">

### Author: ![Habanero](https://community.mp3tag.de/user_avatar/community.mp3tag.de/habanero/32/8241_2.png) [@Habanero](https://community.mp3tag.de/u/Habanero)
#### Post date: [July 22, 2023, 2:13am UTC](https://community.mp3tag.de/t/ws-rateyourmusic/8995/99 "2023-07-22T02:13:33Z")

</div>

> [@User\_name](#):
>
> ```auto
> # #######################
> # RateYourMusic Classifier
> # #######################
> gotoline 1
> findline "<span class=\"release_info_classifiers\">"
> findinline "<span class=\"release_info_classifiers\">"
> if "<a title=\"[Descriptor"
> outputto "RATEYOURMUSIC CLASSIFIER"
> findinline "href=\""
> findinline "\">"
> sayuntil "</a>"
> endif
> 
> ```

Seems to work, thanks for the quick reply.

---

<div class="post-metadata">

### Author: ![nathbot](https://community.mp3tag.de/user_avatar/community.mp3tag.de/nathbot/32/9028_2.png) [@nathbot](https://community.mp3tag.de/u/nathbot)
#### Post date: [July 22, 2023, 11:27am UTC](https://community.mp3tag.de/t/ws-rateyourmusic/8995/100 "2023-07-22T11:27:14Z")

</div>

Here is the updated full script to include @User_name's Classifier code, thanks for the addition.

> **[RateYourMusic\_20230722.zip](https://www.dropbox.com/s/mrzz3n1z8ekelbg/RateYourMusic_20230722.zip?dl=0)**
>
> Shared with Dropbox

[Previous page](https://community.mp3tag.de/t/ws-rateyourmusic/8995.md?page=4)

[Next page](https://community.mp3tag.de/t/ws-rateyourmusic/8995.md?page=6)
