Discogs throws up 401 errors with queries containing apostrophes. So, I try to strip apostrophes (and other offending characters) from my queries. Everything else but apostrophes are stripped. Trying to include an escaped apostrophe (,) in the bolded array below doesn't work and including an apostrophe doesn't work due to the bordering bracket(?) apostrophes. Any other ideas?
input: 60's Beat Girls Collection, Vol. 1: Japanese Pop Cuties in Swingin' 60's
output: 60's Beat Girls Collection Vol 1 Japanese Pop Cuties in Swingin' 60's
I intended to use the code in a websource discogs (see [SearchBY] in OP), hence my attempt to workaround Discog's contempt (401 errors) for nearly all punctuation marks in the search query. I never tried it in an action script.
For example (album: Leaders Of The Pack: The Very Best Of The 60's Girls), running my discogs websource, the current code yields the following query:
EDIT: Even a simple removal of any non-alphanumeric characters (/[^a-zA-Z0-9]/g) still leaves apostrophes behind in the ParserScriptIndex. Something is very wrong here.
When I use the links to your examples I get this:
{"message": "You must authenticate to access this resource."}
I guess that is because I'm not authenticated on your account.
But using the default SRC script (discogs.src), I just searched for this: deliverin' the good's
There was 11 results.
So it seems it's possible to search with apostrophes in the string.
Then I modified the script with your regex replacements and tried again and got the same 11 search results.
Maybe it's something other than apostrophes that cause the problem.
So then I tried your original input example.
That produced the 401 error.
But when I tried the same string without the dot after "Vol" I got the "Sorry, no entries..." message.
I guess that means something.
Have fun sorting it out!
Maybe a real expert will help. I'll keep experimenting, but I don't know much about source scripts.
Okay, I am a dumbass. I now realize that bypassed my %albumartist% $if statement when trying out my code. All of this time I triggered that $if statement when testing the code out on compilation albums (albumartist=Various Artists). The escape character for apostrophes worked as expected, but I have to admit that DetlevD's regex looks a lot cleaner.
Anyways, thanks guys for the help. I'm no expert myself. I just read some docs, looked at some old sources and created a few unavailable ones for personal use.
You're never a dumbass when you make an honest mistake, but then find and correct it.
At least you had the decency to come back and explain (not that I understand ).
Not everybody does that.
DetlevD is one of the resident Regex experts around here. I'm not.