I saw someone's solution to a problem I've always struggled with and felt dumb for not figuring it out myself

Posted by haddock420@reddit | learnprogramming | View on Reddit | 14 comments

I'm a hobbyist programmer, I run two sites, one for small personal projects, and another site that finds deals on Pokemon cards which I make money on from affiliate links. I just wanted to share this experience I just had.

All the links on my Pokemon deal finder are to eBay listings for Pokemon cards, and I had the idea of adding links to TCGPlayer for each card.

The problem is that the page for each card on TCGPlayer is based on their own product ID for each card. I found a website which had CSV data from TCGPlayer with all the cards and their product IDs. The next problem was that TCGPlayer used slightly different naming conventions for cards than Pricecharting (the site I was using to get my card values).

I wrote a script to try to match the TCGPlayer names to the Pricecharting names, but the script only covered about 40% of the cards, and there were too many edge cases for me to add. So I removed the TCGPlayer links from my site.

Today I was looking at another Pokemon card affiliate site, and they had such a simple solution that I can't believe I missed it.

For their TCGPlayer links for each card, they just linked to the TCGPlayer search page for "[set name] [card name]". That's it. No messy matching, no product IDs, just a link to a page that has exactly what the user needs in a line of code.

I've been programming for a few years now, and this has really made me realise that I should look for simpler solutions to problems where possible instead of trying a complicated solution that doesn't even work.

Just thought I'd share because I'm sure this is something other people have experienced as well.