bra1n / judgebot

Discord Bot for Magic: The Gathering / Judge related content
https://discord.com/api/oauth2/authorize?client_id=240537940378386442&permissions=274878187520&scope=applications.commands%20bot
GNU General Public License v3.0
34 stars 17 forks source link

Update MTR source #192

Open lunakv opened 1 year ago

lunakv commented 1 year ago

The default data source for the MTR hasn't updated in over three years. MTR doesn't change all that often, but three years is still quite a long time. And while the bot doesn't serve the contents of any API route, and links to the up-to-date annotated MTR, it still produces some bad results.

For example, section 1.5 is titled DCI Number despite being renamed to Registration almost two years ago. And newer sections like 3.17 and 3.18 still return a "Not found" error even though they've existed for over a year.

Based on a quick search, it seems @AEFeinstein mostly abandoned the GathererScraper project and instead uses Mtgjson2Familiar for his rules document parsing. There are some updated HTML files inside the rules folder of that repo, but they look quite different to the file used by the bot today, so some parsing update might need to happen.

As an alternative, the Academy Ruins API just added support for plain-text parsed MTR, which could be of use.

multimeric commented 1 year ago

Okay, I'm convinced that using Academy Ruins for MTR would be useful. If you would like to provide an integration via PR I would be happy to merge.

AEFeinstein commented 1 year ago

I did abandon https://github.com/AEFeinstein/GathererScraper for https://github.com/AEFeinstein/Mtgjson2Familiar, and because parsed or structured MTR data which was actively maintained was so hard to find at the time. Instead, I now take the current PDF and turn it into HTML using pdftohtml, which is good enough to display in a webview without a huge PDF library. It's still not particularly machine-friendly though.

Academy Ruins is interesting, maybe I'll look into it too.

lunakv commented 1 year ago

Oh, I didn't realize the mention would notify you, thanks for the clarification!

I actually considered using poppler tools for AR as well, but I ran into some limitations that ultimately made me go in a different direction. Being a text-based API, it naturally doesn't support some things present in the HTML (hyperlinks, images, rich text formatting, ...) but if you ever want to check it out, I'd be happy to assist.

As far as the PR for judgebot, I most likely won't have time to make it myself in the near-ish future, but if anyone else wants to work on it in the meantime, I'd be happy to help with anything related to the API.

AEFeinstein commented 1 year ago

I like being mentioned, it's how I learn things! At this point, most of my project time is going into non-Magic stuff, and my MTR process is working well enough. Someday it will break (I've found that no data source is good forever), and when it does, I've starred https://github.com/lunakv/academyruins-api 😄