New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

minecraft-crafting-info

Package Overview
Dependencies
Maintainers
0
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

minecraft-crafting-info - npm Package Compare versions

Comparing version 0.0.1 to 0.0.2

2

package.json
{
"name": "minecraft-crafting-info",
"version": "0.0.1",
"version": "0.0.2",
"description": "Scrapes https://www.minecraftcrafting.info for crafting recipes.",

@@ -5,0 +5,0 @@ "module": "src/index.ts",

const REGEX =
/<tr>\s*<td.*?>\s*(.+?)\s*<\/td>\s*<td.*?>\s*(.+?)\s*<\/td>\s*<td.*?>\s*<img.*?src="(.+?)".+?<\/td>\s*<td.*?>\s*(.+?)\s*<\/td>/gim;
export const baseUrl = "https://www.minecraftcrafting.info";
export interface Recipe {

@@ -9,9 +11,7 @@ itemName: string;

materials: string;
recipeImage: string;
recipeImage: URL;
}
export async function fetchRecipes() {
const html = await fetch("https://www.minecraftcrafting.info").then((r) =>
r.text()
);
const html = await fetch(baseUrl).then((r) => r.text());

@@ -23,3 +23,8 @@ const recipeMatches = html.matchAll(REGEX);

const [, itemName, materials, recipeImage, itemDescription] = match;
recipes.push({ itemName, itemDescription, recipeImage, materials });
recipes.push({
itemName,
itemDescription,
recipeImage: new URL(recipeImage, baseUrl),
materials,
});
}

@@ -31,3 +36,3 @@

if (process.isBun && import.meta.main) {
console.table(await fetchRecipes());
fetchRecipes().then(console.table);
}
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc