From e216044b226dc61a8265aaed05faeb4efdc71099 Mon Sep 17 00:00:00 2001 From: jshemas Date: Sat, 2 Mar 2024 23:15:46 -0500 Subject: [PATCH 1/9] adding extra og tags for music and video --- dist/lib/fields.js | 75 +++++++++++++++++++++++++++++++++++++++++++++ dist/lib/types.d.ts | 17 +++++++++- lib/fields.ts | 75 +++++++++++++++++++++++++++++++++++++++++++++ lib/types.ts | 17 +++++++++- 4 files changed, 182 insertions(+), 2 deletions(-) diff --git a/dist/lib/fields.js b/dist/lib/fields.js index 7c37af2..576b687 100644 --- a/dist/lib/fields.js +++ b/dist/lib/fields.js @@ -22,6 +22,11 @@ const fields = [ property: 'og:logo', fieldName: 'ogLogo', }, + { + multiple: false, + property: 'og:website', + fieldName: 'ogWebsite', + }, { multiple: true, property: 'og:image', @@ -162,11 +167,61 @@ const fields = [ property: 'og:video:secure_url', fieldName: 'ogVideoSecureURL', }, + { + multiple: true, + property: 'og:movie', + fieldName: 'ogMovie', + }, + { + multiple: true, + property: 'og:episode', + fieldName: 'ogEpisode', + }, + { + multiple: true, + property: 'og:video:actor', + fieldName: 'ogVideoActor', + }, { multiple: true, property: 'og:video:actor:id', fieldName: 'ogVideoActorId', }, + { + multiple: true, + property: 'og:video:actor:role', + fieldName: 'ogVideoActorRole', + }, + { + multiple: true, + property: 'og:video:director', + fieldName: 'ogVideoDirector', + }, + { + multiple: true, + property: 'og:video:writer', + fieldName: 'ogVideoWriter', + }, + { + multiple: true, + property: 'og:video:duration', + fieldName: 'ogVideoDuration', + }, + { + multiple: true, + property: 'og:video:release_date', + fieldName: 'ogVideoReleaseDate', + }, + { + multiple: true, + property: 'og:video:Tag', + fieldName: 'ogVideoTag', + }, + { + multiple: true, + property: 'og:video:series', + fieldName: 'ogVideoSeries', + }, { multiple: true, property: 'og:video:width', @@ -182,6 +237,16 @@ const fields = [ property: 'og:video:type', fieldName: 'ogVideoType', }, + { + multiple: true, + property: 'og:video:tv_show', + fieldName: 'ogVideoTvShow', + }, + { + multiple: true, + property: 'og:video:other', + fieldName: 'ogVideoOther', + }, { multiple: false, property: 'twitter:card', @@ -317,6 +382,11 @@ const fields = [ property: 'twitter:app:url:googleplay', fieldName: 'twitterAppUrlGooglePlay', }, + { + multiple: true, + property: 'music:playlist', + fieldName: 'musicPlaylist', + }, { multiple: true, property: 'music:song', @@ -352,6 +422,11 @@ const fields = [ property: 'music:duration', fieldName: 'musicDuration', }, + { + multiple: true, + property: 'music:radio_station', + fieldName: 'musicRadioStation', + }, { multiple: true, property: 'music:creator', diff --git a/dist/lib/types.d.ts b/dist/lib/types.d.ts index 19a3ae9..3b67bda 100644 --- a/dist/lib/types.d.ts +++ b/dist/lib/types.d.ts @@ -168,6 +168,8 @@ export type OgObjectInteral = { musicCreator?: string; musicDuration?: string; musicMusician?: string; + musicPlaylist?: string; + musicRadioStation?: string; musicReleaseDate?: string; musicSong?: MusicSongObject[]; musicSongDisc?: string | string[] | null[]; @@ -189,17 +191,19 @@ export type OgObjectInteral = { ogDate?: string; ogDescription?: string; ogDeterminer?: string; + ogEpisode?: string; ogImage?: ImageObject[]; + ogImageAlt?: string | string[] | null[]; ogImageHeight?: string | string[] | null[]; ogImageProperty?: string | string[] | null[]; ogImageSecureURL?: string | string[] | null[]; ogImageType?: string | string[] | null[]; ogImageURL?: string | string[] | null[]; ogImageWidth?: string | string[] | null[]; - ogImageAlt?: string | string[] | null[]; ogLocale?: string; ogLocaleAlternate?: string; ogLogo?: string; + ogMovie?: string; ogPriceAmount?: string; ogPriceCurrency?: string; ogProductAvailability?: string; @@ -212,12 +216,23 @@ export type OgObjectInteral = { ogType?: string; ogUrl?: string; ogVideo?: VideoObject[]; + ogVideoActor?: string; ogVideoActorId?: string; + ogVideoActorRole?: string; + ogVideoDirector?: string; + ogVideoDuration?: string; ogVideoHeight?: string | string[] | null[]; + ogVideoOther?: string; ogVideoProperty?: string | string[] | null[]; + ogVideoReleaseDate?: string; ogVideoSecureURL?: string; + ogVideoSeries?: string; + ogVideoTag?: string; + ogVideoTvShow?: string; ogVideoType?: string | string[] | null[]; ogVideoWidth?: string | string[] | null[]; + ogVideoWriter?: string; + ogWebsite?: string; placeLocationLatitude?: string; placeLocationLongitude?: string; profileFirstName?: string; diff --git a/lib/fields.ts b/lib/fields.ts index df73c03..068cb7d 100644 --- a/lib/fields.ts +++ b/lib/fields.ts @@ -20,6 +20,11 @@ const fields = [ property: 'og:logo', fieldName: 'ogLogo', }, + { + multiple: false, + property: 'og:website', + fieldName: 'ogWebsite', + }, { multiple: true, property: 'og:image', @@ -160,11 +165,61 @@ const fields = [ property: 'og:video:secure_url', fieldName: 'ogVideoSecureURL', }, + { + multiple: true, + property: 'og:movie', + fieldName: 'ogMovie', + }, + { + multiple: true, + property: 'og:episode', + fieldName: 'ogEpisode', + }, + { + multiple: true, + property: 'og:video:actor', + fieldName: 'ogVideoActor', + }, { multiple: true, property: 'og:video:actor:id', fieldName: 'ogVideoActorId', }, + { + multiple: true, + property: 'og:video:actor:role', + fieldName: 'ogVideoActorRole', + }, + { + multiple: true, + property: 'og:video:director', + fieldName: 'ogVideoDirector', + }, + { + multiple: true, + property: 'og:video:writer', + fieldName: 'ogVideoWriter', + }, + { + multiple: true, + property: 'og:video:duration', + fieldName: 'ogVideoDuration', + }, + { + multiple: true, + property: 'og:video:release_date', + fieldName: 'ogVideoReleaseDate', + }, + { + multiple: true, + property: 'og:video:Tag', + fieldName: 'ogVideoTag', + }, + { + multiple: true, + property: 'og:video:series', + fieldName: 'ogVideoSeries', + }, { multiple: true, property: 'og:video:width', @@ -180,6 +235,16 @@ const fields = [ property: 'og:video:type', fieldName: 'ogVideoType', }, + { + multiple: true, + property: 'og:video:tv_show', + fieldName: 'ogVideoTvShow', + }, + { + multiple: true, + property: 'og:video:other', + fieldName: 'ogVideoOther', + }, { multiple: false, property: 'twitter:card', @@ -315,6 +380,11 @@ const fields = [ property: 'twitter:app:url:googleplay', fieldName: 'twitterAppUrlGooglePlay', }, + { + multiple: true, + property: 'music:playlist', + fieldName: 'musicPlaylist', + }, { multiple: true, property: 'music:song', @@ -350,6 +420,11 @@ const fields = [ property: 'music:duration', fieldName: 'musicDuration', }, + { + multiple: true, + property: 'music:radio_station', + fieldName: 'musicRadioStation', + }, { multiple: true, property: 'music:creator', diff --git a/lib/types.ts b/lib/types.ts index efce228..5e5266f 100644 --- a/lib/types.ts +++ b/lib/types.ts @@ -176,6 +176,8 @@ export type OgObjectInteral = { musicCreator?: string; musicDuration?: string; musicMusician?: string; + musicPlaylist?: string; + musicRadioStation?: string; musicReleaseDate?: string; musicSong?: MusicSongObject[]; musicSongDisc?: string | string[] | null[]; @@ -197,17 +199,19 @@ export type OgObjectInteral = { ogDate?: string; ogDescription?: string; ogDeterminer?: string; + ogEpisode?: string; ogImage?: ImageObject[]; + ogImageAlt?: string | string[] | null[]; ogImageHeight?: string | string[] | null[]; ogImageProperty?: string | string[] | null[]; ogImageSecureURL?: string | string[] | null[]; ogImageType?: string | string[] | null[]; ogImageURL?: string | string[] | null[]; ogImageWidth?: string | string[] | null[]; - ogImageAlt?: string | string[] | null[]; ogLocale?: string; ogLocaleAlternate?: string; ogLogo?: string; + ogMovie?: string; ogPriceAmount?: string; ogPriceCurrency?: string; ogProductAvailability?: string; @@ -220,12 +224,23 @@ export type OgObjectInteral = { ogType?: string; ogUrl?: string; ogVideo?: VideoObject[]; + ogVideoActor?: string; ogVideoActorId?: string; + ogVideoActorRole?: string; + ogVideoDirector?: string; + ogVideoDuration?: string; ogVideoHeight?: string | string[] | null[]; + ogVideoOther?: string; ogVideoProperty?: string | string[] | null[]; + ogVideoReleaseDate?: string; ogVideoSecureURL?: string; + ogVideoSeries?: string; + ogVideoTag?: string; + ogVideoTvShow?: string; ogVideoType?: string | string[] | null[]; ogVideoWidth?: string | string[] | null[]; + ogVideoWriter?: string; + ogWebsite?: string; placeLocationLatitude?: string; placeLocationLongitude?: string; profileFirstName?: string; From 633ffbd8367234d88f912b1a40c74ceffaa0688e Mon Sep 17 00:00:00 2001 From: jshemas Date: Sat, 2 Mar 2024 23:26:02 -0500 Subject: [PATCH 2/9] updating devDependencies --- package-lock.json | 437 ++++++++++++++++++++++++---------------------- package.json | 14 +- 2 files changed, 237 insertions(+), 214 deletions(-) diff --git a/package-lock.json b/package-lock.json index 344f7b7..c2bc5f2 100644 --- a/package-lock.json +++ b/package-lock.json @@ -16,18 +16,18 @@ "validator": "^13.11.0" }, "devDependencies": { - "@snyk/protect": "^1.1279.0", + "@snyk/protect": "^1.1281.0", "@types/mocha": "^10.0.6", - "@types/node": "^18.19.15", + "@types/node": "^18.19.21", "@types/validator": "^13.11.9", - "@typescript-eslint/eslint-plugin": "^6.21.0", - "@typescript-eslint/parser": "^6.21.0", + "@typescript-eslint/eslint-plugin": "^7.1.0", + "@typescript-eslint/parser": "^7.1.0", "chai": "^4.4.1", - "eslint": "^8.56.0", + "eslint": "^8.57.0", "eslint-config-airbnb-base": "^15.0.0", - "eslint-config-airbnb-typescript": "^17.1.0", + "eslint-config-airbnb-typescript": "^18.0.0", "eslint-plugin-import": "^2.29.1", - "eslint-plugin-mocha": "^10.2.0", + "eslint-plugin-mocha": "^10.3.0", "eslint-plugin-promise": "^6.1.1", "mocha": "^10.3.0", "nyc": "^15.1.0", @@ -49,13 +49,13 @@ } }, "node_modules/@ampproject/remapping": { - "version": "2.2.1", - "resolved": "https://registry.npmjs.org/@ampproject/remapping/-/remapping-2.2.1.tgz", - "integrity": "sha512-lFMjJTrFL3j7L9yBxwYfCq2k6qqwHyzuUl/XBnif78PWTJYyL/dfowQHWE3sp6U6ZzqWiiIZnpTMO96zhkjwtg==", + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/@ampproject/remapping/-/remapping-2.3.0.tgz", + "integrity": "sha512-30iZtAPgz+LTIYoeivqYo853f02jBYSd5uGnGpkFV0M3xOt9aN73erkgYAmZU43x4VfqcnLxW9Kpg3R5LC4YYw==", "dev": true, "dependencies": { - "@jridgewell/gen-mapping": "^0.3.0", - "@jridgewell/trace-mapping": "^0.3.9" + "@jridgewell/gen-mapping": "^0.3.5", + "@jridgewell/trace-mapping": "^0.3.24" }, "engines": { "node": ">=6.0.0" @@ -155,9 +155,9 @@ } }, "node_modules/@babel/core": { - "version": "7.23.9", - "resolved": "https://registry.npmjs.org/@babel/core/-/core-7.23.9.tgz", - "integrity": "sha512-5q0175NOjddqpvvzU+kDiSOAk4PfdO6FvwCWoQ6RO7rTzEe8vlo+4HVfcnAREhD4npMs0e9uZypjTwzZPCf/cw==", + "version": "7.24.0", + "resolved": "https://registry.npmjs.org/@babel/core/-/core-7.24.0.tgz", + "integrity": "sha512-fQfkg0Gjkza3nf0c7/w6Xf34BW4YvzNfACRLmmb7XRLa6XHdR+K9AlJlxneFfWYf6uhOzuzZVTjF/8KfndZANw==", "dev": true, "dependencies": { "@ampproject/remapping": "^2.2.0", @@ -165,11 +165,11 @@ "@babel/generator": "^7.23.6", "@babel/helper-compilation-targets": "^7.23.6", "@babel/helper-module-transforms": "^7.23.3", - "@babel/helpers": "^7.23.9", - "@babel/parser": "^7.23.9", - "@babel/template": "^7.23.9", - "@babel/traverse": "^7.23.9", - "@babel/types": "^7.23.9", + "@babel/helpers": "^7.24.0", + "@babel/parser": "^7.24.0", + "@babel/template": "^7.24.0", + "@babel/traverse": "^7.24.0", + "@babel/types": "^7.24.0", "convert-source-map": "^2.0.0", "debug": "^4.1.0", "gensync": "^1.0.0-beta.2", @@ -356,14 +356,14 @@ } }, "node_modules/@babel/helpers": { - "version": "7.23.9", - "resolved": "https://registry.npmjs.org/@babel/helpers/-/helpers-7.23.9.tgz", - "integrity": "sha512-87ICKgU5t5SzOT7sBMfCOZQ2rHjRU+Pcb9BoILMYz600W6DkVRLFBPwQ18gwUVvggqXivaUakpnxWQGbpywbBQ==", + "version": "7.24.0", + "resolved": "https://registry.npmjs.org/@babel/helpers/-/helpers-7.24.0.tgz", + "integrity": "sha512-ulDZdc0Aj5uLc5nETsa7EPx2L7rM0YJM8r7ck7U73AXi7qOV44IHHRAYZHY6iU1rr3C5N4NtTmMRUJP6kwCWeA==", "dev": true, "dependencies": { - "@babel/template": "^7.23.9", - "@babel/traverse": "^7.23.9", - "@babel/types": "^7.23.9" + "@babel/template": "^7.24.0", + "@babel/traverse": "^7.24.0", + "@babel/types": "^7.24.0" }, "engines": { "node": ">=6.9.0" @@ -455,9 +455,9 @@ } }, "node_modules/@babel/parser": { - "version": "7.23.9", - "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.23.9.tgz", - "integrity": "sha512-9tcKgqKbs3xGJ+NtKF2ndOBBLVwPjl1SHxPQkd36r3Dlirw3xWUeGaTbqr7uGZcTaxkVNwc+03SVP7aCdWrTlA==", + "version": "7.24.0", + "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.24.0.tgz", + "integrity": "sha512-QuP/FxEAzMSjXygs8v4N9dvdXzEHN4W1oF3PxuWAtPo08UdM17u89RDMgjLn/mlc56iM0HlLmVkO/wgR+rDgHg==", "dev": true, "bin": { "parser": "bin/babel-parser.js" @@ -467,23 +467,23 @@ } }, "node_modules/@babel/template": { - "version": "7.23.9", - "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.23.9.tgz", - "integrity": "sha512-+xrD2BWLpvHKNmX2QbpdpsBaWnRxahMwJjO+KZk2JOElj5nSmKezyS1B4u+QbHMTX69t4ukm6hh9lsYQ7GHCKA==", + "version": "7.24.0", + "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.24.0.tgz", + "integrity": "sha512-Bkf2q8lMB0AFpX0NFEqSbx1OkTHf0f+0j82mkw+ZpzBnkk7e9Ql0891vlfgi+kHwOk8tQjiQHpqh4LaSa0fKEA==", "dev": true, "dependencies": { "@babel/code-frame": "^7.23.5", - "@babel/parser": "^7.23.9", - "@babel/types": "^7.23.9" + "@babel/parser": "^7.24.0", + "@babel/types": "^7.24.0" }, "engines": { "node": ">=6.9.0" } }, "node_modules/@babel/traverse": { - "version": "7.23.9", - "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.23.9.tgz", - "integrity": "sha512-I/4UJ9vs90OkBtY6iiiTORVMyIhJ4kAVmsKo9KFc8UOxMeUfi2hvtIBsET5u9GizXE6/GFSuKCTNfgCswuEjRg==", + "version": "7.24.0", + "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.24.0.tgz", + "integrity": "sha512-HfuJlI8qq3dEDmNU5ChzzpZRWq+oxCZQyMzIMEqLho+AQnhMnKQUzH6ydo3RBl/YjPCuk68Y6s0Gx0AeyULiWw==", "dev": true, "dependencies": { "@babel/code-frame": "^7.23.5", @@ -492,8 +492,8 @@ "@babel/helper-function-name": "^7.23.0", "@babel/helper-hoist-variables": "^7.22.5", "@babel/helper-split-export-declaration": "^7.22.6", - "@babel/parser": "^7.23.9", - "@babel/types": "^7.23.9", + "@babel/parser": "^7.24.0", + "@babel/types": "^7.24.0", "debug": "^4.3.1", "globals": "^11.1.0" }, @@ -511,9 +511,9 @@ } }, "node_modules/@babel/types": { - "version": "7.23.9", - "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.23.9.tgz", - "integrity": "sha512-dQjSq/7HaSjRM43FFGnv5keM2HsxpmyV1PfaSVm0nzzjwwTmjOe6J4bC8e3+pTEIgHaHj+1ZlLThRJ2auc/w1Q==", + "version": "7.24.0", + "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.24.0.tgz", + "integrity": "sha512-+j7a5c253RfKh8iABBhywc8NSfP5LURe7Uh4qpsh6jc+aLJguvmIUBdjSdEMQv2bENrCR5MfRdjGo7vzS/ob7w==", "dev": true, "dependencies": { "@babel/helper-string-parser": "^7.23.4", @@ -594,18 +594,18 @@ } }, "node_modules/@eslint/js": { - "version": "8.56.0", - "resolved": "https://registry.npmjs.org/@eslint/js/-/js-8.56.0.tgz", - "integrity": "sha512-gMsVel9D7f2HLkBma9VbtzZRehRogVRfbr++f06nL2vnCGCNlzOD+/MUov/F4p8myyAHspEhVobgjpX64q5m6A==", + "version": "8.57.0", + "resolved": "https://registry.npmjs.org/@eslint/js/-/js-8.57.0.tgz", + "integrity": "sha512-Ys+3g2TaW7gADOJzPt83SJtCDhMjndcDMFVQ/Tj9iA1BfJzFKD9mAUXT3OenpuPHbI6P/myECxRJrofUsDx/5g==", "dev": true, "engines": { "node": "^12.22.0 || ^14.17.0 || >=16.0.0" } }, "node_modules/@fastify/busboy": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/@fastify/busboy/-/busboy-2.1.0.tgz", - "integrity": "sha512-+KpH+QxZU7O4675t3mnkQKcZZg56u+K/Ct2K+N2AZYNVK8kyeo/bI18tI8aPm3tvNNRyTWfj6s5tnGNlcbQRsA==", + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/@fastify/busboy/-/busboy-2.1.1.tgz", + "integrity": "sha512-vBZP4NlzfOlerQTnba4aqZoMhE/a9HY7HRqoOPaETQcSQuWEIyZMHGfVu6w9wGtGK5fED5qRs2DteVCjOH60sA==", "engines": { "node": ">=14" } @@ -774,14 +774,14 @@ } }, "node_modules/@jridgewell/gen-mapping": { - "version": "0.3.3", - "resolved": "https://registry.npmjs.org/@jridgewell/gen-mapping/-/gen-mapping-0.3.3.tgz", - "integrity": "sha512-HLhSWOLRi875zjjMG/r+Nv0oCW8umGb0BgEhyX3dDX3egwZtB8PqLnjz3yedt8R5StBrzcg4aBpnh8UA9D1BoQ==", + "version": "0.3.5", + "resolved": "https://registry.npmjs.org/@jridgewell/gen-mapping/-/gen-mapping-0.3.5.tgz", + "integrity": "sha512-IzL8ZoEDIBRWEzlCcRhOaCupYyN5gdIK+Q6fbFdPDg6HqX6jpkItn7DFIpW9LQzXG6Df9sA7+OKnq0qlz/GaQg==", "dev": true, "dependencies": { - "@jridgewell/set-array": "^1.0.1", + "@jridgewell/set-array": "^1.2.1", "@jridgewell/sourcemap-codec": "^1.4.10", - "@jridgewell/trace-mapping": "^0.3.9" + "@jridgewell/trace-mapping": "^0.3.24" }, "engines": { "node": ">=6.0.0" @@ -797,9 +797,9 @@ } }, "node_modules/@jridgewell/set-array": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/@jridgewell/set-array/-/set-array-1.1.2.tgz", - "integrity": "sha512-xnkseuNADM0gt2bs+BvhO0p78Mk762YnZdsuzFV018NoG1Sj1SCQvpSqa7XUaTam5vAGasABV9qXASMKnFMwMw==", + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/@jridgewell/set-array/-/set-array-1.2.1.tgz", + "integrity": "sha512-R8gLRTZeyp03ymzP/6Lil/28tGeGEzhx1q2k703KGWRAI1VdvPIXdG70VJc2pAMw3NA6JKL5hhFu1sJX0Mnn/A==", "dev": true, "engines": { "node": ">=6.0.0" @@ -812,9 +812,9 @@ "dev": true }, "node_modules/@jridgewell/trace-mapping": { - "version": "0.3.22", - "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.22.tgz", - "integrity": "sha512-Wf963MzWtA2sjrNt+g18IAln9lKnlRp+K2eH4jjIoF1wYeq3aMREpG09xhlhdzS0EjwU7qmUJYangWa+151vZw==", + "version": "0.3.25", + "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.25.tgz", + "integrity": "sha512-vNk6aEwybGtawWmy/PzwnGDOjCkLWSD2wqvjGGAgOAwCGWySYXfYoxt00IJkTF+8Lb57DwOb3Aa0o9CApepiYQ==", "dev": true, "dependencies": { "@jridgewell/resolve-uri": "^3.1.0", @@ -901,9 +901,9 @@ "dev": true }, "node_modules/@snyk/protect": { - "version": "1.1279.0", - "resolved": "https://registry.npmjs.org/@snyk/protect/-/protect-1.1279.0.tgz", - "integrity": "sha512-JviCIGYgPSrEAhaGyOTs1p2Guqe12LvjHgw4vbkDJtRCSkLX92h7CVnKhZIUoz3gOqTfDBDuW9uebhpk5OSVZg==", + "version": "1.1281.0", + "resolved": "https://registry.npmjs.org/@snyk/protect/-/protect-1.1281.0.tgz", + "integrity": "sha512-TcQauSDd2iHR7Rb+33vZ7sw79Y5ZSiQe17Yvy5FS0rhiCR9yYPyATLZlGk9y1zIvTVZ9RQPnirWY9+ahbf1Khg==", "dev": true, "bin": { "snyk-protect": "bin/snyk-protect" @@ -931,18 +931,18 @@ "dev": true }, "node_modules/@types/node": { - "version": "18.19.15", - "resolved": "https://registry.npmjs.org/@types/node/-/node-18.19.15.tgz", - "integrity": "sha512-AMZ2UWx+woHNfM11PyAEQmfSxi05jm9OlkxczuHeEqmvwPkYj6MWv44gbzDPefYOLysTOFyI3ziiy2ONmUZfpA==", + "version": "18.19.21", + "resolved": "https://registry.npmjs.org/@types/node/-/node-18.19.21.tgz", + "integrity": "sha512-2Q2NeB6BmiTFQi4DHBzncSoq/cJMLDdhPaAoJFnFCyD9a8VPZRf7a1GAwp1Edb7ROaZc5Jz/tnZyL6EsWMRaqw==", "dev": true, "dependencies": { "undici-types": "~5.26.4" } }, "node_modules/@types/semver": { - "version": "7.5.7", - "resolved": "https://registry.npmjs.org/@types/semver/-/semver-7.5.7.tgz", - "integrity": "sha512-/wdoPq1QqkSj9/QOeKkFquEuPzQbHTWAMPH/PaUMB+JuR31lXhlWXRZ52IpfDYVlDOUBvX09uBrPwxGT1hjNBg==", + "version": "7.5.8", + "resolved": "https://registry.npmjs.org/@types/semver/-/semver-7.5.8.tgz", + "integrity": "sha512-I8EUhyrgfLrcTkzV3TSsGyl1tSuPrEDzr0yd5m90UgNxQkyDXULk3b6MlQqTCpZpNtWe1K0hzclnZkTcLBe2UQ==", "dev": true }, "node_modules/@types/validator": { @@ -952,16 +952,16 @@ "dev": true }, "node_modules/@typescript-eslint/eslint-plugin": { - "version": "6.21.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-6.21.0.tgz", - "integrity": "sha512-oy9+hTPCUFpngkEZUSzbf9MxI65wbKFoQYsgPdILTfbUldp5ovUuphZVe4i30emU9M/kP+T64Di0mxl7dSw3MA==", + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-7.1.0.tgz", + "integrity": "sha512-j6vT/kCulhG5wBmGtstKeiVr1rdXE4nk+DT1k6trYkwlrvW9eOF5ZbgKnd/YR6PcM4uTEXa0h6Fcvf6X7Dxl0w==", "dev": true, "dependencies": { "@eslint-community/regexpp": "^4.5.1", - "@typescript-eslint/scope-manager": "6.21.0", - "@typescript-eslint/type-utils": "6.21.0", - "@typescript-eslint/utils": "6.21.0", - "@typescript-eslint/visitor-keys": "6.21.0", + "@typescript-eslint/scope-manager": "7.1.0", + "@typescript-eslint/type-utils": "7.1.0", + "@typescript-eslint/utils": "7.1.0", + "@typescript-eslint/visitor-keys": "7.1.0", "debug": "^4.3.4", "graphemer": "^1.4.0", "ignore": "^5.2.4", @@ -977,8 +977,8 @@ "url": "https://opencollective.com/typescript-eslint" }, "peerDependencies": { - "@typescript-eslint/parser": "^6.0.0 || ^6.0.0-alpha", - "eslint": "^7.0.0 || ^8.0.0" + "@typescript-eslint/parser": "^7.0.0", + "eslint": "^8.56.0" }, "peerDependenciesMeta": { "typescript": { @@ -987,15 +987,15 @@ } }, "node_modules/@typescript-eslint/parser": { - "version": "6.21.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-6.21.0.tgz", - "integrity": "sha512-tbsV1jPne5CkFQCgPBcDOt30ItF7aJoZL997JSF7MhGQqOeT3svWRYxiqlfA5RUdlHN6Fi+EI9bxqbdyAUZjYQ==", + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-7.1.0.tgz", + "integrity": "sha512-V1EknKUubZ1gWFjiOZhDSNToOjs63/9O0puCgGS8aDOgpZY326fzFu15QAUjwaXzRZjf/qdsdBrckYdv9YxB8w==", "dev": true, "dependencies": { - "@typescript-eslint/scope-manager": "6.21.0", - "@typescript-eslint/types": "6.21.0", - "@typescript-eslint/typescript-estree": "6.21.0", - "@typescript-eslint/visitor-keys": "6.21.0", + "@typescript-eslint/scope-manager": "7.1.0", + "@typescript-eslint/types": "7.1.0", + "@typescript-eslint/typescript-estree": "7.1.0", + "@typescript-eslint/visitor-keys": "7.1.0", "debug": "^4.3.4" }, "engines": { @@ -1006,7 +1006,7 @@ "url": "https://opencollective.com/typescript-eslint" }, "peerDependencies": { - "eslint": "^7.0.0 || ^8.0.0" + "eslint": "^8.56.0" }, "peerDependenciesMeta": { "typescript": { @@ -1015,13 +1015,13 @@ } }, "node_modules/@typescript-eslint/scope-manager": { - "version": "6.21.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-6.21.0.tgz", - "integrity": "sha512-OwLUIWZJry80O99zvqXVEioyniJMa+d2GrqpUTqi5/v5D5rOrppJVBPa0yKCblcigC0/aYAzxxqQ1B+DS2RYsg==", + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-7.1.0.tgz", + "integrity": "sha512-6TmN4OJiohHfoOdGZ3huuLhpiUgOGTpgXNUPJgeZOZR3DnIpdSgtt83RS35OYNNXxM4TScVlpVKC9jyQSETR1A==", "dev": true, "dependencies": { - "@typescript-eslint/types": "6.21.0", - "@typescript-eslint/visitor-keys": "6.21.0" + "@typescript-eslint/types": "7.1.0", + "@typescript-eslint/visitor-keys": "7.1.0" }, "engines": { "node": "^16.0.0 || >=18.0.0" @@ -1032,13 +1032,13 @@ } }, "node_modules/@typescript-eslint/type-utils": { - "version": "6.21.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-6.21.0.tgz", - "integrity": "sha512-rZQI7wHfao8qMX3Rd3xqeYSMCL3SoiSQLBATSiVKARdFGCYSRvmViieZjqc58jKgs8Y8i9YvVVhRbHSTA4VBag==", + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-7.1.0.tgz", + "integrity": "sha512-UZIhv8G+5b5skkcuhgvxYWHjk7FW7/JP5lPASMEUoliAPwIH/rxoUSQPia2cuOj9AmDZmwUl1usKm85t5VUMew==", "dev": true, "dependencies": { - "@typescript-eslint/typescript-estree": "6.21.0", - "@typescript-eslint/utils": "6.21.0", + "@typescript-eslint/typescript-estree": "7.1.0", + "@typescript-eslint/utils": "7.1.0", "debug": "^4.3.4", "ts-api-utils": "^1.0.1" }, @@ -1050,7 +1050,7 @@ "url": "https://opencollective.com/typescript-eslint" }, "peerDependencies": { - "eslint": "^7.0.0 || ^8.0.0" + "eslint": "^8.56.0" }, "peerDependenciesMeta": { "typescript": { @@ -1059,9 +1059,9 @@ } }, "node_modules/@typescript-eslint/types": { - "version": "6.21.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-6.21.0.tgz", - "integrity": "sha512-1kFmZ1rOm5epu9NZEZm1kckCDGj5UJEf7P1kliH4LKu/RkwpsfqqGmY2OOcUs18lSlQBKLDYBOGxRVtrMN5lpg==", + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-7.1.0.tgz", + "integrity": "sha512-qTWjWieJ1tRJkxgZYXx6WUYtWlBc48YRxgY2JN1aGeVpkhmnopq+SUC8UEVGNXIvWH7XyuTjwALfG6bFEgCkQA==", "dev": true, "engines": { "node": "^16.0.0 || >=18.0.0" @@ -1072,13 +1072,13 @@ } }, "node_modules/@typescript-eslint/typescript-estree": { - "version": "6.21.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-6.21.0.tgz", - "integrity": "sha512-6npJTkZcO+y2/kr+z0hc4HwNfrrP4kNYh57ek7yCNlrBjWQ1Y0OS7jiZTkgumrvkX5HkEKXFZkkdFNkaW2wmUQ==", + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-7.1.0.tgz", + "integrity": "sha512-k7MyrbD6E463CBbSpcOnwa8oXRdHzH1WiVzOipK3L5KSML92ZKgUBrTlehdi7PEIMT8k0bQixHUGXggPAlKnOQ==", "dev": true, "dependencies": { - "@typescript-eslint/types": "6.21.0", - "@typescript-eslint/visitor-keys": "6.21.0", + "@typescript-eslint/types": "7.1.0", + "@typescript-eslint/visitor-keys": "7.1.0", "debug": "^4.3.4", "globby": "^11.1.0", "is-glob": "^4.0.3", @@ -1100,17 +1100,17 @@ } }, "node_modules/@typescript-eslint/utils": { - "version": "6.21.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-6.21.0.tgz", - "integrity": "sha512-NfWVaC8HP9T8cbKQxHcsJBY5YE1O33+jpMwN45qzWWaPDZgLIbo12toGMWnmhvCpd3sIxkpDw3Wv1B3dYrbDQQ==", + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-7.1.0.tgz", + "integrity": "sha512-WUFba6PZC5OCGEmbweGpnNJytJiLG7ZvDBJJoUcX4qZYf1mGZ97mO2Mps6O2efxJcJdRNpqweCistDbZMwIVHw==", "dev": true, "dependencies": { "@eslint-community/eslint-utils": "^4.4.0", "@types/json-schema": "^7.0.12", "@types/semver": "^7.5.0", - "@typescript-eslint/scope-manager": "6.21.0", - "@typescript-eslint/types": "6.21.0", - "@typescript-eslint/typescript-estree": "6.21.0", + "@typescript-eslint/scope-manager": "7.1.0", + "@typescript-eslint/types": "7.1.0", + "@typescript-eslint/typescript-estree": "7.1.0", "semver": "^7.5.4" }, "engines": { @@ -1121,16 +1121,16 @@ "url": "https://opencollective.com/typescript-eslint" }, "peerDependencies": { - "eslint": "^7.0.0 || ^8.0.0" + "eslint": "^8.56.0" } }, "node_modules/@typescript-eslint/visitor-keys": { - "version": "6.21.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-6.21.0.tgz", - "integrity": "sha512-JJtkDduxLi9bivAB+cYOVMtbkqdPOhZ+ZI5LC47MIRrDV4Yn2o+ZnW10Nkmr28xRpSpdJ6Sm42Hjf2+REYXm0A==", + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-7.1.0.tgz", + "integrity": "sha512-FhUqNWluiGNzlvnDZiXad4mZRhtghdoKW6e98GoEOYSu5cND+E39rG5KwJMUzeENwm1ztYBRqof8wMLP+wNPIA==", "dev": true, "dependencies": { - "@typescript-eslint/types": "6.21.0", + "@typescript-eslint/types": "7.1.0", "eslint-visitor-keys": "^3.4.1" }, "engines": { @@ -1426,10 +1426,13 @@ } }, "node_modules/available-typed-arrays": { - "version": "1.0.6", - "resolved": "https://registry.npmjs.org/available-typed-arrays/-/available-typed-arrays-1.0.6.tgz", - "integrity": "sha512-j1QzY8iPNPG4o4xmO3ptzpRxTciqD3MgEHtifP/YnJpIo58Xu+ne4BejlbkuaLfXn/nz6HFiw29bLpj2PNMdGg==", + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/available-typed-arrays/-/available-typed-arrays-1.0.7.tgz", + "integrity": "sha512-wvUjBtSGN7+7SjNpq/9M2Tg350UZD3q62IFZLbRAR1bSMlCo1ZaeW+BJ+D090e4hIIZLBcTDWe4Mh4jvUDajzQ==", "dev": true, + "dependencies": { + "possible-typed-array-names": "^1.0.0" + }, "engines": { "node": ">= 0.4" }, @@ -1575,9 +1578,9 @@ } }, "node_modules/caniuse-lite": { - "version": "1.0.30001587", - "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001587.tgz", - "integrity": "sha512-HMFNotUmLXn71BQxg8cijvqxnIAofforZOwGsxyXJ0qugTdspUF4sPSJ2vhgprHCB996tIDzEq1ubumPDV8ULA==", + "version": "1.0.30001591", + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001591.tgz", + "integrity": "sha512-PCzRMei/vXjJyL5mJtzNiUCKP59dm8Apqc3PH8gJkMnMXZGox93RbE76jHsmLwmIo6/3nsYIpJtx0O7u5PqFuQ==", "dev": true, "funding": [ { @@ -2000,9 +2003,9 @@ } }, "node_modules/electron-to-chromium": { - "version": "1.4.669", - "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.669.tgz", - "integrity": "sha512-E2SmpffFPrZhBSgf8ibqanRS2mpuk3FIRDzLDwt7WFpfgJMKDHJs0hmacyP0PS1cWsq0dVkwIIzlscNaterkPg==", + "version": "1.4.690", + "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.690.tgz", + "integrity": "sha512-+2OAGjUx68xElQhydpcbqH50hE8Vs2K6TkAeLhICYfndb67CVH0UsZaijmRUE3rHlIxU1u0jxwhgVe6fK3YANA==", "dev": true }, "node_modules/emoji-regex": { @@ -2023,18 +2026,18 @@ } }, "node_modules/es-abstract": { - "version": "1.22.4", - "resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.22.4.tgz", - "integrity": "sha512-vZYJlk2u6qHYxBOTjAeg7qUxHdNfih64Uu2J8QqWgXZ2cri0ZpJAkzDUK/q593+mvKwlxyaxr6F1Q+3LKoQRgg==", + "version": "1.22.5", + "resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.22.5.tgz", + "integrity": "sha512-oW69R+4q2wG+Hc3KZePPZxOiisRIqfKBVo/HLx94QcJeWGU/8sZhCvc829rd1kS366vlJbzBfXf9yWwf0+Ko7w==", "dev": true, "dependencies": { "array-buffer-byte-length": "^1.0.1", "arraybuffer.prototype.slice": "^1.0.3", - "available-typed-arrays": "^1.0.6", + "available-typed-arrays": "^1.0.7", "call-bind": "^1.0.7", "es-define-property": "^1.0.0", "es-errors": "^1.3.0", - "es-set-tostringtag": "^2.0.2", + "es-set-tostringtag": "^2.0.3", "es-to-primitive": "^1.2.1", "function.prototype.name": "^1.1.6", "get-intrinsic": "^1.2.4", @@ -2042,15 +2045,15 @@ "globalthis": "^1.0.3", "gopd": "^1.0.1", "has-property-descriptors": "^1.0.2", - "has-proto": "^1.0.1", + "has-proto": "^1.0.3", "has-symbols": "^1.0.3", "hasown": "^2.0.1", "internal-slot": "^1.0.7", "is-array-buffer": "^3.0.4", "is-callable": "^1.2.7", - "is-negative-zero": "^2.0.2", + "is-negative-zero": "^2.0.3", "is-regex": "^1.1.4", - "is-shared-array-buffer": "^1.0.2", + "is-shared-array-buffer": "^1.0.3", "is-string": "^1.0.7", "is-typed-array": "^1.1.13", "is-weakref": "^1.0.2", @@ -2063,10 +2066,10 @@ "string.prototype.trim": "^1.2.8", "string.prototype.trimend": "^1.0.7", "string.prototype.trimstart": "^1.0.7", - "typed-array-buffer": "^1.0.1", - "typed-array-byte-length": "^1.0.0", - "typed-array-byte-offset": "^1.0.0", - "typed-array-length": "^1.0.4", + "typed-array-buffer": "^1.0.2", + "typed-array-byte-length": "^1.0.1", + "typed-array-byte-offset": "^1.0.2", + "typed-array-length": "^1.0.5", "unbox-primitive": "^1.0.2", "which-typed-array": "^1.1.14" }, @@ -2105,14 +2108,14 @@ } }, "node_modules/es-set-tostringtag": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/es-set-tostringtag/-/es-set-tostringtag-2.0.2.tgz", - "integrity": "sha512-BuDyupZt65P9D2D2vA/zqcI3G5xRsklm5N3xCwuiy+/vKy8i0ifdsQP1sLgO4tZDSCaQUSnmC48khknGMV3D2Q==", + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/es-set-tostringtag/-/es-set-tostringtag-2.0.3.tgz", + "integrity": "sha512-3T8uNMC3OQTHkFUsFq8r/BwAXLHvU/9O9mE0fBc/MY5iq/8H7ncvO947LmYA6ldWw9Uh8Yhf25zu6n7nML5QWQ==", "dev": true, "dependencies": { - "get-intrinsic": "^1.2.2", - "has-tostringtag": "^1.0.0", - "hasown": "^2.0.0" + "get-intrinsic": "^1.2.4", + "has-tostringtag": "^1.0.2", + "hasown": "^2.0.1" }, "engines": { "node": ">= 0.4" @@ -2172,16 +2175,16 @@ } }, "node_modules/eslint": { - "version": "8.56.0", - "resolved": "https://registry.npmjs.org/eslint/-/eslint-8.56.0.tgz", - "integrity": "sha512-Go19xM6T9puCOWntie1/P997aXxFsOi37JIHRWI514Hc6ZnaHGKY9xFhrU65RT6CcBEzZoGG1e6Nq+DT04ZtZQ==", + "version": "8.57.0", + "resolved": "https://registry.npmjs.org/eslint/-/eslint-8.57.0.tgz", + "integrity": "sha512-dZ6+mexnaTIbSBZWgou51U6OmzIhYM2VcNdtiTtI7qPNZm35Akpr0f6vtw3w1Kmn5PYo+tZVfh13WrhpS6oLqQ==", "dev": true, "dependencies": { "@eslint-community/eslint-utils": "^4.2.0", "@eslint-community/regexpp": "^4.6.1", "@eslint/eslintrc": "^2.1.4", - "@eslint/js": "8.56.0", - "@humanwhocodes/config-array": "^0.11.13", + "@eslint/js": "8.57.0", + "@humanwhocodes/config-array": "^0.11.14", "@humanwhocodes/module-importer": "^1.0.1", "@nodelib/fs.walk": "^1.2.8", "@ungap/structured-clone": "^1.2.0", @@ -2255,18 +2258,17 @@ } }, "node_modules/eslint-config-airbnb-typescript": { - "version": "17.1.0", - "resolved": "https://registry.npmjs.org/eslint-config-airbnb-typescript/-/eslint-config-airbnb-typescript-17.1.0.tgz", - "integrity": "sha512-GPxI5URre6dDpJ0CtcthSZVBAfI+Uw7un5OYNVxP2EYi3H81Jw701yFP7AU+/vCE7xBtFmjge7kfhhk4+RAiig==", + "version": "18.0.0", + "resolved": "https://registry.npmjs.org/eslint-config-airbnb-typescript/-/eslint-config-airbnb-typescript-18.0.0.tgz", + "integrity": "sha512-oc+Lxzgzsu8FQyFVa4QFaVKiitTYiiW3frB9KYW5OWdPrqFc7FzxgB20hP4cHMlr+MBzGcLl3jnCOVOydL9mIg==", "dev": true, "dependencies": { "eslint-config-airbnb-base": "^15.0.0" }, "peerDependencies": { - "@typescript-eslint/eslint-plugin": "^5.13.0 || ^6.0.0", - "@typescript-eslint/parser": "^5.0.0 || ^6.0.0", - "eslint": "^7.32.0 || ^8.2.0", - "eslint-plugin-import": "^2.25.3" + "@typescript-eslint/eslint-plugin": "^7.0.0", + "@typescript-eslint/parser": "^7.0.0", + "eslint": "^8.56.0" } }, "node_modules/eslint-import-resolver-node": { @@ -2290,9 +2292,9 @@ } }, "node_modules/eslint-module-utils": { - "version": "2.8.0", - "resolved": "https://registry.npmjs.org/eslint-module-utils/-/eslint-module-utils-2.8.0.tgz", - "integrity": "sha512-aWajIYfsqCKRDgUfjEXNN/JlrzauMuSEy5sbd7WXbtW3EH6A6MpwEh42c7qD+MqQo9QMJ6fWLAeIJynx0g6OAw==", + "version": "2.8.1", + "resolved": "https://registry.npmjs.org/eslint-module-utils/-/eslint-module-utils-2.8.1.tgz", + "integrity": "sha512-rXDXR3h7cs7dy9RNpUlQf80nX31XWJEyGq1tRMo+6GsO5VmTe4UTwtmonAD4ZkAsrfMVDA2wlGJ3790Ys+D49Q==", "dev": true, "dependencies": { "debug": "^3.2.7" @@ -2399,9 +2401,9 @@ } }, "node_modules/eslint-plugin-mocha": { - "version": "10.2.0", - "resolved": "https://registry.npmjs.org/eslint-plugin-mocha/-/eslint-plugin-mocha-10.2.0.tgz", - "integrity": "sha512-ZhdxzSZnd1P9LqDPF0DBcFLpRIGdh1zkF2JHnQklKQOvrQtT73kdP5K9V2mzvbLR+cCAO9OI48NXK/Ax9/ciCQ==", + "version": "10.3.0", + "resolved": "https://registry.npmjs.org/eslint-plugin-mocha/-/eslint-plugin-mocha-10.3.0.tgz", + "integrity": "sha512-IWzbg2K6B1Q7h37Ih4zMyW+nhmw1JvUlHlbCUUUu6PfOOAUGCB0gxmvv7/U+TQQ6e8yHUv+q7KMdIIum4bx+PA==", "dev": true, "dependencies": { "eslint-utils": "^3.0.0", @@ -2711,9 +2713,9 @@ } }, "node_modules/flatted": { - "version": "3.2.9", - "resolved": "https://registry.npmjs.org/flatted/-/flatted-3.2.9.tgz", - "integrity": "sha512-36yxDn5H7OFZQla0/jFJmbIKTdZAQHngCedGxiMmpNfEZM0sdEeT+WczLQrjK6D7o2aiyLYDnkw0R3JK0Qv1RQ==", + "version": "3.3.1", + "resolved": "https://registry.npmjs.org/flatted/-/flatted-3.3.1.tgz", + "integrity": "sha512-X8cqMLLie7KsNUDSdzeN8FYK9rEt4Dt67OsG/DNGnYTSDBG4uFAJFBnUeiV+zCVAvwFy56IjM9sH51jVaEhNxw==", "dev": true }, "node_modules/for-each": { @@ -3034,9 +3036,9 @@ } }, "node_modules/has-proto": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/has-proto/-/has-proto-1.0.1.tgz", - "integrity": "sha512-7qE+iP+O+bgF9clE5+UoBFzE65mlBiVj3tKCrlNQ0Ogwm0BjpT/gK4SlLYDMybDh5I3TCTKnPPa0oMG7JDYrhg==", + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/has-proto/-/has-proto-1.0.3.tgz", + "integrity": "sha512-SJ1amZAJUiZS+PhsVLf5tGydlaVB8EdFpaSO4gmiUKUOxk8qzn5AIy4ZeJUmh22znIdk/uMAUT2pl3FxzVUH+Q==", "dev": true, "engines": { "node": ">= 0.4" @@ -3352,9 +3354,9 @@ } }, "node_modules/is-negative-zero": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/is-negative-zero/-/is-negative-zero-2.0.2.tgz", - "integrity": "sha512-dqJvarLawXsFbNDeJW7zAz8ItJ9cd28YufuuFzh0G8pNHjJMnY08Dv7sYX2uF5UpQOwieAeOExEYAWWfu7ZZUA==", + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/is-negative-zero/-/is-negative-zero-2.0.3.tgz", + "integrity": "sha512-5KoIu2Ngpyek75jXodFvnafB6DJgr3u8uuK0LEZJjrU19DrMD3EVERaR8sjz8CCGgpZvxPl9SuE1GMVPFHx1mw==", "dev": true, "engines": { "node": ">= 0.4" @@ -3422,12 +3424,15 @@ } }, "node_modules/is-shared-array-buffer": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/is-shared-array-buffer/-/is-shared-array-buffer-1.0.2.tgz", - "integrity": "sha512-sqN2UDu1/0y6uvXyStCOzyhAjCSlHceFoMKJW8W9EU9cvic/QdsZ0kEU93HEy3IUEFZIiH/3w+AH/UQbPHNdhA==", + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/is-shared-array-buffer/-/is-shared-array-buffer-1.0.3.tgz", + "integrity": "sha512-nA2hv5XIhLR3uVzDDfCIknerhx8XUKnstuOERPNNIinXG7v9u+ohXF67vxm4TPTEPU6lm61ZkwP3c9PCB97rhg==", "dev": true, "dependencies": { - "call-bind": "^1.0.2" + "call-bind": "^1.0.7" + }, + "engines": { + "node": ">= 0.4" }, "funding": { "url": "https://github.com/sponsors/ljharb" @@ -3647,9 +3652,9 @@ } }, "node_modules/istanbul-reports": { - "version": "3.1.6", - "resolved": "https://registry.npmjs.org/istanbul-reports/-/istanbul-reports-3.1.6.tgz", - "integrity": "sha512-TLgnMkKg3iTDsQ9PbPTdpfAK2DzjF9mqUG7RMgcQl8oFjad8ob4laGxv5XV5U9MAfx8D6tSJiUyuAwzLicaxlg==", + "version": "3.1.7", + "resolved": "https://registry.npmjs.org/istanbul-reports/-/istanbul-reports-3.1.7.tgz", + "integrity": "sha512-BewmUXImeuRk2YY0PVbxgKAysvhRPUQE0h5QRM++nVWyubKGV0l8qQ5op8+B2DOmwSe63Jivj0BjkPQVf8fP5g==", "dev": true, "dependencies": { "html-escaper": "^2.0.0", @@ -4606,6 +4611,15 @@ "node": ">=8" } }, + "node_modules/possible-typed-array-names": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/possible-typed-array-names/-/possible-typed-array-names-1.0.0.tgz", + "integrity": "sha512-d7Uw+eZoloe0EHDIYoe+bQ5WXnGMOpmiZFTuMWCwpjzzkL2nTjcKiAk4hh8TjnGye2TwWOk3UXucZ+3rbmBa8Q==", + "dev": true, + "engines": { + "node": ">= 0.4" + } + }, "node_modules/prelude-ls": { "version": "1.2.1", "resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.2.1.tgz", @@ -4970,14 +4984,15 @@ } }, "node_modules/set-function-name": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/set-function-name/-/set-function-name-2.0.1.tgz", - "integrity": "sha512-tMNCiqYVkXIZgc2Hnoy2IvC/f8ezc5koaRFkCjrpWzGpCd3qbZXPzVy9MAZzK1ch/X0jvSkojys3oqJN0qCmdA==", + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/set-function-name/-/set-function-name-2.0.2.tgz", + "integrity": "sha512-7PGFlmtwsEADb0WYyvCMa1t+yke6daIG4Wirafur5kcf+MhUnPms1UeR0CKQdTZD81yESwMHbtn+TR+dMviakQ==", "dev": true, "dependencies": { - "define-data-property": "^1.0.1", + "define-data-property": "^1.1.4", + "es-errors": "^1.3.0", "functions-have-names": "^1.2.3", - "has-property-descriptors": "^1.0.0" + "has-property-descriptors": "^1.0.2" }, "engines": { "node": ">= 0.4" @@ -5005,12 +5020,12 @@ } }, "node_modules/side-channel": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.0.5.tgz", - "integrity": "sha512-QcgiIWV4WV7qWExbN5llt6frQB/lBven9pqliLXfGPB+K9ZYXxDozp0wLkHS24kWCm+6YXH/f0HhnObZnZOBnQ==", + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.0.6.tgz", + "integrity": "sha512-fDW/EZ6Q9RiO8eFG8Hj+7u/oW+XrPTIChwCOM2+th2A6OblDtYYIpve9m+KvI9Z4C9qSEXlaGR6bTEYHReuglA==", "dev": true, "dependencies": { - "call-bind": "^1.0.6", + "call-bind": "^1.0.7", "es-errors": "^1.3.0", "get-intrinsic": "^1.2.4", "object-inspect": "^1.13.1" @@ -5436,12 +5451,12 @@ } }, "node_modules/typed-array-buffer": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/typed-array-buffer/-/typed-array-buffer-1.0.1.tgz", - "integrity": "sha512-RSqu1UEuSlrBhHTWC8O9FnPjOduNs4M7rJ4pRKoEjtx1zUNOPN2sSXHLDX+Y2WPbHIxbvg4JFo2DNAEfPIKWoQ==", + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/typed-array-buffer/-/typed-array-buffer-1.0.2.tgz", + "integrity": "sha512-gEymJYKZtKXzzBzM4jqa9w6Q1Jjm7x2d+sh19AdsD4wqnMPDYyvwpsIc2Q/835kHuo3BEQ7CjelGhfTsoBb2MQ==", "dev": true, "dependencies": { - "call-bind": "^1.0.6", + "call-bind": "^1.0.7", "es-errors": "^1.3.0", "is-typed-array": "^1.1.13" }, @@ -5450,15 +5465,16 @@ } }, "node_modules/typed-array-byte-length": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/typed-array-byte-length/-/typed-array-byte-length-1.0.0.tgz", - "integrity": "sha512-Or/+kvLxNpeQ9DtSydonMxCx+9ZXOswtwJn17SNLvhptaXYDJvkFFP5zbfU/uLmvnBJlI4yrnXRxpdWH/M5tNA==", + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/typed-array-byte-length/-/typed-array-byte-length-1.0.1.tgz", + "integrity": "sha512-3iMJ9q0ao7WE9tWcaYKIptkNBuOIcZCCT0d4MRvuuH88fEoEH62IuQe0OtraD3ebQEoTRk8XCBoknUNc1Y67pw==", "dev": true, "dependencies": { - "call-bind": "^1.0.2", + "call-bind": "^1.0.7", "for-each": "^0.3.3", - "has-proto": "^1.0.1", - "is-typed-array": "^1.1.10" + "gopd": "^1.0.1", + "has-proto": "^1.0.3", + "is-typed-array": "^1.1.13" }, "engines": { "node": ">= 0.4" @@ -5468,16 +5484,17 @@ } }, "node_modules/typed-array-byte-offset": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/typed-array-byte-offset/-/typed-array-byte-offset-1.0.0.tgz", - "integrity": "sha512-RD97prjEt9EL8YgAgpOkf3O4IF9lhJFr9g0htQkm0rchFp/Vx7LW5Q8fSXXub7BXAODyUQohRMyOc3faCPd0hg==", + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/typed-array-byte-offset/-/typed-array-byte-offset-1.0.2.tgz", + "integrity": "sha512-Ous0vodHa56FviZucS2E63zkgtgrACj7omjwd/8lTEMEPFFyjfixMZ1ZXenpgCFBBt4EC1J2XsyVS2gkG0eTFA==", "dev": true, "dependencies": { - "available-typed-arrays": "^1.0.5", - "call-bind": "^1.0.2", + "available-typed-arrays": "^1.0.7", + "call-bind": "^1.0.7", "for-each": "^0.3.3", - "has-proto": "^1.0.1", - "is-typed-array": "^1.1.10" + "gopd": "^1.0.1", + "has-proto": "^1.0.3", + "is-typed-array": "^1.1.13" }, "engines": { "node": ">= 0.4" @@ -5487,14 +5504,20 @@ } }, "node_modules/typed-array-length": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/typed-array-length/-/typed-array-length-1.0.4.tgz", - "integrity": "sha512-KjZypGq+I/H7HI5HlOoGHkWUUGq+Q0TPhQurLbyrVrvnKTBgzLhIJ7j6J/XTQOi0d1RjyZ0wdas8bKs2p0x3Ng==", + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/typed-array-length/-/typed-array-length-1.0.5.tgz", + "integrity": "sha512-yMi0PlwuznKHxKmcpoOdeLwxBoVPkqZxd7q2FgMkmD3bNwvF5VW0+UlUQ1k1vmktTu4Yu13Q0RIxEP8+B+wloA==", "dev": true, "dependencies": { - "call-bind": "^1.0.2", + "call-bind": "^1.0.7", "for-each": "^0.3.3", - "is-typed-array": "^1.1.9" + "gopd": "^1.0.1", + "has-proto": "^1.0.3", + "is-typed-array": "^1.1.13", + "possible-typed-array-names": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" }, "funding": { "url": "https://github.com/sponsors/ljharb" diff --git a/package.json b/package.json index 5f2f617..2afe38f 100644 --- a/package.json +++ b/package.json @@ -37,18 +37,18 @@ "index.ts" ], "devDependencies": { - "@snyk/protect": "^1.1279.0", + "@snyk/protect": "^1.1281.0", "@types/mocha": "^10.0.6", - "@types/node": "^18.19.15", + "@types/node": "^18.19.21", "@types/validator": "^13.11.9", - "@typescript-eslint/eslint-plugin": "^6.21.0", - "@typescript-eslint/parser": "^6.21.0", + "@typescript-eslint/eslint-plugin": "^7.1.0", + "@typescript-eslint/parser": "^7.1.0", "chai": "^4.4.1", - "eslint": "^8.56.0", + "eslint": "^8.57.0", "eslint-config-airbnb-base": "^15.0.0", - "eslint-config-airbnb-typescript": "^17.1.0", + "eslint-config-airbnb-typescript": "^18.0.0", "eslint-plugin-import": "^2.29.1", - "eslint-plugin-mocha": "^10.2.0", + "eslint-plugin-mocha": "^10.3.0", "eslint-plugin-promise": "^6.1.1", "mocha": "^10.3.0", "nyc": "^15.1.0", From 680ba0354126cf7a574c4ce918e3fea757a8aa16 Mon Sep 17 00:00:00 2001 From: jshemas Date: Sat, 2 Mar 2024 23:26:51 -0500 Subject: [PATCH 3/9] eslint: mocha/consistent-spacing-between-blocks --- tests/integration/basic.spec.ts | 8 +++ tests/integration/blacklist.spec.ts | 2 + tests/integration/encoding.spec.ts | 1 + tests/integration/fetch.spec.ts | 1 + tests/integration/html.spec.ts | 2 + tests/integration/image.spec.ts | 1 + .../integration/onlyGetOpenGraphInfo.spec.ts | 1 + tests/integration/spotify.spec.ts | 3 ++ tests/integration/static.spec.ts | 52 +++++++++++++++++++ tests/integration/url.spec.ts | 11 ++++ tests/integration/video.spec.ts | 1 + tests/unit/media.spec.ts | 18 +++++++ tests/unit/utils.spec.ts | 17 ++++++ 13 files changed, 118 insertions(+) diff --git a/tests/integration/basic.spec.ts b/tests/integration/basic.spec.ts index 7a5ce5a..c13153e 100644 --- a/tests/integration/basic.spec.ts +++ b/tests/integration/basic.spec.ts @@ -48,6 +48,7 @@ describe('basic', function () { expect(response).to.be.an('Response'); }); }); + it('using await should return valid data', async function () { const { error, result, response } = await ogsRequire({ url: 'https://ogp.me/' }); console.log('error:', error); @@ -79,6 +80,7 @@ describe('basic', function () { ); expect(response).to.be.an('Response'); }); + it('using callbackify should return valid data', function () { const ogsCallback = util.callbackify(ogsRequire); return ogsCallback({ @@ -105,6 +107,7 @@ describe('basic', function () { expect(response.response).to.be.an('Response'); }); }); + it('using ogs import should still work', async function () { return ogs({ url: 'https://ogp.me/' }).then(function ({ error, result, response }) { console.log('error:', error); @@ -137,6 +140,7 @@ describe('basic', function () { expect(response).to.be.an('Response'); }); }); + it('Test Name Cheap Page That Dose Not Have content-type=text/html - Should Return correct Open Graph Info', function () { return ogsRequire({ url: 'https://www.namecheap.com/' }).then(function ({ error, result, response }) { console.log('error:', error); @@ -165,6 +169,7 @@ describe('basic', function () { expect(response).to.be.an('Response'); }); }); + it('Test README.md using the default Accept: text/html header - Should Return correct Open Graph Info', function () { return ogsRequire({ url: 'https://github.com/jshemas/openGraphScraper/blob/master/README.md' }).then(function ({ error, result, response }) { console.log('error:', error); @@ -207,6 +212,7 @@ describe('basic', function () { expect(response).to.be.an('Response'); }); }); + it('vimeo.com should return open graph data', function () { return ogsRequire({ url: 'https://vimeo.com/232889838' }).then(function ({ error, result, response }) { console.log('error:', error); @@ -301,6 +307,7 @@ describe('basic', function () { expect(response).to.be.an('Response'); }); }); + it('mozilla.org should return open graph data with one title', function () { return ogsRequire({ url: 'https://jshemas.github.io/openGraphScraperPages/mozilla' }).then(function ({ error, result, response }) { console.log('error:', error); @@ -335,6 +342,7 @@ describe('basic', function () { expect(response).to.be.an('Response'); }); }); + it('facebook - testing cors mode - header origin should default to url', function () { return ogs({ url: 'https://www.facebook.com/' }) .then(function ({ error, result, response }) { diff --git a/tests/integration/blacklist.spec.ts b/tests/integration/blacklist.spec.ts index f33ffae..0b1e8cf 100644 --- a/tests/integration/blacklist.spec.ts +++ b/tests/integration/blacklist.spec.ts @@ -28,6 +28,7 @@ describe('blacklist', function () { expect(response).to.eql(undefined); }); }); + it('when website is not on the blacklist', function () { return ogs({ url: 'https://www.wikipedia.org/', @@ -57,6 +58,7 @@ describe('blacklist', function () { expect(response).to.be.an('Response'); }); }); + it('when blacklist empty', function () { return ogs({ url: 'https://www.wikipedia.org/', diff --git a/tests/integration/encoding.spec.ts b/tests/integration/encoding.spec.ts index 5e774f5..f8225e9 100644 --- a/tests/integration/encoding.spec.ts +++ b/tests/integration/encoding.spec.ts @@ -598,6 +598,7 @@ describe('encoding', function () { }); }); }); + it('abehiroshi - ShiftJIS', function () { return ogs({ url: 'http://abehiroshi.la.coocan.jp/' }) .then(function (data) { diff --git a/tests/integration/fetch.spec.ts b/tests/integration/fetch.spec.ts index 0784f82..553fa57 100644 --- a/tests/integration/fetch.spec.ts +++ b/tests/integration/fetch.spec.ts @@ -34,6 +34,7 @@ describe('fetch', function () { expect(rawUa).to.be.eql(`rawUa: ${userAgent}`); }); }); + it('setting a timeout', function () { return ogs({ url: 'https://releases.ubuntu.com/23.04/ubuntu-23.04-desktop-amd64.iso', timeout: 3 }) .then(function () { diff --git a/tests/integration/html.spec.ts b/tests/integration/html.spec.ts index e3ccc3c..9636058 100644 --- a/tests/integration/html.spec.ts +++ b/tests/integration/html.spec.ts @@ -28,6 +28,7 @@ describe('html', function () { expect(response).to.be.an('object').and.to.not.be.empty; }); }); + it('Invalid Call - Can\'t request URL and pass in HTML string', function () { return ogs({ url: 'https://upload.wikimedia.org/wikipedia/commons.jpg', @@ -53,6 +54,7 @@ describe('html', function () { expect(response).to.eql(undefined); }); }); + it('Invalid Call - Not a HTML page', function () { return ogs({ url: 'https://upload.wikimedia.org/wikipedia/commons.jpg', diff --git a/tests/integration/image.spec.ts b/tests/integration/image.spec.ts index 338c45e..c90f6f8 100644 --- a/tests/integration/image.spec.ts +++ b/tests/integration/image.spec.ts @@ -58,6 +58,7 @@ describe('image', function () { expect(response).to.be.an('Response'); }); }); + it('Test getting the description and images from meta tags', function () { return ogs({ url: 'https://jshemas.github.io/openGraphScraperPages/twitter.html' }).then(function ({ error, result, response }) { console.log('error:', error); diff --git a/tests/integration/onlyGetOpenGraphInfo.spec.ts b/tests/integration/onlyGetOpenGraphInfo.spec.ts index 5191d6d..46d984f 100644 --- a/tests/integration/onlyGetOpenGraphInfo.spec.ts +++ b/tests/integration/onlyGetOpenGraphInfo.spec.ts @@ -24,6 +24,7 @@ describe('onlyGetOpenGraphInfo', function () { expect(response).to.be.an('Response'); }); }); + it('should get all open graph info', function () { return ogs({ url: 'http://www.wikipedia.org/', diff --git a/tests/integration/spotify.spec.ts b/tests/integration/spotify.spec.ts index d9a6c71..8be48fd 100644 --- a/tests/integration/spotify.spec.ts +++ b/tests/integration/spotify.spec.ts @@ -100,6 +100,7 @@ describe('spotify', function () { expect(response).to.be.an('Response'); }); }); + it('artist should return music:musician', function () { return ogs({ url: 'https://open.spotify.com/artist/5K4W6rqBFWDnAN6FQUkS6x' }).then(function ({ error, result, response }) { console.log('error:', error); @@ -158,6 +159,7 @@ describe('spotify', function () { expect(response).to.be.an('Response'); }); }); + it('track should return music:song and associated tags', function () { return ogs({ url: 'https://open.spotify.com/track/3p6fkbeZDIVqapfdgQe6fm' }).then(function ({ error, result, response }) { console.log('error:', error); @@ -230,6 +232,7 @@ describe('spotify', function () { expect(response).to.be.an('Response'); }); }); + it('playlist should return music:playlist and associated tags', function () { return ogs({ url: 'https://jshemas.github.io/openGraphScraperPages/spotifyPlayList' }).then(function ({ error, result, response }) { console.log('error:', error); diff --git a/tests/integration/static.spec.ts b/tests/integration/static.spec.ts index 20ebebc..219ecb4 100644 --- a/tests/integration/static.spec.ts +++ b/tests/integration/static.spec.ts @@ -80,6 +80,7 @@ describe('static', function () { expect(response).to.be.an('Response'); }); }); + it('arstechnica', function () { return ogs({ url: 'https://jshemas.github.io/openGraphScraperPages/arstechnica' }) .then(function ({ error, result, response }) { @@ -133,6 +134,7 @@ describe('static', function () { expect(response).to.be.an('Response'); }); }); + it('battlefield', function () { return ogs({ url: 'https://jshemas.github.io/openGraphScraperPages/battlefield' }) .then(function ({ error, result, response }) { @@ -180,6 +182,7 @@ describe('static', function () { expect(response).to.be.an('Response'); }); }); + it('bestbuy', function () { return ogs({ url: 'https://jshemas.github.io/openGraphScraperPages/bestbuy' }) .then(function ({ error, result, response }) { @@ -229,6 +232,7 @@ describe('static', function () { expect(response).to.be.an('Response'); }); }); + it('bjango', function () { return ogs({ url: 'https://jshemas.github.io/openGraphScraperPages/bjango' }) .then(function ({ error, result, response }) { @@ -252,6 +256,7 @@ describe('static', function () { expect(response).to.be.an('Response'); }); }); + it('bloomberg', function () { return ogs({ url: 'https://jshemas.github.io/openGraphScraperPages/bloomberg' }) .then(function ({ error, result, response }) { @@ -312,6 +317,7 @@ describe('static', function () { expect(response).to.be.an('Response'); }); }); + it('businesstoday', function () { return ogs({ url: 'https://jshemas.github.io/openGraphScraperPages/businesstoday' }) .then(function ({ error, result, response }) { @@ -360,6 +366,7 @@ describe('static', function () { expect(response).to.be.an('Response'); }); }); + it('cbronline', function () { return ogs({ url: 'https://jshemas.github.io/openGraphScraperPages/cbronline' }) .then(function ({ error, result, response }) { @@ -418,6 +425,7 @@ describe('static', function () { expect(response).to.be.an('Response'); }); }); + it('cio', function () { return ogs({ url: 'https://jshemas.github.io/openGraphScraperPages/cio' }) .then(function ({ error, result, response }) { @@ -474,6 +482,7 @@ describe('static', function () { expect(response).to.be.an('Response'); }); }); + it('cloudpro', function () { return ogs({ url: 'https://jshemas.github.io/openGraphScraperPages/cloudpro' }) .then(function ({ error, result, response }) { @@ -526,6 +535,7 @@ describe('static', function () { expect(response).to.be.an('Response'); }); }); + it('cnet', function () { return ogs({ url: 'https://jshemas.github.io/openGraphScraperPages/cnet' }) .then(function ({ error, result, response }) { @@ -584,6 +594,7 @@ describe('static', function () { expect(response).to.be.an('Response'); }); }); + it('crn', function () { return ogs({ url: 'https://jshemas.github.io/openGraphScraperPages/crn' }) .then(function ({ error, result, response }) { @@ -622,6 +633,7 @@ describe('static', function () { expect(response).to.be.an('Response'); }); }); + it('computerworld', function () { return ogs({ url: 'https://jshemas.github.io/openGraphScraperPages/computerworld' }) .then(function ({ error, result, response }) { @@ -676,6 +688,7 @@ describe('static', function () { expect(response).to.be.an('Response'); }); }); + it('darkreading', function () { return ogs({ url: 'https://jshemas.github.io/openGraphScraperPages/darkreading' }) .then(function ({ error, result, response }) { @@ -724,6 +737,7 @@ describe('static', function () { expect(response).to.be.an('Response'); }); }); + it('discourse', function () { return ogs({ url: 'https://jshemas.github.io/openGraphScraperPages/discourse' }) .then(function ({ error, result, response }) { @@ -770,6 +784,7 @@ describe('static', function () { expect(response).to.be.an('Response'); }); }); + it('docs', function () { return ogs({ url: 'https://jshemas.github.io/openGraphScraperPages/docs' }) .then(function ({ error, result, response }) { @@ -804,6 +819,7 @@ describe('static', function () { expect(response).to.be.an('Response'); }); }); + it('ebay', function () { return ogs({ url: 'https://jshemas.github.io/openGraphScraperPages/ebay' }) .then(function ({ error, result, response }) { @@ -852,6 +868,7 @@ describe('static', function () { expect(response).to.be.an('Response'); }); }); + it('economictimes', function () { return ogs({ url: 'https://jshemas.github.io/openGraphScraperPages/economictimes' }) .then(function ({ error, result, response }) { @@ -930,6 +947,7 @@ describe('static', function () { expect(response).to.be.an('Response'); }); }); + it('entrepreneur', function () { return ogs({ url: 'https://jshemas.github.io/openGraphScraperPages/entrepreneur' }) .then(function ({ error, result, response }) { @@ -994,6 +1012,7 @@ describe('static', function () { expect(response).to.be.an('Response'); }); }); + it('etsy', function () { return ogs({ url: 'https://jshemas.github.io/openGraphScraperPages/etsy' }) .then(function ({ error, result, response }) { @@ -1072,6 +1091,7 @@ describe('static', function () { expect(response).to.be.an('Response'); }); }); + it('facebook', function () { return ogs({ url: 'https://jshemas.github.io/openGraphScraperPages/facebook' }) .then(function ({ error, result, response }) { @@ -1106,6 +1126,7 @@ describe('static', function () { expect(response).to.be.an('Response'); }); }); + it('fastcompany', function () { return ogs({ url: 'https://jshemas.github.io/openGraphScraperPages/fastcompany' }) .then(function ({ error, result, response }) { @@ -1177,6 +1198,7 @@ describe('static', function () { expect(response).to.be.an('Response'); }); }); + it('forbes', function () { return ogs({ url: 'https://jshemas.github.io/openGraphScraperPages/forbes' }) .then(function ({ error, result, response }) { @@ -1234,6 +1256,7 @@ describe('static', function () { expect(response).to.be.an('Response'); }); }); + it('fortune', function () { return ogs({ url: 'https://jshemas.github.io/openGraphScraperPages/fortune' }) .then(function ({ error, result, response }) { @@ -1284,6 +1307,7 @@ describe('static', function () { expect(response).to.be.an('Response'); }); }); + it('foursquare', function () { return ogs({ url: 'https://jshemas.github.io/openGraphScraperPages/foursquare' }) .then(function ({ error, result, response }) { @@ -1389,6 +1413,7 @@ describe('static', function () { expect(response).to.be.an('Response'); }); }); + it('geektime', function () { return ogs({ url: 'https://jshemas.github.io/openGraphScraperPages/geektime' }) .then(function ({ error, result, response }) { @@ -1451,6 +1476,7 @@ describe('static', function () { expect(response).to.be.an('Response'); }); }); + it('inc', function () { return ogs({ url: 'https://jshemas.github.io/openGraphScraperPages/inc' }) .then(function ({ error, result, response }) { @@ -1507,6 +1533,7 @@ describe('static', function () { expect(response).to.be.an('Response'); }); }); + it('insta', function () { return ogs({ url: 'https://jshemas.github.io/openGraphScraperPages/insta' }) .then(function ({ error, result, response }) { @@ -1554,6 +1581,7 @@ describe('static', function () { expect(response).to.be.an('Response'); }); }); + it('itunes', function () { return ogs({ url: 'https://jshemas.github.io/openGraphScraperPages/itunes' }) .then(function ({ error, result, response }) { @@ -1602,6 +1630,7 @@ describe('static', function () { expect(response).to.be.an('Response'); }); }); + it('jewishbusinessnews', function () { return ogs({ url: 'https://jshemas.github.io/openGraphScraperPages/jewishbusinessnews' }) .then(function ({ error, result, response }) { @@ -1673,6 +1702,7 @@ describe('static', function () { expect(response).to.be.an('Response'); }); }); + it('kickstarter', function () { return ogs({ url: 'https://jshemas.github.io/openGraphScraperPages/kickstarter' }) .then(function ({ error, result, response }) { @@ -1735,6 +1765,7 @@ describe('static', function () { expect(response).to.be.an('Response'); }); }); + it('latimes', function () { return ogs({ url: 'https://jshemas.github.io/openGraphScraperPages/latimes' }) .then(function ({ error, result, response }) { @@ -1793,6 +1824,7 @@ describe('static', function () { expect(response).to.be.an('Response'); }); }); + it('leandata', function () { return ogs({ url: 'https://jshemas.github.io/openGraphScraperPages/leandata' }) .then(function ({ error, result, response }) { @@ -1838,6 +1870,7 @@ describe('static', function () { expect(response).to.be.an('Response'); }); }); + it('learnxinyminutes', function () { return ogs({ url: 'https://jshemas.github.io/openGraphScraperPages/learnxinyminutes' }) .then(function ({ error, result, response }) { @@ -1866,6 +1899,7 @@ describe('static', function () { expect(response).to.be.an('Response'); }); }); + it('lifehacker', function () { return ogs({ url: 'https://jshemas.github.io/openGraphScraperPages/lifehacker' }) .then(function ({ error, result, response }) { @@ -1912,6 +1946,7 @@ describe('static', function () { expect(response).to.be.an('Response'); }); }); + it('macrumors', function () { return ogs({ url: 'https://jshemas.github.io/openGraphScraperPages/macrumors' }) .then(function ({ error, result, response }) { @@ -1968,6 +2003,7 @@ describe('static', function () { expect(response).to.be.an('Response'); }); }); + it('mashable', function () { return ogs({ url: 'https://jshemas.github.io/openGraphScraperPages/mashable' }) .then(function ({ error, result, response }) { @@ -2030,6 +2066,7 @@ describe('static', function () { expect(response).to.be.an('Response'); }); }); + it('medium', function () { return ogs({ url: 'https://jshemas.github.io/openGraphScraperPages/medium' }) .then(function ({ error, result, response }) { @@ -2104,6 +2141,7 @@ describe('static', function () { expect(response).to.be.an('Response'); }); }); + it('michaelkors', function () { return ogs({ url: 'https://jshemas.github.io/openGraphScraperPages/michaelkors' }).then(function ({ error, result, response }) { console.log('error:', error); @@ -2148,6 +2186,7 @@ describe('static', function () { expect(response).to.be.an('Response'); }); }); + it('mulesoft', function () { return ogs({ url: 'https://jshemas.github.io/openGraphScraperPages/mulesoft' }) .then(function ({ error, result, response }) { @@ -2179,6 +2218,7 @@ describe('static', function () { expect(response).to.be.an('Response'); }); }); + it('newegg', function () { return ogs({ url: 'https://jshemas.github.io/openGraphScraperPages/newegg' }) .then(function ({ error, result, response }) { @@ -2249,6 +2289,7 @@ describe('static', function () { expect(response).to.be.an('Response'); }); }); + it('npm', function () { return ogs({ url: 'https://jshemas.github.io/openGraphScraperPages/npm' }) .then(function ({ error, result, response }) { @@ -2291,6 +2332,7 @@ describe('static', function () { expect(response).to.be.an('Response'); }); }); + it('prnewswire', function () { return ogs({ url: 'https://jshemas.github.io/openGraphScraperPages/prnewswire' }) .then(function ({ error, result, response }) { @@ -2341,6 +2383,7 @@ describe('static', function () { expect(response).to.be.an('Response'); }); }); + it('reddit', function () { return ogs({ url: 'https://jshemas.github.io/openGraphScraperPages/reddit' }) .then(function ({ error, result, response }) { @@ -2383,6 +2426,7 @@ describe('static', function () { expect(response).to.be.an('Response'); }); }); + it('reuters', function () { return ogs({ url: 'https://jshemas.github.io/openGraphScraperPages/reuters' }) .then(function ({ error, result, response }) { @@ -2446,6 +2490,7 @@ describe('static', function () { expect(response).to.be.an('Response'); }); }); + it('rottentomatoes', function () { return ogs({ url: 'https://jshemas.github.io/openGraphScraperPages/rottentomatoes' }) .then(function ({ error, result, response }) { @@ -2524,6 +2569,7 @@ describe('static', function () { expect(response).to.be.an('Response'); }); }); + it('smile', function () { return ogs({ url: 'https://jshemas.github.io/openGraphScraperPages/smile' }) .then(function ({ error, result, response }) { @@ -2591,6 +2637,7 @@ describe('static', function () { expect(response).to.be.an('Response'); }); }); + it('techcrunch', function () { return ogs({ url: 'https://jshemas.github.io/openGraphScraperPages/techcrunch' }) .then(function ({ error, result, response }) { @@ -2645,6 +2692,7 @@ describe('static', function () { expect(response).to.be.an('Response'); }); }); + it('ted', function () { return ogs({ url: 'https://jshemas.github.io/openGraphScraperPages/ted' }) .then(function ({ error, result, response }) { @@ -2719,6 +2767,7 @@ describe('static', function () { expect(response).to.be.an('Response'); }); }); + it('thinkgeek', function () { return ogs({ url: 'https://jshemas.github.io/openGraphScraperPages/thinkgeek' }) .then(function ({ error, result, response }) { @@ -2777,6 +2826,7 @@ describe('static', function () { expect(response).to.be.an('Response'); }); }); + it('vox', function () { return ogs({ url: 'https://jshemas.github.io/openGraphScraperPages/vox' }) .then(function ({ error, result, response }) { @@ -2840,6 +2890,7 @@ describe('static', function () { expect(response).to.be.an('Response'); }); }); + it('w3', function () { return ogs({ url: 'https://jshemas.github.io/openGraphScraperPages/w3' }) .then(function ({ error, result, response }) { @@ -2870,6 +2921,7 @@ describe('static', function () { expect(response).to.be.an('Response'); }); }); + it('xkcd', function () { return ogs({ url: 'https://jshemas.github.io/openGraphScraperPages/xkcd' }) .then(function ({ error, result, response }) { diff --git a/tests/integration/url.spec.ts b/tests/integration/url.spec.ts index 67c0ecb..3c0ec34 100644 --- a/tests/integration/url.spec.ts +++ b/tests/integration/url.spec.ts @@ -29,6 +29,7 @@ describe('url', function () { expect(response).to.be.an('Response'); }); }); + it('https', function () { return ogs({ url: 'https://www.wikipedia.org/' }).then(function ({ error, result, response }) { console.log('error:', error); @@ -55,6 +56,7 @@ describe('url', function () { expect(response).to.be.an('Response'); }); }); + it('no protocol', function () { return ogs({ url: 'www.wikipedia.org/' }).then(function ({ error, result, response }) { console.log('error:', error); @@ -81,6 +83,7 @@ describe('url', function () { expect(response).to.be.an('Response'); }); }); + it('no protocol and no wwww', function () { return ogs({ url: 'wikipedia.org/' }).then(function ({ error, result, response }) { console.log('error:', error); @@ -107,6 +110,7 @@ describe('url', function () { expect(response).to.be.an('Response'); }); }); + it('protocol with no wwww', function () { return ogs({ url: 'http://wikipedia.org/' }).then(function ({ error, result, response }) { console.log('error:', error); @@ -133,6 +137,7 @@ describe('url', function () { expect(response).to.be.an('Response'); }); }); + it('fake page', function () { return ogs({ url: 'http://testtesttest4564568.com' }) .then(function () { @@ -155,6 +160,7 @@ describe('url', function () { expect(response).to.eql(undefined); }); }); + it('empty url', function () { return ogs({ url: '' }) .then(function () { @@ -177,6 +183,7 @@ describe('url', function () { expect(response).to.eql(undefined); }); }); + it('empty options', function () { return ogs({}) .then(function () { @@ -199,6 +206,7 @@ describe('url', function () { expect(response).to.eql(undefined); }); }); + it('url is a string of numbers', function () { return ogs({ url: '2323233' }) .then(function () { @@ -221,6 +229,7 @@ describe('url', function () { expect(response).to.eql(undefined); }); }); + it('url is a string of words', function () { return ogs({ url: 'this is a test' }) .then(function () { @@ -243,6 +252,7 @@ describe('url', function () { expect(response).to.eql(undefined); }); }); + it('url is invalid because user disallows https with urlValidatorSettings', function () { return ogs({ url: 'https://www.wikipedia.org/', @@ -281,6 +291,7 @@ describe('url', function () { expect(response).to.eql(undefined); }); }); + it('url is to a pdf', function () { return ogs({ url: 'test.pdf?123' }) .then(function () { diff --git a/tests/integration/video.spec.ts b/tests/integration/video.spec.ts index befd23a..ad26b15 100644 --- a/tests/integration/video.spec.ts +++ b/tests/integration/video.spec.ts @@ -101,6 +101,7 @@ describe('video', function () { expect(response).to.be.an('Response'); }); }); + it('Test Twitch.tv Video - Should Return correct Open Graph Info', function () { return ogs({ url: 'https://jshemas.github.io/openGraphScraperPages/twitch.html' }).then(function ({ error, result, response }) { console.log('error:', error); diff --git a/tests/unit/media.spec.ts b/tests/unit/media.spec.ts index aa9c136..7de9871 100644 --- a/tests/unit/media.spec.ts +++ b/tests/unit/media.spec.ts @@ -29,6 +29,7 @@ describe('media', function () { alt: 'image/png', }]); }); + it('has twitter images but falls back to twitterImageSrc', function () { const ogMedia = mediaSetup({ twitterImageSrc: ['http://test.com/logoTwo.png'], @@ -44,6 +45,7 @@ describe('media', function () { alt: 'image/png', }]); }); + it('has image/twitterImage but no type/height/width', function () { const ogMedia = mediaSetup({ ogImageProperty: ['http://test.com/logo.png'], @@ -58,6 +60,7 @@ describe('media', function () { url: 'http://test.com/logo.png', }]); }); + it('has images and twitter images without property', function () { const ogMedia = mediaSetup({ ogImageType: ['image/png'], @@ -70,6 +73,7 @@ describe('media', function () { expect(ogMedia).to.eql({}); }); + it('has image with ogImageSecureURL/ogImageURL/ogImageProperty', function () { const ogMedia = mediaSetup({ ogImageSecureURL: ['https://test.com/logo.png'], @@ -87,6 +91,7 @@ describe('media', function () { type: 'image/png', }]); }); + it('has image with ogImageURL/ogImageProperty', function () { const ogMedia = mediaSetup({ ogImageURL: ['http://test.com/logoTwo.png'], @@ -103,6 +108,7 @@ describe('media', function () { type: 'image/png', }]); }); + it('has image with ogImageURL', function () { const ogMedia = mediaSetup({ ogImageURL: ['http://test.com/logoTwo.png'], @@ -118,6 +124,7 @@ describe('media', function () { type: 'image/png', }]); }); + it('has many images and twitter images', function () { const ogMedia = mediaSetup({ ogImageProperty: ['http://test.com/logo_one.png', 'http://test.com/logo_two.png', 'http://test.com/logo_three.png', ''], @@ -156,6 +163,7 @@ describe('media', function () { alt: 'image/png', }]); }); + it('has a .gif images and twitter images', function () { const ogMedia = mediaSetup({ ogImageProperty: ['http://test.com/logo_one.png', 'http://test.com/logo_two.gif'], @@ -192,6 +200,7 @@ describe('media', function () { height: '600', }]); }); + it('has no image or video', function () { const ogMedia = mediaSetup({ ogTitle: 'test site', @@ -205,6 +214,7 @@ describe('media', function () { expect(ogMedia.ogVideo).to.eql(undefined); expect(ogMedia.twitterPlayer).to.eql(undefined); }); + it('has video and twitter video', function () { const ogMedia = mediaSetup({ ogVideoProperty: ['http://test.com/logo.png'], @@ -231,6 +241,7 @@ describe('media', function () { stream: 'image/png', }]); }); + it('has video/twitterVideo but no type/width/height', function () { const ogMedia = mediaSetup({ ogVideoProperty: ['http://test.com/logo.png'], @@ -245,6 +256,7 @@ describe('media', function () { url: 'http://test.com/logo.png', }]); }); + it('has video and twitter video but with no property', function () { const ogMedia = mediaSetup({ ogVideoType: ['image/png'], @@ -257,6 +269,7 @@ describe('media', function () { expect(ogMedia).to.eql({}); }); + it('has music:song', function () { const ogMedia = mediaSetup({ musicSongProperty: ['http://test.com/songurl'], @@ -270,6 +283,7 @@ describe('media', function () { disc: '1', }]); }); + it('has music:song but falls back to musicSongUrl', function () { const ogMedia = mediaSetup({ musicSongUrl: ['http://test.com/songurlTwo'], @@ -283,6 +297,7 @@ describe('media', function () { disc: '1', }]); }); + it('has music:song but no track/disc', function () { const ogMedia = mediaSetup({ musicSongProperty: ['http://test.com/songurl'], @@ -292,6 +307,7 @@ describe('media', function () { url: 'http://test.com/songurl', }]); }); + it('has multiple music:songs', function () { const ogMedia = mediaSetup({ musicSongProperty: ['http://test.com/songurl', 'http://test.com/songurl3', 'http://test.com/songurl2', ''], @@ -315,6 +331,7 @@ describe('media', function () { disc: '2', }]); }); + it('has ogImageProperty/twitterImage/ogVideo/twitterPlayer', function () { const ogMedia = mediaSetup({ ogImageProperty: ['http://test.com/logo.png'], @@ -363,6 +380,7 @@ describe('media', function () { stream: 'image/png', }]); }); + it('has more then 10 images', function () { const ogMedia = mediaSetup({ ogImageProperty: ['http://test.com/logo1.png', 'http://test.com/logo2.png', 'http://test.com/logo3.png', 'http://test.com/logo4.png', 'http://test.com/logo5.png', 'http://test.com/logo6.png', 'http://test.com/logo7.png', 'http://test.com/logo8.png', 'http://test.com/logo9.png', 'http://test.com/logo10.png', 'http://test.com/logo11.png'], diff --git a/tests/unit/utils.spec.ts b/tests/unit/utils.spec.ts index a7ec8ef..8c9e79b 100644 --- a/tests/unit/utils.spec.ts +++ b/tests/unit/utils.spec.ts @@ -162,18 +162,22 @@ describe('utils', function () { const type = findImageTypeFromUrl('foobar.com/image.png?test=true'); expect(type).to.eql('png'); }); + it('foobar.com/image.png', function () { const type = findImageTypeFromUrl('foobar.com/image.png'); expect(type).to.eql('png'); }); + it('image.png', function () { const type = findImageTypeFromUrl('image.png'); expect(type).to.eql('png'); }); + it('image', function () { const type = findImageTypeFromUrl('image'); expect(type).to.eql('image'); }); + it('empty string', function () { const type = findImageTypeFromUrl(''); expect(type).to.eql(''); @@ -185,6 +189,7 @@ describe('utils', function () { const valid = isImageTypeValid('png'); expect(valid).to.eql(true); }); + it('when type is foo', function () { const valid = isImageTypeValid('foo'); expect(valid).to.eql(false); @@ -196,18 +201,22 @@ describe('utils', function () { const valid = isThisANonHTMLUrl('www.foo.com/bar.png'); expect(valid).to.eql(true); }); + it('when url is type .html', function () { const valid = isThisANonHTMLUrl('www.foo.com/bar.html'); expect(valid).to.eql(false); }); + it('when url is type .pdf and has params', function () { const valid = isThisANonHTMLUrl('www.foo.com/bar.pdf?123'); expect(valid).to.eql(true); }); + it('when domain in url contains a non HTML string (.txt)', function () { const valid = isThisANonHTMLUrl('www.txt.com/bar.html'); expect(valid).to.eql(false); }); + it('when domain in url contains a non HTML string (.mov) no extension on path', function () { const valid = isThisANonHTMLUrl('www.mov.com/bar'); expect(valid).to.eql(false); @@ -219,10 +228,12 @@ describe('utils', function () { const object = removeNestedUndefinedValues({ one: 1 }); expect(object).to.eql({ one: 1 }); }); + it('when there is undef values', function () { const object = removeNestedUndefinedValues({ one: 1, two: undefined }); expect(object).to.eql({ one: 1 }); }); + it('when there is a nested undef value', function () { const object = removeNestedUndefinedValues({ one: 1, two: { three: undefined } }); expect(object).to.eql({ one: 1, two: {} }); @@ -234,6 +245,7 @@ describe('utils', function () { const { options } = optionSetup({}); expect(options).to.eql({ onlyGetOpenGraphInfo: false }); }); + it('when passing onlyGetOpenGraphInfo into optionSetup', function () { const { options } = optionSetup({ onlyGetOpenGraphInfo: true }); expect(options).to.eql({ onlyGetOpenGraphInfo: true }); @@ -249,10 +261,12 @@ describe('utils', function () { }]); expect(response).to.eql(true); }); + it('when passing a enpty array into isCustomMetaTagsValid', function () { const response = isCustomMetaTagsValid([]); expect(response).to.eql(true); }); + it('when passing a custom tag missing property into isCustomMetaTagsValid', function () { // @ts-ignore const response = isCustomMetaTagsValid([{ @@ -261,6 +275,7 @@ describe('utils', function () { }]); expect(response).to.eql(false); }); + it('when passing a custom tag invalid property into isCustomMetaTagsValid', function () { const response = isCustomMetaTagsValid([{ multiple: false, @@ -270,6 +285,7 @@ describe('utils', function () { }]); expect(response).to.eql(false); }); + it('when passing a valid and invalid custom tag into isCustomMetaTagsValid', function () { // @ts-ignore const response = isCustomMetaTagsValid([{ @@ -282,6 +298,7 @@ describe('utils', function () { }]); expect(response).to.eql(false); }); + it('when passing a invalid array into isCustomMetaTagsValid', function () { // @ts-ignore const response = isCustomMetaTagsValid(['foo', 'bar']); From ba83cf704734486ddf107245c4f31fe4c064e7aa Mon Sep 17 00:00:00 2001 From: jshemas Date: Sun, 3 Mar 2024 00:09:55 -0500 Subject: [PATCH 4/9] adding twitterAccount and fbAppId support --- dist/lib/fields.js | 10 ++++++ dist/lib/types.d.ts | 2 ++ lib/fields.ts | 10 ++++++ lib/types.ts | 2 ++ tests/integration/basic.spec.ts | 13 ++++++- tests/integration/encoding.spec.ts | 6 ++++ tests/integration/image.spec.ts | 2 ++ tests/integration/redirect.spec.ts | 2 ++ tests/integration/spotify.spec.ts | 8 +++++ tests/integration/static.spec.ts | 54 ++++++++++++++++++++++++++++++ tests/integration/twitter.spec.ts | 2 ++ tests/integration/video.spec.ts | 4 +++ 12 files changed, 114 insertions(+), 1 deletion(-) diff --git a/dist/lib/fields.js b/dist/lib/fields.js index 576b687..599c8f6 100644 --- a/dist/lib/fields.js +++ b/dist/lib/fields.js @@ -277,6 +277,11 @@ const fields = [ property: 'twitter:creator:id', fieldName: 'twitterCreatorId', }, + { + multiple: false, + property: 'twitter:account', + fieldName: 'twitterAccount', + }, { multiple: false, property: 'twitter:title', @@ -932,5 +937,10 @@ const fields = [ property: 'al:web:should_fallback', fieldName: 'alWebShouldFallback', }, + { + multiple: false, + property: 'fb:app_id', + fieldName: 'fbAppId', + }, ]; exports.default = fields; diff --git a/dist/lib/types.d.ts b/dist/lib/types.d.ts index 3b67bda..12cdb12 100644 --- a/dist/lib/types.d.ts +++ b/dist/lib/types.d.ts @@ -160,6 +160,7 @@ export type OgObjectInteral = { error?: string; errorDetails?: Error; favicon?: string; + fbAppId?: string; modifiedTime?: string; musicAlbum?: string; musicAlbumDisc?: string; @@ -256,6 +257,7 @@ export type OgObjectInteral = { restaurantVariationPriceAmount?: string; restaurantVariationPriceCurrency?: string; success?: boolean; + twitterAccount?: string; twitterAppIdGooglePlay?: string; twitterAppIdiPad?: string; twitterAppIdiPhone?: string; diff --git a/lib/fields.ts b/lib/fields.ts index 068cb7d..a50cb92 100644 --- a/lib/fields.ts +++ b/lib/fields.ts @@ -275,6 +275,11 @@ const fields = [ property: 'twitter:creator:id', fieldName: 'twitterCreatorId', }, + { + multiple: false, + property: 'twitter:account', + fieldName: 'twitterAccount', + }, { multiple: false, property: 'twitter:title', @@ -930,6 +935,11 @@ const fields = [ property: 'al:web:should_fallback', fieldName: 'alWebShouldFallback', }, + { + multiple: false, + property: 'fb:app_id', + fieldName: 'fbAppId', + }, ]; export default fields; diff --git a/lib/types.ts b/lib/types.ts index 5e5266f..0b8f606 100644 --- a/lib/types.ts +++ b/lib/types.ts @@ -168,6 +168,7 @@ export type OgObjectInteral = { error?: string; errorDetails?: Error; favicon?: string; + fbAppId?: string; modifiedTime?: string; musicAlbum?: string; musicAlbumDisc?: string; @@ -264,6 +265,7 @@ export type OgObjectInteral = { restaurantVariationPriceAmount?: string; restaurantVariationPriceCurrency?: string; success?: boolean; + twitterAccount?: string; twitterAppIdGooglePlay?: string; twitterAppIdiPad?: string; twitterAppIdiPhone?: string; diff --git a/tests/integration/basic.spec.ts b/tests/integration/basic.spec.ts index c13153e..becbf84 100644 --- a/tests/integration/basic.spec.ts +++ b/tests/integration/basic.spec.ts @@ -34,6 +34,7 @@ describe('basic', function () { }]); expect(result.requestUrl).to.be.eql('https://ogp.me/'); expect(result.charset).to.be.eql('utf-8'); + expect(result.fbAppId).to.be.eql('115190258555800'); expect(result.success).to.be.eql(true); expect(result).to.have.all.keys( 'ogTitle', @@ -43,6 +44,7 @@ describe('basic', function () { 'ogImage', 'requestUrl', 'charset', + 'fbAppId', 'success', ); expect(response).to.be.an('Response'); @@ -67,11 +69,13 @@ describe('basic', function () { }]); expect(result.requestUrl).to.be.eql('https://ogp.me/'); expect(result.charset).to.be.eql('utf-8'); + expect(result.fbAppId).to.be.eql('115190258555800'); expect(result.success).to.be.eql(true); expect(result).to.have.all.keys( 'ogTitle', 'ogType', 'ogUrl', + 'fbAppId', 'ogDescription', 'ogImage', 'requestUrl', @@ -102,8 +106,9 @@ describe('basic', function () { }]); expect(response.result.requestUrl).to.be.eql('https://ogp.me/'); expect(response.result.charset).to.be.eql('utf-8'); + expect(response.result.fbAppId).to.be.eql('115190258555800'); expect(response.result.success).to.be.eql(true); - expect(response.result).to.have.all.keys('ogTitle', 'ogType', 'ogUrl', 'ogDescription', 'ogImage', 'requestUrl', 'charset', 'success'); + expect(response.result).to.have.all.keys('ogTitle', 'ogType', 'ogUrl', 'ogDescription', 'ogImage', 'requestUrl', 'charset', 'fbAppId', 'success'); expect(response.response).to.be.an('Response'); }); }); @@ -126,9 +131,11 @@ describe('basic', function () { }]); expect(result.requestUrl).to.be.eql('https://ogp.me/'); expect(result.charset).to.be.eql('utf-8'); + expect(result.fbAppId).to.be.eql('115190258555800'); expect(result.success).to.be.eql(true); expect(result).to.have.all.keys( 'ogTitle', + 'fbAppId', 'ogType', 'ogUrl', 'ogDescription', @@ -190,10 +197,12 @@ describe('basic', function () { expect(result.favicon).to.be.eql('https://github.githubassets.com/favicons/favicon.svg'); expect(result.charset).to.be.eql('utf-8'); expect(result.requestUrl).to.be.eql('https://github.com/jshemas/openGraphScraper/blob/master/README.md'); + expect(result.fbAppId).to.be.eql('1401488693436528'); expect(result.success).to.be.eql(true); expect(result).to.have.all.keys( 'charset', 'favicon', + 'fbAppId', 'ogDescription', 'ogImage', 'ogLocale', @@ -267,10 +276,12 @@ describe('basic', function () { // height: '720', // }]); expect(result.requestUrl).to.be.eql('https://vimeo.com/232889838'); + expect(result.fbAppId).to.be.eql('19884028963'); expect(result.charset).to.be.eql('utf-8'); expect(result.success).to.be.eql(true); expect(result).to.have.all.keys( 'favicon', + 'fbAppId', 'alAndroidAppName', 'alAndroidPackage', 'alAndroidUrl', diff --git a/tests/integration/encoding.spec.ts b/tests/integration/encoding.spec.ts index f8225e9..912bbf8 100644 --- a/tests/integration/encoding.spec.ts +++ b/tests/integration/encoding.spec.ts @@ -30,6 +30,7 @@ describe('encoding', function () { url: 'https://r.r10s.jp/com/img/home/top/ogp.png', }]); expect(result.requestUrl).to.be.eql('https://jshemas.github.io/openGraphScraperPages/rakuten'); + expect(result.fbAppId).to.be.eql('194149240717705'); expect(result.charset).to.be.eql('euc-jp'); expect(result.success).to.be.eql(true); expect(result).to.have.all.keys( @@ -37,6 +38,7 @@ describe('encoding', function () { 'ogDescription', 'ogImage', 'ogSiteName', + 'fbAppId', 'ogTitle', 'ogType', 'ogLocale', @@ -117,9 +119,11 @@ describe('encoding', function () { }]); expect(result.charset).to.be.eql('utf-8'); expect(result.requestUrl).to.be.eql('https://jshemas.github.io/openGraphScraperPages/aliexpress'); + expect(result.fbAppId).to.be.eql('176044105761845'); expect(result.success).to.be.eql(true); expect(result).to.have.all.keys( 'favicon', + 'fbAppId', 'alAndroidAppName', 'alAndroidPackage', 'alAndroidUrl', @@ -299,8 +303,10 @@ describe('encoding', function () { expect(result.charset).to.be.eql('UTF-8'); expect(result.requestUrl).to.be.eql('https://jshemas.github.io/openGraphScraperPages/okezone'); expect(result.success).to.be.eql(true); + expect(result.fbAppId).to.be.eql('213195442194472'); expect(result).to.have.all.keys( 'favicon', + 'fbAppId', 'articleAuthor', 'articlePublishedTime', 'articlePublisher', diff --git a/tests/integration/image.spec.ts b/tests/integration/image.spec.ts index c90f6f8..b9b56cd 100644 --- a/tests/integration/image.spec.ts +++ b/tests/integration/image.spec.ts @@ -32,9 +32,11 @@ describe('image', function () { }]); expect(result.requestUrl).to.be.eql('https://jshemas.github.io/openGraphScraperPages/flickr'); expect(result.charset).to.be.eql('UTF-8'); + expect(result.fbAppId).to.be.eql('137206539707334'); expect(result.success).to.be.eql(true); expect(result).to.have.all.keys( 'favicon', + 'fbAppId', 'alIosAppName', 'alIosAppStoreId', 'alIosUrl', diff --git a/tests/integration/redirect.spec.ts b/tests/integration/redirect.spec.ts index e7d1664..922a5bd 100644 --- a/tests/integration/redirect.spec.ts +++ b/tests/integration/redirect.spec.ts @@ -122,9 +122,11 @@ describe('redirect', function () { }]); expect(result.requestUrl).to.be.eql('https://www.forbes.com/sites/kenkam/2017/09/28/3-stocks-like-apple-was-10-years-ago-tesla-nvidia-and-alibaba/#2636f6c2f0fa'); expect(result.charset).to.be.eql('utf-8'); + expect(result.fbAppId).to.be.eql('123694841080850'); expect(result.success).to.be.eql(true); expect(result).to.have.all.keys( 'favicon', + 'fbAppId', 'ogDate', 'articleAuthor', 'articleSection', diff --git a/tests/integration/spotify.spec.ts b/tests/integration/spotify.spec.ts index 8be48fd..5556477 100644 --- a/tests/integration/spotify.spec.ts +++ b/tests/integration/spotify.spec.ts @@ -69,9 +69,11 @@ describe('spotify', function () { }]); expect(result.requestUrl).to.be.eql('https://open.spotify.com/album/5EBGCvO6upi3GNknMVe9x9'); expect(result.charset).to.be.eql('utf-8'); + expect(result.fbAppId).to.be.eql('174829003346'); expect(result.success).to.be.eql(true); expect(result).to.have.all.keys( 'favicon', + 'fbAppId', 'alAndroidAppName', 'alAndroidPackage', 'alAndroidUrl', @@ -131,9 +133,11 @@ describe('spotify', function () { }]); expect(result.requestUrl).to.be.eql('https://open.spotify.com/artist/5K4W6rqBFWDnAN6FQUkS6x'); expect(result.charset).to.be.eql('utf-8'); + expect(result.fbAppId).to.be.eql('174829003346'); expect(result.success).to.be.eql(true); expect(result).to.have.all.keys( 'favicon', + 'fbAppId', 'alAndroidAppName', 'alAndroidPackage', 'alAndroidUrl', @@ -197,9 +201,11 @@ describe('spotify', function () { }]); expect(result.requestUrl).to.be.eql('https://open.spotify.com/track/3p6fkbeZDIVqapfdgQe6fm'); expect(result.charset).to.be.eql('utf-8'); + expect(result.fbAppId).to.be.eql('174829003346'); expect(result.success).to.be.eql(true); expect(result).to.have.all.keys( 'favicon', + 'fbAppId', 'alAndroidAppName', 'alAndroidPackage', 'alAndroidUrl', @@ -310,9 +316,11 @@ describe('spotify', function () { }]); expect(result.requestUrl).to.be.eql('https://jshemas.github.io/openGraphScraperPages/spotifyPlayList'); expect(result.charset).to.be.eql('UTF-8'); + expect(result.fbAppId).to.be.eql('174829003346'); expect(result.success).to.be.eql(true); expect(result).to.have.all.keys( 'favicon', + 'fbAppId', 'alAndroidAppName', 'alAndroidPackage', 'alAndroidUrl', diff --git a/tests/integration/static.spec.ts b/tests/integration/static.spec.ts index 219ecb4..79911ff 100644 --- a/tests/integration/static.spec.ts +++ b/tests/integration/static.spec.ts @@ -42,9 +42,11 @@ describe('static', function () { expect(result.twitterImage).to.be.eql([{ url: 'https://a1.muscache.com/im/pictures/43670185/606e6e19_original.jpg?aki_policy=x_large' }]); expect(result.requestUrl).to.be.eql('https://jshemas.github.io/openGraphScraperPages/airbnb'); expect(result.charset).to.be.eql('utf-8'); + expect(result.fbAppId).to.be.eql('138566025676'); expect(result.success).to.be.eql(true); expect(result).to.have.all.keys( 'favicon', + 'fbAppId', 'alAndroidAppName', 'alAndroidPackage', 'alAndroidUrl', @@ -344,9 +346,11 @@ describe('static', function () { expect(result.ogDescription).to.be.eql("Madhu Kapur in her suit had sought various reliefs including recognition of the family's right to participate in the management of the bank"); expect(result.requestUrl).to.be.eql('https://jshemas.github.io/openGraphScraperPages/businesstoday'); expect(result.charset).to.be.eql('ISO-8859-1'); + expect(result.fbAppId).to.be.eql('23230437118'); expect(result.success).to.be.eql(true); expect(result).to.have.all.keys( 'favicon', + 'fbAppId', 'ogDate', 'ogDescription', 'ogImage', @@ -399,9 +403,11 @@ describe('static', function () { }]); expect(result.requestUrl).to.be.eql('https://jshemas.github.io/openGraphScraperPages/cbronline'); expect(result.charset).to.be.eql('UTF-8'); + expect(result.fbAppId).to.be.eql('1880004222235592'); expect(result.success).to.be.eql(true); expect(result).to.have.all.keys( 'favicon', + 'fbAppId', 'articleModifiedTime', 'articlePublishedTime', 'articleSection', @@ -457,9 +463,11 @@ describe('static', function () { }]); expect(result.requestUrl).to.be.eql('https://jshemas.github.io/openGraphScraperPages/cio'); expect(result.charset).to.be.eql('UTF-8'); + expect(result.fbAppId).to.be.eql('196366870381968'); expect(result.success).to.be.eql(true); expect(result).to.have.all.keys( 'favicon', + 'fbAppId', 'author', 'ogDate', 'dcDateIssued', @@ -567,9 +575,11 @@ describe('static', function () { }]); expect(result.requestUrl).to.be.eql('https://jshemas.github.io/openGraphScraperPages/cnet'); expect(result.charset).to.be.eql('utf-8'); + expect(result.fbAppId).to.be.eql('16995676698'); expect(result.success).to.be.eql(true); expect(result).to.have.all.keys( 'favicon', + 'fbAppId', 'author', 'ogDescription', 'articlePublisher', @@ -664,9 +674,11 @@ describe('static', function () { }]); expect(result.requestUrl).to.be.eql('https://jshemas.github.io/openGraphScraperPages/computerworld'); expect(result.charset).to.be.eql('UTF-8'); + expect(result.fbAppId).to.be.eql('123026274413041'); expect(result.success).to.be.eql(true); expect(result).to.have.all.keys( 'favicon', + 'fbAppId', 'ogDate', 'author', 'dcDateIssued', @@ -715,9 +727,11 @@ describe('static', function () { }]); expect(result.requestUrl).to.be.eql('https://jshemas.github.io/openGraphScraperPages/darkreading'); expect(result.charset).to.be.eql('iso-8859-1'); + expect(result.fbAppId).to.be.eql('640989409269461'); expect(result.success).to.be.eql(true); expect(result).to.have.all.keys( 'favicon', + 'fbAppId', 'ogDescription', 'ogImage', 'ogSiteName', @@ -846,9 +860,11 @@ describe('static', function () { }]); expect(result.requestUrl).to.be.eql('https://jshemas.github.io/openGraphScraperPages/ebay'); expect(result.charset).to.be.eql('UTF-8'); + expect(result.fbAppId).to.be.eql('102628213125203'); expect(result.success).to.be.eql(true); expect(result).to.have.all.keys( 'ogDate', + 'fbAppId', 'ogDescription', 'ogImage', 'ogSiteName', @@ -910,9 +926,11 @@ describe('static', function () { }]); expect(result.requestUrl).to.be.eql('https://jshemas.github.io/openGraphScraperPages/economictimes'); expect(result.charset).to.be.eql('UTF-8'); + expect(result.fbAppId).to.be.eql('128738260476079'); expect(result.success).to.be.eql(true); expect(result).to.have.all.keys( 'favicon', + 'fbAppId', 'alAndroidAppName', 'alAndroidUrl', 'alIosAppName', @@ -983,9 +1001,11 @@ describe('static', function () { expect(result.articlePublisher).to.be.eql('https://www.facebook.com/EntMagazine'); expect(result.requestUrl).to.be.eql('https://jshemas.github.io/openGraphScraperPages/entrepreneur'); expect(result.charset).to.be.eql('utf-8'); + expect(result.fbAppId).to.be.eql('279152967822'); expect(result.success).to.be.eql(true); expect(result).to.have.all.keys( 'favicon', + 'fbAppId', 'articleAuthor', 'articleModifiedTime', 'articlePublishedTime', @@ -1054,9 +1074,11 @@ describe('static', function () { }]); expect(result.requestUrl).to.be.eql('https://jshemas.github.io/openGraphScraperPages/etsy'); expect(result.charset).to.be.eql('UTF-8'); + expect(result.fbAppId).to.be.eql('89186614300'); expect(result.success).to.be.eql(true); expect(result).to.have.all.keys( 'favicon', + 'fbAppId', 'alAndroidAppName', 'alAndroidPackage', 'alAndroidUrl', @@ -1169,9 +1191,11 @@ describe('static', function () { expect(result.articlePublisher).to.be.eql('https://www.facebook.com/FastCompany'); expect(result.requestUrl).to.be.eql('https://jshemas.github.io/openGraphScraperPages/fastcompany'); expect(result.charset).to.be.eql('utf-8'); + expect(result.fbAppId).to.be.eql('178479832213933'); expect(result.success).to.be.eql(true); expect(result).to.have.all.keys( 'favicon', + 'fbAppId', 'articleModifiedTime', 'articlePublishedTime', 'articlePublisher', @@ -1229,9 +1253,11 @@ describe('static', function () { }]); expect(result.requestUrl).to.be.eql('https://jshemas.github.io/openGraphScraperPages/forbes'); expect(result.charset).to.be.eql('utf-8'); + expect(result.fbAppId).to.be.eql('123694841080850'); expect(result.success).to.be.eql(true); expect(result).to.have.all.keys( 'favicon', + 'fbAppId', 'articleAuthor', 'articleSection', 'articlePublisher', @@ -1368,9 +1394,11 @@ describe('static', function () { expect(result.twitterUrl).to.be.eql('https://foursquare.com/v/the-baxter-inn/4ed4896c775b45f6ed7b0182'); expect(result.requestUrl).to.be.eql('https://jshemas.github.io/openGraphScraperPages/foursquare'); expect(result.charset).to.be.eql('UTF-8'); + expect(result.fbAppId).to.be.eql('86734274142'); expect(result.success).to.be.eql(true); expect(result).to.have.all.keys( 'favicon', + 'fbAppId', 'alAndroidAppName', 'alAndroidPackage', 'alAndroidUrl', @@ -1507,9 +1535,11 @@ describe('static', function () { }]); expect(result.requestUrl).to.be.eql('https://jshemas.github.io/openGraphScraperPages/inc'); expect(result.charset).to.be.eql('utf-8'); + expect(result.fbAppId).to.be.eql('139291179414843'); expect(result.success).to.be.eql(true); expect(result).to.have.all.keys( 'favicon', + 'fbAppId', 'articleAuthor', 'articlePublishedTime', 'articleSection', @@ -1558,9 +1588,11 @@ describe('static', function () { }]); expect(result.requestUrl).to.be.eql('https://jshemas.github.io/openGraphScraperPages/insta'); expect(result.charset).to.be.eql('utf-8'); + expect(result.fbAppId).to.be.eql('124024574287414'); expect(result.success).to.be.eql(true); expect(result).to.have.all.keys( 'favicon', + 'fbAppId', 'alAndroidAppName', 'alAndroidPackage', 'alAndroidUrl', @@ -1609,8 +1641,10 @@ describe('static', function () { }]); expect(result.requestUrl).to.be.eql('https://jshemas.github.io/openGraphScraperPages/itunes'); expect(result.charset).to.be.eql('utf-8'); + expect(result.fbAppId).to.be.eql('116556461780510'); expect(result.success).to.be.eql(true); expect(result).to.have.all.keys( + 'fbAppId', 'ogDate', 'ogDescription', 'ogImage', @@ -1737,9 +1771,11 @@ describe('static', function () { }]); expect(result.requestUrl).to.be.eql('https://jshemas.github.io/openGraphScraperPages/kickstarter'); expect(result.charset).to.be.eql('UTF-8'); + expect(result.fbAppId).to.be.eql('69103156693'); expect(result.success).to.be.eql(true); expect(result).to.have.all.keys( 'ogDate', + 'fbAppId', 'ogDescription', 'ogImage', 'ogLocale', @@ -1799,9 +1835,11 @@ describe('static', function () { }]); expect(result.requestUrl).to.be.eql('https://jshemas.github.io/openGraphScraperPages/latimes'); expect(result.charset).to.be.eql('UTF-8'); + expect(result.fbAppId).to.be.eql('119932621434123'); expect(result.success).to.be.eql(true); expect(result).to.have.all.keys( 'favicon', + 'fbAppId', 'articleAuthor', 'articlePublishedTime', 'articleSection', @@ -2037,9 +2075,11 @@ describe('static', function () { }]); expect(result.requestUrl).to.be.eql('https://jshemas.github.io/openGraphScraperPages/mashable'); expect(result.charset).to.be.eql('UTF-8'); + expect(result.fbAppId).to.be.eql('122071082108'); expect(result.success).to.be.eql(true); expect(result).to.have.all.keys( 'favicon', + 'fbAppId', 'ogLocale', 'author', 'ogDate', @@ -2106,9 +2146,11 @@ describe('static', function () { }]); expect(result.requestUrl).to.be.eql('https://jshemas.github.io/openGraphScraperPages/medium'); expect(result.charset).to.be.eql('utf-8'); + expect(result.fbAppId).to.be.eql('542599432471018'); expect(result.success).to.be.eql(true); expect(result).to.have.all.keys( 'favicon', + 'fbAppId', 'alAndroidAppName', 'alAndroidPackage', 'alAndroidUrl', @@ -2165,9 +2207,11 @@ describe('static', function () { }]); expect(result.requestUrl).to.be.eql('https://jshemas.github.io/openGraphScraperPages/michaelkors'); expect(result.charset).to.be.eql('utf-8'); + expect(result.fbAppId).to.be.eql('693861180706239'); expect(result.success).to.be.eql(true); expect(result).to.have.all.keys( 'favicon', + 'fbAppId', 'author', 'ogLocale', 'ogAvailability', @@ -2550,9 +2594,11 @@ describe('static', function () { ]); expect(result.requestUrl).to.be.eql('https://jshemas.github.io/openGraphScraperPages/rottentomatoes'); expect(result.charset).to.be.eql('utf-8'); + expect(result.fbAppId).to.be.eql('326803741017'); expect(result.success).to.be.eql(true); expect(result).to.have.all.keys( 'favicon', + 'fbAppId', 'ogDate', 'ogImage', 'ogTitle', @@ -2667,9 +2713,11 @@ describe('static', function () { }]); expect(result.requestUrl).to.be.eql('https://jshemas.github.io/openGraphScraperPages/techcrunch'); expect(result.charset).to.be.eql('UTF-8'); + expect(result.fbAppId).to.be.eql('187288694643718'); expect(result.success).to.be.eql(true); expect(result).to.have.all.keys( 'favicon', + 'fbAppId', 'articlePublisher', 'ogDate', 'ogDescription', @@ -2733,9 +2781,11 @@ describe('static', function () { }]); expect(result.requestUrl).to.be.eql('https://jshemas.github.io/openGraphScraperPages/ted'); expect(result.charset).to.be.eql('utf-8'); + expect(result.fbAppId).to.be.eql('201021956610141'); expect(result.success).to.be.eql(true); expect(result).to.have.all.keys( 'favicon', + 'fbAppId', 'alAndroidAppName', 'alAndroidPackage', 'alAndroidUrl', @@ -2800,9 +2850,11 @@ describe('static', function () { }]); expect(result.requestUrl).to.be.eql('https://jshemas.github.io/openGraphScraperPages/thinkgeek'); expect(result.charset).to.be.eql('ISO-8859-1'); + expect(result.fbAppId).to.be.eql('199842396712737'); expect(result.success).to.be.eql(true); expect(result).to.have.all.keys( 'favicon', + 'fbAppId', 'articleAuthor', 'articlePublisher', 'ogDescription', @@ -2862,9 +2914,11 @@ describe('static', function () { }]); expect(result.requestUrl).to.be.eql('https://jshemas.github.io/openGraphScraperPages/vox'); expect(result.charset).to.be.eql('utf-8'); + expect(result.fbAppId).to.be.eql('549923288395304'); expect(result.success).to.be.eql(true); expect(result).to.have.all.keys( 'favicon', + 'fbAppId', 'articleModifiedTime', 'articlePublishedTime', 'articlePublisher', diff --git a/tests/integration/twitter.spec.ts b/tests/integration/twitter.spec.ts index 8ca8f61..09bb1a8 100644 --- a/tests/integration/twitter.spec.ts +++ b/tests/integration/twitter.spec.ts @@ -97,9 +97,11 @@ describe('twitter', function () { }]); expect(result.requestUrl).to.be.eql('https://jshemas.github.io/openGraphScraperPages/github'); expect(result.charset).to.be.eql('utf-8'); + expect(result.fbAppId).to.be.eql('1401488693436528'); expect(result.success).to.be.eql(true); expect(result).to.have.all.keys( 'favicon', + 'fbAppId', 'ogDescription', 'ogImage', 'ogSiteName', diff --git a/tests/integration/video.spec.ts b/tests/integration/video.spec.ts index ad26b15..ae9facb 100644 --- a/tests/integration/video.spec.ts +++ b/tests/integration/video.spec.ts @@ -59,9 +59,11 @@ describe('video', function () { expect(result.requestUrl).to.be.eql('https://www.youtube.com/watch?v=dQw4w9WgXcQ'); expect(result.charset).to.be.eql('UTF-8'); expect(result.success).to.be.eql(true); + expect(result.fbAppId).to.be.eql('87741124305'); if (result.ogDate === undefined) result.ogDate = 'hack because sometimes this does not come back for some reason'; expect(result).to.have.all.keys( 'favicon', + 'fbAppId', 'alAndroidAppName', 'alAndroidPackage', 'alAndroidUrl', @@ -118,9 +120,11 @@ describe('video', function () { expect(result.ogImage).to.be.to.be.an('array').and.to.not.be.empty; expect(result.requestUrl).to.be.eql('https://jshemas.github.io/openGraphScraperPages/twitch.html'); expect(result.charset).to.be.eql('utf-8'); + expect(result.fbAppId).to.be.eql('161273083968709'); expect(result.success).to.be.eql(true); expect(result).to.have.all.keys( 'favicon', + 'fbAppId', 'ogDescription', 'ogImage', 'ogLocale', From fa42962bab6abd81aafc3d7b02c57859db584b8f Mon Sep 17 00:00:00 2001 From: jshemas Date: Sun, 3 Mar 2024 13:40:57 -0500 Subject: [PATCH 5/9] adding a note about open-graph-scraper-lite in the readme --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 5dde3c0..862b646 100644 --- a/README.md +++ b/README.md @@ -3,9 +3,9 @@ [![Node.js CI](https://github.com/jshemas/openGraphScraper/workflows/Node.js%20CI/badge.svg?branch=master)](https://github.com/jshemas/openGraphScraper/actions?query=branch%3Amaster) [![Known Vulnerabilities](https://snyk.io/test/github/jshemas/openGraphScraper/badge.svg)](https://snyk.io/test/github/jshemas/openGraphScraper) -A simple node module(with TypeScript declarations) for scraping Open Graph and Twitter Card info off a site. +A simple node module(with TypeScript declarations) for scraping Open Graph and Twitter Card and other metadata off a site. -Note: `open-graph-scraper` doesn't support browser usage at this time. +Note: `open-graph-scraper` doesn't support browser usage at this time but you can use `open-graph-scraper-lite` if you already have the `HTML` and can't use Node's [Fetch API](https://nodejs.org/dist/latest-v18.x/docs/api/globals.html#fetch). ## Installation From ce77f3e29c30f448fc96a36c70b214f9917befa9 Mon Sep 17 00:00:00 2001 From: jshemas Date: Sun, 3 Mar 2024 18:24:58 -0500 Subject: [PATCH 6/9] adding support for JSON LD --- dist/lib/extract.js | 5 +++ dist/lib/types.d.ts | 1 + lib/extract.ts | 6 ++++ lib/types.ts | 1 + package.json | 1 + tests/integration/basic.spec.ts | 5 +++ tests/integration/encoding.spec.ts | 6 ++++ tests/integration/image.spec.ts | 2 ++ tests/integration/redirect.spec.ts | 2 ++ tests/integration/spotify.spec.ts | 8 +++++ tests/integration/static.spec.ts | 50 ++++++++++++++++++++++++++++++ tests/integration/video.spec.ts | 2 ++ tests/unit/static.spec.ts | 19 ++++++++++++ 13 files changed, 108 insertions(+) diff --git a/dist/lib/extract.js b/dist/lib/extract.js index ff25eb5..d806323 100644 --- a/dist/lib/extract.js +++ b/dist/lib/extract.js @@ -56,6 +56,11 @@ function extractMetaTags(body, options) { // if onlyGetOpenGraphInfo isn't set, run the open graph fallbacks if (!options.onlyGetOpenGraphInfo) { ogObject = (0, fallback_1.default)(ogObject, options, $, body); + $('script').each((index, script) => { + if (script.attribs.type && script.attribs.type === 'application/ld+json') { + ogObject.jsonLD = JSON.parse($(script).text()); + } + }); } return ogObject; } diff --git a/dist/lib/types.d.ts b/dist/lib/types.d.ts index 12cdb12..97511af 100644 --- a/dist/lib/types.d.ts +++ b/dist/lib/types.d.ts @@ -161,6 +161,7 @@ export type OgObjectInteral = { errorDetails?: Error; favicon?: string; fbAppId?: string; + jsonLD?: object; modifiedTime?: string; musicAlbum?: string; musicAlbumDisc?: string; diff --git a/lib/extract.ts b/lib/extract.ts index 2637b30..5f5daa8 100644 --- a/lib/extract.ts +++ b/lib/extract.ts @@ -56,6 +56,12 @@ export default function extractMetaTags(body: string, options: OpenGraphScraperO // if onlyGetOpenGraphInfo isn't set, run the open graph fallbacks if (!options.onlyGetOpenGraphInfo) { ogObject = fallback(ogObject, options, $, body); + + $('script').each((index, script) => { + if (script.attribs.type && script.attribs.type === 'application/ld+json') { + ogObject.jsonLD = JSON.parse($(script).text()); + } + }); } return ogObject; diff --git a/lib/types.ts b/lib/types.ts index 0b8f606..140b259 100644 --- a/lib/types.ts +++ b/lib/types.ts @@ -169,6 +169,7 @@ export type OgObjectInteral = { errorDetails?: Error; favicon?: string; fbAppId?: string; + jsonLD?: object; modifiedTime?: string; musicAlbum?: string; musicAlbumDisc?: string; diff --git a/package.json b/package.json index 2afe38f..a34117f 100644 --- a/package.json +++ b/package.json @@ -64,6 +64,7 @@ "keywords": [ "app links", "dublin core", + "json ld", "meta tags", "metadata", "og", diff --git a/tests/integration/basic.spec.ts b/tests/integration/basic.spec.ts index becbf84..407de64 100644 --- a/tests/integration/basic.spec.ts +++ b/tests/integration/basic.spec.ts @@ -160,9 +160,11 @@ describe('basic', function () { expect(result.ogTitle).to.be.eql('Buy a domain name - Register cheap domain names from $0.99 - Namecheap'); expect(result.ogImage).to.be.an('array').and.to.not.be.empty; expect(result.requestUrl).to.be.eql('https://www.namecheap.com/'); + expect(result.jsonLD).to.be.an('object').and.to.not.be.empty; expect(result.charset).to.be.eql('utf-8'); expect(result.success).to.be.eql(true); expect(result).to.have.all.keys( + 'jsonLD', 'favicon', 'ogTitle', 'ogDescription', @@ -282,6 +284,7 @@ describe('basic', function () { expect(result).to.have.all.keys( 'favicon', 'fbAppId', + 'jsonLD', 'alAndroidAppName', 'alAndroidPackage', 'alAndroidUrl', @@ -372,10 +375,12 @@ describe('basic', function () { expect(result.ogTitle).to.be.eql('Facebook - log in or sign up'); expect(result.ogDescription).to.be.eql('Log into Facebook to start sharing and connecting with your friends, family, and people you know.'); expect(result.requestUrl).to.be.eql('https://www.facebook.com/'); + expect(result.jsonLD).to.be.an('object').and.to.not.be.empty; expect(result.charset).to.be.eql('utf-8'); expect(result.success).to.be.eql(true); expect(result).to.have.all.keys( 'favicon', + 'jsonLD', 'ogDescription', 'ogImage', 'ogLocale', diff --git a/tests/integration/encoding.spec.ts b/tests/integration/encoding.spec.ts index 912bbf8..1c38fec 100644 --- a/tests/integration/encoding.spec.ts +++ b/tests/integration/encoding.spec.ts @@ -30,11 +30,13 @@ describe('encoding', function () { url: 'https://r.r10s.jp/com/img/home/top/ogp.png', }]); expect(result.requestUrl).to.be.eql('https://jshemas.github.io/openGraphScraperPages/rakuten'); + expect(result.jsonLD).to.be.an('object').and.to.not.be.empty; expect(result.fbAppId).to.be.eql('194149240717705'); expect(result.charset).to.be.eql('euc-jp'); expect(result.success).to.be.eql(true); expect(result).to.have.all.keys( 'favicon', + 'jsonLD', 'ogDescription', 'ogImage', 'ogSiteName', @@ -211,9 +213,11 @@ describe('encoding', function () { expect(result.ogUrl).to.be.eql('https://blog.csdn.net/qq449245884/article/details/107096460'); expect(result.charset).to.be.eql('UTF-8'); expect(result.requestUrl).to.be.eql('https://jshemas.github.io/openGraphScraperPages/csdn'); + expect(result.jsonLD).to.be.an('object').and.to.not.be.empty; expect(result.success).to.be.eql(true); expect(result).to.have.all.keys( 'favicon', + 'jsonLD', 'charset', 'ogDescription', 'ogImage', @@ -304,9 +308,11 @@ describe('encoding', function () { expect(result.requestUrl).to.be.eql('https://jshemas.github.io/openGraphScraperPages/okezone'); expect(result.success).to.be.eql(true); expect(result.fbAppId).to.be.eql('213195442194472'); + expect(result.jsonLD).to.be.an('object').and.to.not.be.empty; expect(result).to.have.all.keys( 'favicon', 'fbAppId', + 'jsonLD', 'articleAuthor', 'articlePublishedTime', 'articlePublisher', diff --git a/tests/integration/image.spec.ts b/tests/integration/image.spec.ts index b9b56cd..8dbfe22 100644 --- a/tests/integration/image.spec.ts +++ b/tests/integration/image.spec.ts @@ -33,9 +33,11 @@ describe('image', function () { expect(result.requestUrl).to.be.eql('https://jshemas.github.io/openGraphScraperPages/flickr'); expect(result.charset).to.be.eql('UTF-8'); expect(result.fbAppId).to.be.eql('137206539707334'); + expect(result.jsonLD).to.be.an('object').and.to.not.be.empty; expect(result.success).to.be.eql(true); expect(result).to.have.all.keys( 'favicon', + 'jsonLD', 'fbAppId', 'alIosAppName', 'alIosAppStoreId', diff --git a/tests/integration/redirect.spec.ts b/tests/integration/redirect.spec.ts index 922a5bd..c21e783 100644 --- a/tests/integration/redirect.spec.ts +++ b/tests/integration/redirect.spec.ts @@ -123,8 +123,10 @@ describe('redirect', function () { expect(result.requestUrl).to.be.eql('https://www.forbes.com/sites/kenkam/2017/09/28/3-stocks-like-apple-was-10-years-ago-tesla-nvidia-and-alibaba/#2636f6c2f0fa'); expect(result.charset).to.be.eql('utf-8'); expect(result.fbAppId).to.be.eql('123694841080850'); + expect(result.jsonLD).to.be.an('object').and.to.not.be.empty; expect(result.success).to.be.eql(true); expect(result).to.have.all.keys( + 'jsonLD', 'favicon', 'fbAppId', 'ogDate', diff --git a/tests/integration/spotify.spec.ts b/tests/integration/spotify.spec.ts index 5556477..836f438 100644 --- a/tests/integration/spotify.spec.ts +++ b/tests/integration/spotify.spec.ts @@ -70,10 +70,12 @@ describe('spotify', function () { expect(result.requestUrl).to.be.eql('https://open.spotify.com/album/5EBGCvO6upi3GNknMVe9x9'); expect(result.charset).to.be.eql('utf-8'); expect(result.fbAppId).to.be.eql('174829003346'); + expect(result.jsonLD).to.be.an('object').and.to.not.be.empty; expect(result.success).to.be.eql(true); expect(result).to.have.all.keys( 'favicon', 'fbAppId', + 'jsonLD', 'alAndroidAppName', 'alAndroidPackage', 'alAndroidUrl', @@ -134,10 +136,12 @@ describe('spotify', function () { expect(result.requestUrl).to.be.eql('https://open.spotify.com/artist/5K4W6rqBFWDnAN6FQUkS6x'); expect(result.charset).to.be.eql('utf-8'); expect(result.fbAppId).to.be.eql('174829003346'); + expect(result.jsonLD).to.be.an('object').and.to.not.be.empty; expect(result.success).to.be.eql(true); expect(result).to.have.all.keys( 'favicon', 'fbAppId', + 'jsonLD', 'alAndroidAppName', 'alAndroidPackage', 'alAndroidUrl', @@ -202,10 +206,12 @@ describe('spotify', function () { expect(result.requestUrl).to.be.eql('https://open.spotify.com/track/3p6fkbeZDIVqapfdgQe6fm'); expect(result.charset).to.be.eql('utf-8'); expect(result.fbAppId).to.be.eql('174829003346'); + expect(result.jsonLD).to.be.an('object').and.to.not.be.empty; expect(result.success).to.be.eql(true); expect(result).to.have.all.keys( 'favicon', 'fbAppId', + 'jsonLD', 'alAndroidAppName', 'alAndroidPackage', 'alAndroidUrl', @@ -317,10 +323,12 @@ describe('spotify', function () { expect(result.requestUrl).to.be.eql('https://jshemas.github.io/openGraphScraperPages/spotifyPlayList'); expect(result.charset).to.be.eql('UTF-8'); expect(result.fbAppId).to.be.eql('174829003346'); + expect(result.jsonLD).to.be.an('object').and.to.not.be.empty; expect(result.success).to.be.eql(true); expect(result).to.have.all.keys( 'favicon', 'fbAppId', + 'jsonLD', 'alAndroidAppName', 'alAndroidPackage', 'alAndroidUrl', diff --git a/tests/integration/static.spec.ts b/tests/integration/static.spec.ts index 79911ff..cd87b4c 100644 --- a/tests/integration/static.spec.ts +++ b/tests/integration/static.spec.ts @@ -210,9 +210,11 @@ describe('static', function () { expect(result.twitterImage).to.be.eql([{ url: 'http://pisces.bbystatic.com//image2/BestBuy_US/images/products/4447/4447801_sa.jpg;maxHeight=210;maxWidth=210' }]); expect(result.requestUrl).to.be.eql('https://jshemas.github.io/openGraphScraperPages/bestbuy'); expect(result.charset).to.be.eql('UTF-8'); + expect(result.jsonLD).to.be.an('object').and.to.not.be.empty; expect(result.success).to.be.eql(true); expect(result).to.have.all.keys( 'favicon', + 'jsonLD', 'ogDate', 'ogDescription', 'ogImage', @@ -291,9 +293,11 @@ describe('static', function () { expect(result.ogAudioType).to.be.eql('audio/mpeg'); expect(result.requestUrl).to.be.eql('https://jshemas.github.io/openGraphScraperPages/bloomberg'); expect(result.charset).to.be.eql('UTF-8'); + expect(result.jsonLD).to.be.an('object').and.to.not.be.empty; expect(result.success).to.be.eql(true); expect(result).to.have.all.keys( 'favicon', + 'jsonLD', 'alAndroidAppName', 'alAndroidPackage', 'alAndroidUrl', @@ -347,10 +351,12 @@ describe('static', function () { expect(result.requestUrl).to.be.eql('https://jshemas.github.io/openGraphScraperPages/businesstoday'); expect(result.charset).to.be.eql('ISO-8859-1'); expect(result.fbAppId).to.be.eql('23230437118'); + expect(result.jsonLD).to.be.an('object').and.to.not.be.empty; expect(result.success).to.be.eql(true); expect(result).to.have.all.keys( 'favicon', 'fbAppId', + 'jsonLD', 'ogDate', 'ogDescription', 'ogImage', @@ -404,10 +410,12 @@ describe('static', function () { expect(result.requestUrl).to.be.eql('https://jshemas.github.io/openGraphScraperPages/cbronline'); expect(result.charset).to.be.eql('UTF-8'); expect(result.fbAppId).to.be.eql('1880004222235592'); + expect(result.jsonLD).to.be.an('object').and.to.not.be.empty; expect(result.success).to.be.eql(true); expect(result).to.have.all.keys( 'favicon', 'fbAppId', + 'jsonLD', 'articleModifiedTime', 'articlePublishedTime', 'articleSection', @@ -519,9 +527,11 @@ describe('static', function () { }]); expect(result.requestUrl).to.be.eql('https://jshemas.github.io/openGraphScraperPages/cloudpro'); expect(result.charset).to.be.eql('utf-8'); + expect(result.jsonLD).to.be.an('object').and.to.not.be.empty; expect(result.success).to.be.eql(true); expect(result).to.have.all.keys( 'favicon', + 'jsonLD', 'ogDescription', 'ogImage', 'ogSiteName', @@ -576,9 +586,11 @@ describe('static', function () { expect(result.requestUrl).to.be.eql('https://jshemas.github.io/openGraphScraperPages/cnet'); expect(result.charset).to.be.eql('utf-8'); expect(result.fbAppId).to.be.eql('16995676698'); + expect(result.jsonLD).to.be.an('object').and.to.not.be.empty; expect(result.success).to.be.eql(true); expect(result).to.have.all.keys( 'favicon', + 'jsonLD', 'fbAppId', 'author', 'ogDescription', @@ -777,9 +789,11 @@ describe('static', function () { }]); expect(result.requestUrl).to.be.eql('https://jshemas.github.io/openGraphScraperPages/discourse'); expect(result.charset).to.be.eql('utf-8'); + expect(result.jsonLD).to.be.an('object').and.to.not.be.empty; expect(result.success).to.be.eql(true); expect(result).to.have.all.keys( 'favicon', + 'jsonLD', 'ogDescription', 'ogImage', 'ogSiteName', @@ -927,10 +941,12 @@ describe('static', function () { expect(result.requestUrl).to.be.eql('https://jshemas.github.io/openGraphScraperPages/economictimes'); expect(result.charset).to.be.eql('UTF-8'); expect(result.fbAppId).to.be.eql('128738260476079'); + expect(result.jsonLD).to.be.an('object').and.to.not.be.empty; expect(result.success).to.be.eql(true); expect(result).to.have.all.keys( 'favicon', 'fbAppId', + 'jsonLD', 'alAndroidAppName', 'alAndroidUrl', 'alIosAppName', @@ -1132,9 +1148,11 @@ describe('static', function () { expect(result.ogDescription).to.be.eql('Log into Facebook to start sharing and connecting with your friends, family, and people you know.'); expect(result.requestUrl).to.be.eql('https://jshemas.github.io/openGraphScraperPages/facebook'); expect(result.charset).to.be.eql('utf-8'); + expect(result.jsonLD).to.be.an('object').and.to.not.be.empty; expect(result.success).to.be.eql(true); expect(result).to.have.all.keys( 'favicon', + 'jsonLD', 'ogDescription', 'ogImage', 'ogLocale', @@ -1192,10 +1210,12 @@ describe('static', function () { expect(result.requestUrl).to.be.eql('https://jshemas.github.io/openGraphScraperPages/fastcompany'); expect(result.charset).to.be.eql('utf-8'); expect(result.fbAppId).to.be.eql('178479832213933'); + expect(result.jsonLD).to.be.an('object').and.to.not.be.empty; expect(result.success).to.be.eql(true); expect(result).to.have.all.keys( 'favicon', 'fbAppId', + 'jsonLD', 'articleModifiedTime', 'articlePublishedTime', 'articlePublisher', @@ -1254,10 +1274,12 @@ describe('static', function () { expect(result.requestUrl).to.be.eql('https://jshemas.github.io/openGraphScraperPages/forbes'); expect(result.charset).to.be.eql('utf-8'); expect(result.fbAppId).to.be.eql('123694841080850'); + expect(result.jsonLD).to.be.an('object').and.to.not.be.empty; expect(result.success).to.be.eql(true); expect(result).to.have.all.keys( 'favicon', 'fbAppId', + 'jsonLD', 'articleAuthor', 'articleSection', 'articlePublisher', @@ -1310,9 +1332,11 @@ describe('static', function () { }]); expect(result.requestUrl).to.be.eql('https://jshemas.github.io/openGraphScraperPages/fortune'); expect(result.charset).to.be.eql('utf-8'); + expect(result.jsonLD).to.be.an('object').and.to.not.be.empty; expect(result.success).to.be.eql(true); expect(result).to.have.all.keys( 'favicon', + 'jsonLD', 'ogDate', 'ogDescription', 'ogImage', @@ -1476,9 +1500,11 @@ describe('static', function () { expect(result.twitterUrl).to.be.eql('https://www.geektime.com/duckface-can-saves-lives-binah-ai-raises-13-5m-to-monitor-health-condition-through-selfies/'); expect(result.requestUrl).to.be.eql('https://jshemas.github.io/openGraphScraperPages/geektime'); expect(result.charset).to.be.eql('utf-8'); + expect(result.jsonLD).to.be.an('object').and.to.not.be.empty; expect(result.success).to.be.eql(true); expect(result).to.have.all.keys( 'favicon', + 'jsonLD', 'ogDate', 'articleModifiedTime', 'articlePublishedTime', @@ -1536,10 +1562,12 @@ describe('static', function () { expect(result.requestUrl).to.be.eql('https://jshemas.github.io/openGraphScraperPages/inc'); expect(result.charset).to.be.eql('utf-8'); expect(result.fbAppId).to.be.eql('139291179414843'); + expect(result.jsonLD).to.be.an('object').and.to.not.be.empty; expect(result.success).to.be.eql(true); expect(result).to.have.all.keys( 'favicon', 'fbAppId', + 'jsonLD', 'articleAuthor', 'articlePublishedTime', 'articleSection', @@ -1706,9 +1734,11 @@ describe('static', function () { }]); expect(result.requestUrl).to.be.eql('https://jshemas.github.io/openGraphScraperPages/jewishbusinessnews'); expect(result.charset).to.be.eql('UTF-8'); + expect(result.jsonLD).to.be.an('object').and.to.not.be.empty; expect(result.success).to.be.eql(true); expect(result).to.have.all.keys( 'favicon', + 'jsonLD', 'articleModifiedTime', 'articlePublishedTime', 'articlePublisher', @@ -1836,10 +1866,12 @@ describe('static', function () { expect(result.requestUrl).to.be.eql('https://jshemas.github.io/openGraphScraperPages/latimes'); expect(result.charset).to.be.eql('UTF-8'); expect(result.fbAppId).to.be.eql('119932621434123'); + expect(result.jsonLD).to.be.an('object').and.to.not.be.empty; expect(result.success).to.be.eql(true); expect(result).to.have.all.keys( 'favicon', 'fbAppId', + 'jsonLD', 'articleAuthor', 'articlePublishedTime', 'articleSection', @@ -2016,9 +2048,11 @@ describe('static', function () { }]); expect(result.requestUrl).to.be.eql('https://jshemas.github.io/openGraphScraperPages/macrumors'); expect(result.charset).to.be.eql('utf-8'); + expect(result.jsonLD).to.be.an('object').and.to.not.be.empty; expect(result.success).to.be.eql(true); expect(result).to.have.all.keys( 'favicon', + 'jsonLD', 'articlePublisher', 'ogDate', 'ogDescription', @@ -2076,10 +2110,12 @@ describe('static', function () { expect(result.requestUrl).to.be.eql('https://jshemas.github.io/openGraphScraperPages/mashable'); expect(result.charset).to.be.eql('UTF-8'); expect(result.fbAppId).to.be.eql('122071082108'); + expect(result.jsonLD).to.be.an('object').and.to.not.be.empty; expect(result.success).to.be.eql(true); expect(result).to.have.all.keys( 'favicon', 'fbAppId', + 'jsonLD', 'ogLocale', 'author', 'ogDate', @@ -2147,10 +2183,12 @@ describe('static', function () { expect(result.requestUrl).to.be.eql('https://jshemas.github.io/openGraphScraperPages/medium'); expect(result.charset).to.be.eql('utf-8'); expect(result.fbAppId).to.be.eql('542599432471018'); + expect(result.jsonLD).to.be.an('object').and.to.not.be.empty; expect(result.success).to.be.eql(true); expect(result).to.have.all.keys( 'favicon', 'fbAppId', + 'jsonLD', 'alAndroidAppName', 'alAndroidPackage', 'alAndroidUrl', @@ -2356,9 +2394,11 @@ describe('static', function () { }]); expect(result.requestUrl).to.be.eql('https://jshemas.github.io/openGraphScraperPages/npm'); expect(result.charset).to.be.eql('utf-8'); + expect(result.jsonLD).to.be.an('object').and.to.not.be.empty; expect(result.success).to.be.eql(true); expect(result).to.have.all.keys( 'favicon', + 'jsonLD', 'ogDescription', 'ogLocale', 'ogImage', @@ -2404,9 +2444,11 @@ describe('static', function () { }]); expect(result.requestUrl).to.be.eql('https://jshemas.github.io/openGraphScraperPages/prnewswire'); expect(result.charset).to.be.eql('utf-8'); + expect(result.jsonLD).to.be.an('object').and.to.not.be.empty; expect(result.success).to.be.eql(true); expect(result).to.have.all.keys( 'favicon', + 'jsonLD', 'author', 'ogDate', 'ogDescription', @@ -2504,9 +2546,11 @@ describe('static', function () { }]); expect(result.requestUrl).to.be.eql('https://jshemas.github.io/openGraphScraperPages/reuters'); expect(result.charset).to.be.eql('UTF-8'); + expect(result.jsonLD).to.be.an('object').and.to.not.be.empty; expect(result.success).to.be.eql(true); expect(result).to.have.all.keys( 'favicon', + 'jsonLD', 'author', 'articlePublisher', 'ogDescription', @@ -2595,10 +2639,12 @@ describe('static', function () { expect(result.requestUrl).to.be.eql('https://jshemas.github.io/openGraphScraperPages/rottentomatoes'); expect(result.charset).to.be.eql('utf-8'); expect(result.fbAppId).to.be.eql('326803741017'); + expect(result.jsonLD).to.be.an('object').and.to.not.be.empty; expect(result.success).to.be.eql(true); expect(result).to.have.all.keys( 'favicon', 'fbAppId', + 'jsonLD', 'ogDate', 'ogImage', 'ogTitle', @@ -2714,10 +2760,12 @@ describe('static', function () { expect(result.requestUrl).to.be.eql('https://jshemas.github.io/openGraphScraperPages/techcrunch'); expect(result.charset).to.be.eql('UTF-8'); expect(result.fbAppId).to.be.eql('187288694643718'); + expect(result.jsonLD).to.be.an('object').and.to.not.be.empty; expect(result.success).to.be.eql(true); expect(result).to.have.all.keys( 'favicon', 'fbAppId', + 'jsonLD', 'articlePublisher', 'ogDate', 'ogDescription', @@ -2914,10 +2962,12 @@ describe('static', function () { }]); expect(result.requestUrl).to.be.eql('https://jshemas.github.io/openGraphScraperPages/vox'); expect(result.charset).to.be.eql('utf-8'); + expect(result.jsonLD).to.be.an('object').and.to.not.be.empty; expect(result.fbAppId).to.be.eql('549923288395304'); expect(result.success).to.be.eql(true); expect(result).to.have.all.keys( 'favicon', + 'jsonLD', 'fbAppId', 'articleModifiedTime', 'articlePublishedTime', diff --git a/tests/integration/video.spec.ts b/tests/integration/video.spec.ts index ae9facb..6cc192d 100644 --- a/tests/integration/video.spec.ts +++ b/tests/integration/video.spec.ts @@ -60,10 +60,12 @@ describe('video', function () { expect(result.charset).to.be.eql('UTF-8'); expect(result.success).to.be.eql(true); expect(result.fbAppId).to.be.eql('87741124305'); + expect(result.jsonLD).to.be.an('object').and.to.not.be.empty; if (result.ogDate === undefined) result.ogDate = 'hack because sometimes this does not come back for some reason'; expect(result).to.have.all.keys( 'favicon', 'fbAppId', + 'jsonLD', 'alAndroidAppName', 'alAndroidPackage', 'alAndroidUrl', diff --git a/tests/unit/static.spec.ts b/tests/unit/static.spec.ts index 6df59b0..b7e7366 100644 --- a/tests/unit/static.spec.ts +++ b/tests/unit/static.spec.ts @@ -215,6 +215,25 @@ describe('static check meta tags', function () { }); }); + it('jsonLD', function () { + const metaHTML = ` + + `; + + mockAgent.get('http://www.test.com') + .intercept({ path: '/' }) + .reply(200, metaHTML); + + return ogs({ url: 'www.test.com' }) + .then(function (data) { + expect(data.result.success).to.be.eql(true); + expect(data.result.requestUrl).to.be.eql('http://www.test.com'); + expect(data.result.jsonLD).to.be.eql({ foo: 'bar' }); + expect(data.html).to.be.eql(metaHTML); + expect(data.response).to.be.a('response'); + }); + }); + it('encoding - utf-8', function () { /* eslint-disable max-len */ const metaHTML = ` From 7f93ee2d070ce6d9382121204de9d67636c24dcf Mon Sep 17 00:00:00 2001 From: jshemas Date: Sun, 3 Mar 2024 18:37:59 -0500 Subject: [PATCH 7/9] updating undici --- package-lock.json | 14 +++++++------- package.json | 2 +- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/package-lock.json b/package-lock.json index c2bc5f2..0816dfe 100644 --- a/package-lock.json +++ b/package-lock.json @@ -12,7 +12,7 @@ "chardet": "^2.0.0", "cheerio": "^1.0.0-rc.12", "iconv-lite": "^0.6.3", - "undici": "^6.6.2", + "undici": "^6.7.0", "validator": "^13.11.0" }, "devDependencies": { @@ -1578,9 +1578,9 @@ } }, "node_modules/caniuse-lite": { - "version": "1.0.30001591", - "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001591.tgz", - "integrity": "sha512-PCzRMei/vXjJyL5mJtzNiUCKP59dm8Apqc3PH8gJkMnMXZGox93RbE76jHsmLwmIo6/3nsYIpJtx0O7u5PqFuQ==", + "version": "1.0.30001593", + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001593.tgz", + "integrity": "sha512-UWM1zlo3cZfkpBysd7AS+z+v007q9G1+fLTUU42rQnY6t2axoogPW/xol6T7juU5EUoOhML4WgBIdG+9yYqAjQ==", "dev": true, "funding": [ { @@ -5561,9 +5561,9 @@ } }, "node_modules/undici": { - "version": "6.6.2", - "resolved": "https://registry.npmjs.org/undici/-/undici-6.6.2.tgz", - "integrity": "sha512-vSqvUE5skSxQJ5sztTZ/CdeJb1Wq0Hf44hlYMciqHghvz+K88U0l7D6u1VsndoFgskDcnU+nG3gYmMzJVzd9Qg==", + "version": "6.7.0", + "resolved": "https://registry.npmjs.org/undici/-/undici-6.7.0.tgz", + "integrity": "sha512-IcWssIyDN1gk6Mcae44q04oRoWTKrW8OKz0effVK1xdWwAgMPnfpxhn9RXUSL5JlwSikO18R7Ibk7Nukz6kxWA==", "dependencies": { "@fastify/busboy": "^2.0.0" }, diff --git a/package.json b/package.json index a34117f..87253c8 100644 --- a/package.json +++ b/package.json @@ -28,7 +28,7 @@ "chardet": "^2.0.0", "cheerio": "^1.0.0-rc.12", "iconv-lite": "^0.6.3", - "undici": "^6.6.2", + "undici": "^6.7.0", "validator": "^13.11.0" }, "files": [ From 29bb13331fe450c4076aea83fdca9d70fb5e7076 Mon Sep 17 00:00:00 2001 From: jshemas Date: Sun, 3 Mar 2024 18:41:39 -0500 Subject: [PATCH 8/9] updating change log --- CHANGELOG.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index b1b4507..ef4c847 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,12 @@ # Change Log +## 6.5.0 + +- Adding support for JSON LD +- Adding support for `og:image:alt`, `twitterAccount`, `fbAppId` and extra og tags for `music` and `video` +- Fixing jsdoc param name +- Updating dependencies + ## 6.4.0 - Add character encoding detection and decoding logic using `iconv-lite` From 2da007acf5d756adcc03a7d83063a480d51095c1 Mon Sep 17 00:00:00 2001 From: jshemas Date: Sun, 3 Mar 2024 18:41:47 -0500 Subject: [PATCH 9/9] 6.5.0 --- package-lock.json | 4 ++-- package.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/package-lock.json b/package-lock.json index 0816dfe..1fff0b8 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "open-graph-scraper", - "version": "6.4.0", + "version": "6.5.0", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "open-graph-scraper", - "version": "6.4.0", + "version": "6.5.0", "license": "MIT", "dependencies": { "chardet": "^2.0.0", diff --git a/package.json b/package.json index 87253c8..831c218 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "open-graph-scraper", "description": "Node.js scraper module for Open Graph and Twitter Card info", - "version": "6.4.0", + "version": "6.5.0", "license": "MIT", "main": "./dist/index.js", "types": "./dist/index.d.ts",