murdos / musicbrainz-userscripts

Collection of userscripts for MusicBrainz, by various authors
554 stars 92 forks source link

VGMDB importer doesn't work on some albums #528

Closed Parsnip closed 1 year ago

Parsnip commented 1 year ago

Heyo.

It seems that the VGMDB importer doesn't work on some pages.

For example, this one doesn't work on my end. https://vgmdb.net/album/4913

On Firefox the console error says: Uncaught SyntaxError: JSON.parse: unexpected character at line 1 column 1 of the JSON data parseApi moz-extension://ed3beb5e-f7c7-43f1-945a-c8453eb72a30/userscripts/Import VGMdb releases into MusicBrainz.user.js?id=167a6757-285b-455d-a243-28ea33956288:588 onload moz-extension://ed3beb5e-f7c7-43f1-945a-c8453eb72a30/userscripts/Import VGMdb releases into MusicBrainz.user.js?id=167a6757-285b-455d-a243-28ea33956288:581 St https://vgmdb.net/album/4913:9 onload https://vgmdb.net/album/4913:25 St https://vgmdb.net/album/4913:9 i https://vgmdb.net/album/4913:34 St https://vgmdb.net/album/4913:9 r https://vgmdb.net/album/4913:22 Fo https://vgmdb.net/album/4913:23 g https://vgmdb.net/album/4913:67 g https://vgmdb.net/album/4913:67

Not sure why it affects only some pages and not others. 🤔

kellnerd commented 1 year ago

Hmm, that example works for me currently. I guess the VGMDB API is a bit flaky sometimes and does not return valid JSON in case it errors.

Parsnip commented 1 year ago

I'm still getting the same issue, at the moment. I wonder if it's possible that there's a browser and userscript extension (Firefox & Tampermonkey) difference, or is it more likely that it's a API and JSON issue. I did take a look at the Deltora Quest JSON file and it seemed correct. I'll test out some browser and extension combos to try and rule that out at least.

Parsnip commented 1 year ago

On Edge & Tampermonkey the error is different at least. Uncaught SyntaxError: Unexpected token 'a', "arrangers:"... is not valid JSON. On Edge the inspection gives me a link to the file it's trying to parse (I think) and it actually looks like YAML file, not JSON at all. Very strange, but I could misinterpreting the Edge debugger.

Testing some other albums here and there and some work on Firefox, while they don't work on Edge. For example album/601 works fine on Firefox, but on Edge it appears that the JSON file is incomplete. Really unusual. But I honestly have no idea if that means the issue is on the API end or the script end. Since that file always comes back the same, but on other browser it works fine, maybe they are hitting a different server and that's where the API issue is?

More confused about all of this now than I was yesterday. 😄

kellnerd commented 1 year ago

https://vgmdb.info/album/601 gives me "SyntaxError: JSON.parse: unterminated string literal at line 308 column 26 of the JSON data" in Firefox (if that matters at all) and the JSON response is indeed incomplete, while https://vgmdb.info/album/601?format=json gives me complete, valid JSON. For comparison, https://vgmdb.info/album/4913?format=json (as the script queries it) and https://vgmdb.info/album/4913 both give me the same valid JSON. So the bug is definitely on the side of VGMDB.info in this case.

More confused about all of this now than I was yesterday. 😄

I can definitely sign that.

Parsnip commented 1 year ago

I'm closing this as it does indeed seem that the vgmdb.info API is the cause here and the issues have nothing to do with the script. Hopefully it resolves itself at some point.

Thanks for your time kellnerd. 👍