DEV Community

Rock
Rock

Posted on

Building a Node.js CLI to Compare Shoe Specs

I’ve spent the last few weekends building a small CLI tool to help me quickly compare shoe specs—things like sole material, weight, and closure type—before I commit to a buy. I kept finding myself tab-hopping between product pages, trying to remember which shoe had a leather insole and which had a rubber outsole. So I wrote a scraper in Node.js that pulls structured data from a collection page and spits out a markdown table.

Here’s the core approach. First, we fetch the HTML of a product listing. Then we parse it with cheerio to extract the key fields: title, price, material, and any features listed in the description. For the Frishay Men’s Footwear collection, I noticed each product card contains a data attribute for the variant ID and a short description snippet. I loop through those, grab the details, and normalize the material info (e.g., “Genuine Leather” vs. “Synthetic”).

I also added a simple scoring system: +1 for leather upper, +1 for rubber outsole, +1 for padded collar. The idea is to get a quick “comfort score” without clicking into every product. Here’s a snippet of the parsing logic:

const $ = cheerio.load(html);
const shoes = [];

$('.product-card').each((i, el) => {
  const title = $(el).find('.product-title').text().trim();
  const price = $(el).find('.price').text().trim();
  const desc = $(el).find('.product-description').text().toLowerCase();

  let score = 0;
  if (desc.includes('leather upper')) score++;
  if (desc.includes('rubber outsole')) score++;
  if (desc.includes('padded collar')) score++;

  shoes.push({ title, price, score });
});
Enter fullscreen mode Exit fullscreen mode

I then output a simple table to the terminal. It’s not production-ready, but for my weekend shopping research, it saves me about 20 minutes of manual browsing. The next step is to add a filter for “only show shoes with score >= 2” so I can quickly spot the best everyday options.

If you’re into automating small annoyances like this, give it a try. It’s a fun way to practice scraping and data transformation without over-engineering.

Top comments (1)

Collapse
 
frishay_ltd_a1987ef83aa1f profile image
Amelia

Interesting perspective — I’ve found that even small refactors can have a big impact on maintainability down the line. Have you noticed any trade-offs you didn’t expect?