recipe-scrapers-js 0.1.0-alpha.6 → 0.1.0-alpha.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/index.js +11 -1
  2. package/package.json +4 -4
package/dist/index.js CHANGED
@@ -1104,7 +1104,8 @@ const recipeDataSchema = z.object({
1104
1104
  recipeTimeNote: z.string().optional(),
1105
1105
  ingredientGroups: z.array(recipeIngredientGroupSchema),
1106
1106
  headnote: z.string().optional(),
1107
- instructions: z.array(recipeInstructionSchema)
1107
+ instructions: z.array(recipeInstructionSchema),
1108
+ metaData: z.object({ fields: z.object({ photo: z.object({ url: z.url() }) }) })
1108
1109
  });
1109
1110
  const pagePropsDataSchema = z.object({ props: z.object({ pageProps: z.object({ data: recipeDataSchema }) }) });
1110
1111
  var AmericasTestKitchen = class extends AbstractScraper {
@@ -1113,6 +1114,7 @@ var AmericasTestKitchen = class extends AbstractScraper {
1113
1114
  return "americastestkitchen.com";
1114
1115
  }
1115
1116
  extractors = {
1117
+ image: this.image.bind(this),
1116
1118
  ingredients: this.ingredients.bind(this),
1117
1119
  instructions: this.instructions.bind(this),
1118
1120
  siteName: this.siteName.bind(this)
@@ -1120,6 +1122,14 @@ var AmericasTestKitchen = class extends AbstractScraper {
1120
1122
  siteName() {
1121
1123
  return "America's Test Kitchen";
1122
1124
  }
1125
+ image(prevValue) {
1126
+ const data = this.getRecipeData();
1127
+ if (!data) {
1128
+ if (prevValue) return prevValue;
1129
+ throw new Error("Failed to extract image");
1130
+ }
1131
+ return data.metaData.fields.photo.url;
1132
+ }
1123
1133
  ingredients(prevValue) {
1124
1134
  let ingredients = this.parseIngredients();
1125
1135
  if (!ingredients) ingredients = this.parseHtmlIngredients(prevValue);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "recipe-scrapers-js",
3
- "version": "0.1.0-alpha.6",
3
+ "version": "0.1.0-alpha.7",
4
4
  "license": "MIT",
5
5
  "description": "A recipe scrapers library",
6
6
  "author": {
@@ -40,15 +40,15 @@
40
40
  },
41
41
  "peerDependencies": {
42
42
  "cheerio": "^1.1.0",
43
- "zod": "^3.25.74"
43
+ "zod": "^3.25.76"
44
44
  },
45
45
  "dependencies": {
46
46
  "iso8601-duration": "^2.1.2",
47
47
  "schema-dts": "^1.1.5"
48
48
  },
49
49
  "devDependencies": {
50
- "@biomejs/biome": "^2.0.6",
51
- "@types/bun": "^1.2.17",
50
+ "@biomejs/biome": "^2.1.1",
51
+ "@types/bun": "^1.2.18",
52
52
  "cheerio": "^1.1.0",
53
53
  "tsdown": "^0.12.9",
54
54
  "typescript": "^5.8.3"