@gunsnprices/node-red-gunsnprices 1.0.0

Node-RED node that parses gun and ammo product titles into brand, model, caliber, magazine capacity, barrel length, rounds per box and cost per round, and normalizes caliber names.

npm install @gunsnprices/node-red-gunsnprices

@gunsnprices/node-red-gunsnprices

npm CI

A Node-RED node that reads gun and ammunition product titles and returns structured specs: firearm or ammo, brand, model, caliber, magazine capacity, barrel length, rounds per box and cost per round. It can also turn a caliber written any way (9MM LUGER, 5.56 NATO, 12GA, 300 BLK) into one standard name.

Glock 19 Gen 5 MOS 9mm 4.02in 15rd Pistol PA195S203MOS
→ firearm · Glock · Glock 19 Gen 5 MOS · 9×19mm Parabellum · 15 rounds · 4.02 in

{ "title": "Federal American Eagle 5.56x45mm 55gr FMJ 1000 Rounds", "price": 449.99 }
→ ammo · 5.56×45mm NATO · 1000 rounds · 0.45 per round

It is built on the open source title parser of GunsNPrices, a price comparison site that uses it to match the same product across 40+ US gun and ammo stores. The parser knows 293 calibers with the spellings retailers use and the models of 50 brands.

Use it in flows that import supplier or store feeds, track prices, fill product fields in a shop or inventory system, or show cost per round next to an ammo price.

  • One node, gun title, in the parser category, with two actions: Parse a product title and Normalize a caliber.
  • Runs locally: no API key, no account, no network calls.
  • Free and open source (MIT). The caliber and model data are CC BY 4.0.

Install

From the Node-RED editor: Menu → Manage palette → Install, search for gunsnprices and click install.

Or with npm, in your Node-RED user directory (usually ~/.node-red), then restart Node-RED:

npm install @gunsnprices/node-red-gunsnprices

Requires Node-RED 3.0 or later and Node.js 18 or later (or the newer Node.js version your Node-RED release needs).

Usage

Wire the node between any node that produces a title (inject, HTTP request, CSV, database) and the next step. Settings:

Setting Default
Action Parse a product title Or Normalize a caliber
Input msg.payload The message property to read
Output msg.payload The message property to write the result to. The rest of the message is passed on
Treat as Detect firearm or ammo Or Firearm / Ammo, which skips the guess. Parse mode only
Name

Parse a product title

The input is a title string:

Glock 19 Gen 5 MOS 9mm 4.02in 15rd Pistol PA195S203MOS

or an object with a title (or name) and optional fields:

{ "title": "Federal American Eagle 9mm Luger 115gr FMJ 50 Rounds", "price": 18.99 }
Field
title or name The product title. Required
price The listing price, a number or a text such as "$18.99". With ammo it gives costPerRound
brand The manufacturer, if your data has it. Helps with titles that don't name the brand
mpn Manufacturer part number. Glock part numbers are decoded
sku Store SKU
kind "firearm" or "ammo". Overrides the Treat as setting

To parse a title together with a price kept in another property, build the object first with a change node, for example set msg.payload to the JSONata expression {"title": payload, "price": price}.

Output for the Glock title above:

{
  "title": "Glock 19 Gen 5 MOS 9mm 4.02in 15rd Pistol PA195S203MOS",
  "kind": "firearm",
  "brand": "Glock",
  "model": {
    "brand": "Glock",
    "family": "Glock 19",
    "model": "Glock 19 Gen 5 MOS",
    "generation": "5",
    "configs": ["MOS"],
    "features": [],
    "source": "title"
  },
  "caliber": {
    "id": "9x19mmparabellum",
    "name": "9×19mm Parabellum",
    "type": "handgun",
    "url": "https://gunsnprices.com/ammo/handgun-ammo/9-19mm-parabellum"
  },
  "calibers": [
    {
      "id": "9x19mmparabellum",
      "name": "9×19mm Parabellum",
      "type": "handgun",
      "url": "https://gunsnprices.com/ammo/handgun-ammo/9-19mm-parabellum"
    }
  ],
  "capacity": 15,
  "barrelLength": 4.02,
  "rounds": null,
  "costPerRound": null
}
Field Type
title string The title that was parsed
kind "firearm" or "ammo"
brand string Brand of the identified model, else the brand you passed, else ""
model object or null Firearms only. model.model is the most specific name, model.family the model family
caliber object or null The first caliber: id, name, type, and url of its GunsNPrices price comparison page
calibers array Every caliber in the title, in order (for example .357 Mag and .38 S&W Special)
capacity number or null Magazine capacity (15 for 15+1), firearms only
barrelLength number or null Inches, firearms only
rounds number or null Rounds per box, ammo only
costPerRound number or null Price ÷ rounds, 4 decimals, ammo with a price only

Caliber type is handgun, rifle, rimfire, shotgun, airgun or muzzleloader.

Normalize a caliber

The input is a caliber text, for example a caliber field from a product feed:

308 WIN (7.62X51 NATO)

Output:

{ "id": "308win", "name": ".308 Win", "type": "rifle", "url": "https://gunsnprices.com/ammo/rifle-ammo/308-win" }

Text that contains no known caliber gives null. If the text is a whole title, the first caliber in it is used.

Arrays

If the input is an array, each item is parsed and the output is an array of the same length and order. Items without a title (or caliber text) give null. This is handy for a list from an HTTP request or a CSV file without splitting it.

Status and errors

The node status shows the last result: the model, caliber and numbers found (green), no specs found or not recognized (yellow), or error (red).

A message whose input property is missing, empty, or not a title fails with an error and nothing is sent. Use a Catch node to handle it. A title that is read but has no recognizable specs is not an error: the result is sent with null fields.

Examples

In the Node-RED editor: Menu → Import → Examples → @gunsnprices/node-red-gunsnprices.

  • Parse a gun title: firearm titles, and a title with brand and Glock part number.
  • Ammo cost per round: listings with prices, and a list sorted by cost per round.
  • Normalize calibers: caliber texts and a list of feed values.

The flows are in examples/.

Accuracy

Measured on 63,757 listings from 40+ US stores (October 2026): the parser finds the caliber in 91% of ammo titles and is right in 94.9% of those; for firearms 81% and 97.8%. Many stores leave the caliber or barrel length out of the title, and then the field stays empty. Details: gunsnprices-python.

Titles from US retailers, in English. Models are covered for 50 brands; other brands still get calibers and numbers. Magazines, parts and accessories get calibers and numbers but no model.

How it works

The node uses the gunsnprices npm package (source), loaded once when the first node starts. The caliber list and model dictionaries ship inside that package. Nothing is sent anywhere: the parser has no network code.

Other platforms (WordPress, Joomla, Framer, VS Code and more): gunsnprices.com/developers.

Development

npm install
npm test

The tests use node-red-node-test-helper and also run every inject payload of the example flows through the node.

License

MIT for the code (LICENSE). The caliber list and model dictionaries inside the gunsnprices parser are © GunsNPrices under CC BY 4.0.

Questions, corrections and missing models: open an issue or write to [email protected].

Node Info

Version: 1.0.0
Updated 5 days ago
License: MIT
Rating: not yet rated

Categories

Actions

Rate:

Downloads

0 in the last week

Nodes

  • gun-title

Keywords

  • node-red
  • gun
  • guns
  • firearms
  • ammo
  • ammunition
  • caliber
  • cost-per-round
  • product-title
  • parser
  • gunsnprices

Maintainers