@metascraper/helpers 5.55.2 → 5.56.2

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/package.json +2 -2
  2. package/src/index.js +5 -1
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@metascraper/helpers",
3
3
  "description": "Shared helper utilities used across metascraper rules for parsing and normalizing metadata.",
4
4
  "homepage": "https://github.com/microlinkhq/metascraper/packages/metascraper-helpers",
5
- "version": "5.55.2",
5
+ "version": "5.56.2",
6
6
  "main": "src/index.js",
7
7
  "author": {
8
8
  "email": "hello@microlink.io",
@@ -73,5 +73,5 @@
73
73
  "publishConfig": {
74
74
  "access": "public"
75
75
  },
76
- "gitHead": "d55833693c1b1736bbc56e0d477b1135871837c6"
76
+ "gitHead": "63168a1c6ab9fa67552a13fd9e4a60ad4c10f953"
77
77
  }
package/src/index.js CHANGED
@@ -556,6 +556,9 @@ const $jsonld = propName => $ => {
556
556
  return isString(value) ? decodeHTML(value) : value
557
557
  }
558
558
 
559
+ const $meta = attr => $ =>
560
+ $(`meta[name="${attr}" i], meta[property="${attr}" i]`).attr('content')
561
+
559
562
  const image = (value, opts) => {
560
563
  const urlValue = url(value, opts)
561
564
 
@@ -729,7 +732,7 @@ const withIframe = (rules, getIframe, propName) => {
729
732
  }
730
733
  }
731
734
 
732
- const twitter = $('meta[name="twitter:player"]').attr('content')
735
+ const twitter = $meta('twitter:player')($)
733
736
  if (twitter) return probe(twitter, args)
734
737
  })
735
738
  }
@@ -737,6 +740,7 @@ const withIframe = (rules, getIframe, propName) => {
737
740
  module.exports = {
738
741
  $filter,
739
742
  $jsonld,
743
+ $meta,
740
744
  absoluteUrl,
741
745
  audio,
742
746
  audioExtensions,