From 019465cfb2520180ed7fcc15aa080e6cf0b84bb1 Mon Sep 17 00:00:00 2001 From: Dong Nguyen Date: Wed, 22 Jul 2026 14:57:14 +0700 Subject: [PATCH 1/3] v4.2.0 - Remove custom agent support - Update dependencies Related issue: #195 --- .github/workflows/ci-test.yml | 8 +- README.md | 21 - index.d.ts | 4 +- package.json | 4 +- src/main.test.js | 18 - src/utils/providers.latest.js | 424 +++++--------- src/utils/providers.original.json | 924 +++++++++++------------------- src/utils/providers.prev.js | 2 +- src/utils/retrieve.js | 10 +- 9 files changed, 503 insertions(+), 912 deletions(-) diff --git a/.github/workflows/ci-test.yml b/.github/workflows/ci-test.yml index 78c1a12..b99179e 100644 --- a/.github/workflows/ci-test.yml +++ b/.github/workflows/ci-test.yml @@ -12,13 +12,13 @@ jobs: strategy: matrix: - node_version: [22.x, 24.x, 25.x] + node_version: [22.x, 24.x, 26.x] steps: - - uses: actions/checkout@v6 + - uses: actions/checkout@v7 - name: setup Node.js v${{ matrix.node_version }} - uses: actions/setup-node@v6 + uses: actions/setup-node@v7 with: node-version: ${{ matrix.node_version }} @@ -29,7 +29,7 @@ jobs: npm run test - name: cache node modules - uses: actions/cache@v5 + uses: actions/cache@v6 with: path: ~/.npm key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} diff --git a/README.md b/README.md index 79718b9..f391a93 100644 --- a/README.md +++ b/README.md @@ -82,7 +82,6 @@ Please see the provider's oEmbed API docs carefully for exact information. - `headers`: to set request headers - `proxy`: another endpoint to forward the request to -- `agent`: a HTTP proxy agent - `signal`: AbortController signal or AbortSignal timeout to terminate the request You can use this param to set request headers to fetch. @@ -123,26 +122,6 @@ extract(url, null, { With the above setting, request will be forwarded to `https://your-secret-proxy.io/loadJson?url={OEMBED_ENDPOINT}`. -Another way to work with proxy is use `agent` option instead of `proxy` as below: - -```js -import { extract } from '@extractus/oembed-extractor' - -import { HttpsProxyAgent } from 'https-proxy-agent' - -const proxy = 'http://abc:RaNdoMpasswORd_country-France@proxy.packetstream.io:31113' - -const url = 'https://codepen.io/ndaidong/pen/LYmLKBw' - -const oembed = await extract(url, null, { - agent: new HttpsProxyAgent(proxy), -}) -console.log('Run oembed-extractor with proxy:', proxy) -console.log(oembed) -``` - -For more info about [https-proxy-agent](https://www.npmjs.com/package/https-proxy-agent), check [its repo](https://github.com/TooTallNate/proxy-agents). - By default, there is no request timeout. You can use the option `signal` to cancel request at the right time. The common way is to use AbortControler: diff --git a/index.d.ts b/index.d.ts index 26a4879..b6591bc 100644 --- a/index.d.ts +++ b/index.d.ts @@ -152,8 +152,6 @@ export interface FetchOptions { headers?: Record /** Proxy configuration */ proxy?: ProxyConfig - /** HTTP proxy agent (e.g. HttpsProxyAgent) */ - agent?: object /** AbortSignal to cancel the request */ signal?: AbortSignal } @@ -163,7 +161,7 @@ export interface FetchOptions { * * @param url - URL of a valid oEmbed resource * @param params - Optional parameters (maxwidth, maxheight, etc.) - * @param fetchOptions - Advanced fetch options (headers, proxy, agent, signal) + * @param fetchOptions - Advanced fetch options (headers, proxy, signal) * @returns Promise resolving to oEmbed data */ export function extract(url: string, params?: Params, fetchOptions?: FetchOptions): Promise diff --git a/package.json b/package.json index 418c74e..ab8838a 100644 --- a/package.json +++ b/package.json @@ -1,5 +1,5 @@ { - "version": "4.1.0", + "version": "4.2.0", "name": "@extractus/oembed-extractor", "description": "Get oEmbed data from given URL.", "homepage": "https://github.com/extractus/oembed-extractor", @@ -12,7 +12,7 @@ "type": "module", "types": "./index.d.ts", "engines": { - "node": ">= 20" + "node": ">= 22" }, "scripts": { "lint": "eslint .", diff --git a/src/main.test.js b/src/main.test.js index 7ffecc6..cd2efd5 100644 --- a/src/main.test.js +++ b/src/main.test.js @@ -3,8 +3,6 @@ import { describe, it } from 'node:test' import assert from 'node:assert' -import { HttpsProxyAgent } from 'https-proxy-agent' - import nock from 'nock' import { @@ -14,9 +12,6 @@ import { setProviderList } from './main.js' -const env = process.env || {} -const PROXY_SERVER = env.PROXY_SERVER || '' - const required = [ 'type', 'version', @@ -207,19 +202,6 @@ describe('test if extract() with some popular providers', () => { }) }) -if (PROXY_SERVER !== '') { - describe('test extract live oembed API via proxy server', () => { - it('check if extract method works with proxy server', async () => { - const url = 'https://codepen.io/ndaidong/pen/LYmLKBw' - const result = await extract(url, {}, { - agent: new HttpsProxyAgent(PROXY_SERVER), - }) - console.log(result) - assert.ok(result.success) - }, 10000) - }) -} - it('test .hasProvider() method', () => { assert.ok(hasProvider('https://www.youtube.com/watch?v=ciS8aCrX-9s')) assert.ok(!hasProvider('https://trello.com/b/BO3bg7yn/notes')) diff --git a/src/utils/providers.latest.js b/src/utils/providers.latest.js index 513d042..6f7ca39 100644 --- a/src/utils/providers.latest.js +++ b/src/utils/providers.latest.js @@ -1,4 +1,4 @@ -// provider data, synchronized at 2026-05-03T06:03:25.358Z +// provider data, synchronized at 2026-07-22T03:45:47.831Z /* eslint-disable */ @@ -115,12 +115,6 @@ export const providers = [ ], "e": "//storymaps.arcgis.com/oembed" }, - { - "s": [ - "//app\\.archivos\\.digital/app/view/*" - ], - "e": "//app.archivos.digital/oembed/" - }, { "s": [ "//*\\.studio\\.assemblrworld\\.com/creation/*", @@ -195,12 +189,6 @@ export const providers = [ ], "e": "//balsamiq.cloud/oembed" }, - { - "s": [ - "//beams\\.fm/*" - ], - "e": "//api.beams.fm/oEmbed" - }, { "s": [], "e": "//www.beautiful.ai/api/oembed" @@ -220,9 +208,10 @@ export const providers = [ }, { "s": [ - "//cloud\\.biqapp\\.com/*" + "//biqapp\\.net/f/*", + "//www\\.biqapp\\.net/f/*" ], - "e": "//biqapp.com/api/v1/video/oembed" + "e": "//biqapp.net/api/oembed" }, { "s": [], @@ -275,12 +264,6 @@ export const providers = [ ], "e": "//oembed.brightcove.com/" }, - { - "s": [ - "//view\\.briovr\\.com/api/v1/worlds/oembed/*" - ], - "e": "//view.briovr.com/api/v1/worlds/oembed/" - }, { "s": [ "//www\\.bumper\\.com/oembed/bumper", @@ -329,9 +312,11 @@ export const providers = [ }, { "s": [ - "//minesweeper\\.today/*" + "//carbonvoice\\.app/s/*", + "//carbonvoice\\.app/m/*", + "//carbonvoice\\.app/c/*" ], - "e": "//minesweeper.today/api/oembed" + "e": "//carbonvoice.app/api/oembed" }, { "s": [ @@ -359,12 +344,9 @@ export const providers = [ }, { "s": [ - "//chainflix\\.net/video/*", - "//chainflix\\.net/video/embed/*", - "//*\\.chainflix\\.net/video/*", - "//*\\.chainflix\\.net/video/embed/*" + "//chanceindex\\.com/odds/*" ], - "e": "//www.chainflix.net/video/oembed" + "e": "//chanceindex.com/api/oembed" }, { "s": [ @@ -372,12 +354,6 @@ export const providers = [ ], "e": "//embed.chartblocks.com/1.0/oembed" }, - { - "s": [ - "//chirb\\.it/*" - ], - "e": "//chirb.it/oembed.json" - }, { "s": [ "//chroco\\.ooo/mypage/*", @@ -401,6 +377,12 @@ export const providers = [ ], "e": "//www.circuitlab.com/circuit/oembed/" }, + { + "s": [ + "//clipform\\.io/*" + ], + "e": "//api.clipform.io/v1/oembed" + }, { "s": [ "//www\\.clipland\\.com/v/*" @@ -420,12 +402,6 @@ export const providers = [ ], "e": "//api.clyp.it/oembed/" }, - { - "s": [ - "//app\\.ilovecoco\\.video/*/embed" - ], - "e": "//app.ilovecoco.video/api/oembed.json" - }, { "s": [ "//codehs\\.com/editor/share_abacus/*" @@ -458,6 +434,13 @@ export const providers = [ ], "e": "//www.collegehumor.com/oembed.json" }, + { + "s": [ + "//coloringmonster\\.com/coloring-page/*", + "//coloringmonster\\.com/monsterpieces/*" + ], + "e": "//coloringmonster.com/oembed" + }, { "s": [ "//commaful\\.com/play/*" @@ -471,12 +454,6 @@ export const providers = [ ], "e": "//coub.com/api/oembed.json" }, - { - "s": [ - "//crowdranking\\.com/*/*" - ], - "e": "//crowdranking.com/api/oembed.json" - }, { "s": [ "//crumb\\.sh/*" @@ -495,12 +472,6 @@ export const providers = [ ], "e": "//api.curated.co/oembed" }, - { - "s": [ - "//app\\.customerdb\\.com/share/*" - ], - "e": "//app.customerdb.com/embed" - }, { "s": [ "//app\\.dadan\\.io/*", @@ -599,9 +570,10 @@ export const providers = [ }, { "s": [ - "//app\\.echoeshq\\.com/embed/*" + "//ecency\\.com/@*/*", + "//ecency\\.com/*/@*/*" ], - "e": "//api.echoeshq.com/oembed" + "e": "//ecency.com/api/oembed" }, { "s": [], @@ -662,20 +634,6 @@ export const providers = [ ], "e": "//cdn.everwall.com/hubs/oembed" }, - { - "s": [ - "//app\\.ex\\.co/stories/*", - "//www\\.playbuzz\\.com/*" - ], - "e": "//oembed.ex.co/item" - }, - { - "s": [ - "//eyrie\\.io/board/*", - "//eyrie\\.io/sparkfun/*" - ], - "e": "//eyrie.io/v1/oembed" - }, { "s": [ "//www\\.facebook\\.com/*/posts/*", @@ -704,12 +662,6 @@ export const providers = [ ], "e": "//graph.facebook.com/v16.0/oembed_page" }, - { - "s": [ - "//app\\.getfader\\.com/projects/*/publish" - ], - "e": "//app.getfader.com/api/oembed" - }, { "s": [ "//faithlifetv\\.com/items/*", @@ -720,6 +672,12 @@ export const providers = [ ], "e": "//faithlifetv.com/api/oembed" }, + { + "s": [ + "//haus\\.fazen\\.co/embed/music/*" + ], + "e": "//haus.fazen.co/api/oembed" + }, { "s": [ "//www\\.figma\\.com/file/*", @@ -821,30 +779,9 @@ export const providers = [ }, { "s": [ - "//*\\.geograph\\.org\\.uk/*", - "//*\\.geograph\\.co\\.uk/*", - "//*\\.geograph\\.ie/*", - "//*\\.wikimedia\\.org/*_geograph\\.org\\.uk_*" + "//fritube\\.ch/v/*" ], - "e": "//api.geograph.org.uk/api/oembed" - }, - { - "s": [ - "//*\\.geograph\\.org\\.gg/*", - "//*\\.geograph\\.org\\.je/*", - "//channel-islands\\.geograph\\.org/*", - "//channel-islands\\.geographs\\.org/*", - "//*\\.channel\\.geographs\\.org/*" - ], - "e": "//www.geograph.org.gg/api/oembed" - }, - { - "s": [ - "//geo-en\\.hlipp\\.de/*", - "//geo\\.hlipp\\.de/*", - "//germany\\.geograph\\.org/*" - ], - "e": "//geo.hlipp.de/restapi.php/api/oembed" + "e": "//fritube.ch/services/oembed" }, { "s": [ @@ -905,12 +842,6 @@ export const providers = [ ], "e": "//api.grain.com/_/api/oembed" }, - { - "s": [ - "//gtchannel\\.com/watch/*" - ], - "e": "//api.luminery.com/oembed" - }, { "s": [ "//gumlet\\.tv/watch/*", @@ -943,12 +874,6 @@ export const providers = [ ], "e": "//hearthis.at/oembed/?format=json" }, - { - "s": [ - "//helenenglish\\.education/widget*" - ], - "e": "//helenenglish.education/embed" - }, { "s": [ "//heyzine\\.com/flip-book/*", @@ -989,12 +914,6 @@ export const providers = [ ], "e": "//homey.app/api/oembed/flow" }, - { - "s": [ - "//*\\.hopvue\\.com/*" - ], - "e": "//portal.hopvue.com/api/oembed/" - }, { "s": [ "//huffduffer\\.com/*/*" @@ -1056,12 +975,6 @@ export const providers = [ ], "e": "//qr.imenupro.com/api/oembed" }, - { - "s": [ - "//incredible\\.dev/watch/*" - ], - "e": "//oembed.incredible.dev/oembed" - }, { "s": [ "//player\\.indacolive\\.com/player/jwp/clients/*" @@ -1143,9 +1056,9 @@ export const providers = [ }, { "s": [ - "//play\\.itemis\\.io/*" + "//jawafdehi\\.org/case/*" ], - "e": "//create.storage.api.itemis.io/api/embed" + "e": "//api.jawafdehi.org/oembed/" }, { "s": [ @@ -1170,14 +1083,9 @@ export const providers = [ }, { "s": [ - "//tv\\.kakao\\.com/channel/*/cliplink/*", - "//tv\\.kakao\\.com/m/channel/*/cliplink/*", - "//tv\\.kakao\\.com/channel/v/*", - "//tv\\.kakao\\.com/channel/*/livelink/*", - "//tv\\.kakao\\.com/m/channel/*/livelink/*", - "//tv\\.kakao\\.com/channel/l/*" + "//www\\.justspin\\.cc/workouts/*" ], - "e": "//tv.kakao.com/oembed" + "e": "//www.justspin.cc/api/oembed" }, { "s": [ @@ -1185,13 +1093,6 @@ export const providers = [ ], "e": "//www.kickstarter.com/services/oembed" }, - { - "s": [ - "//www\\.kidoju\\.com/en/x/*/*", - "//www\\.kidoju\\.com/fr/x/*/*" - ], - "e": "//www.kidoju.com/api/oembed" - }, { "s": [ "//halaman\\.email/form/*", @@ -1211,19 +1112,6 @@ export const providers = [ ], "e": "//www.kitchenbowl.com/oembed" }, - { - "s": [ - "//app\\.kmdr\\.sh/h/*", - "//app\\.kmdr\\.sh/history/*" - ], - "e": "//api.kmdr.sh/services/oembed" - }, - { - "s": [ - "//jdr\\.knacki\\.info/meuh/*" - ], - "e": "//jdr.knacki.info/oembed" - }, { "s": [ "//knowledgepad\\.co/#/knowledge/*" @@ -1232,9 +1120,10 @@ export const providers = [ }, { "s": [ - "//*\\.kooapp\\.com/koo/*" + "//kommodo\\.ai/recordings/*", + "//kommodo\\.ai/guides/*" ], - "e": "//embed.kooapp.com/services/oembed" + "e": "//kommodo.ai/api/oembed" }, { "s": [ @@ -1272,12 +1161,6 @@ export const providers = [ ], "e": "//learningapps.org/oembed.php" }, - { - "s": [ - "//umotion-test\\.univ-lemans\\.fr/video/*" - ], - "e": "//umotion-test.univ-lemans.fr/oembed" - }, { "s": [ "//pod\\.univ-lille\\.fr/video/*" @@ -1297,6 +1180,15 @@ export const providers = [ ], "e": "//api.linkstackz.com/oembed" }, + { + "s": [ + "//livecodes\\.io/", + "//livecodes\\.io/?*", + "//*\\.livecodes\\.io/", + "//*\\.livecodes\\.io/?*" + ], + "e": "//livecodes.io/oembed" + }, { "s": [ "//livid\\.com/watch/*" @@ -1382,16 +1274,6 @@ export const providers = [ ], "e": "//web.microsoftstream.com/oembed" }, - { - "s": [ - "//www\\.minervaknows\\.com/featured-recipes/*", - "//www\\.minervaknows\\.com/themes/*", - "//www\\.minervaknows\\.com/themes/*/recipes/*", - "//app\\.minervaknows\\.com/recipes/*", - "//app\\.minervaknows\\.com/recipes/*/follow" - ], - "e": "//oembed.minervaknows.com" - }, { "s": [ "//miro\\.com/app/board/*" @@ -1527,9 +1409,14 @@ export const providers = [ }, { "s": [ - "//nopaste\\.ml/*" + "//nouncify\\.com/i/*", + "//nouncify\\.com/brand/*", + "//nouncify\\.com/e/*", + "//sandbox\\.nouncify\\.com/i/*", + "//sandbox\\.nouncify\\.com/brand/*", + "//sandbox\\.nouncify\\.com/e/*" ], - "e": "//oembed.nopaste.ml" + "e": "//nouncify.com/api/oembed" }, { "s": [ @@ -1606,6 +1493,13 @@ export const providers = [ ], "e": "//origits.com/oembed" }, + { + "s": [ + "//embed\\.orizn\\.app/frame/*", + "//embed\\.orizn\\.app/widgets/*" + ], + "e": "//embed.orizn.app/api/oembed" + }, { "s": [ "//outplayed\\.tv/media/*" @@ -1619,12 +1513,6 @@ export const providers = [ ], "e": "//overflow.io/services/oembed" }, - { - "s": [ - "//www\\.oz\\.com/*/video/*" - ], - "e": "//core.oz.com/oembed" - }, { "s": [ "//padlet\\.com/*" @@ -1639,6 +1527,13 @@ export const providers = [ ], "e": "//api-v2.pandavideo.com.br/oembed" }, + { + "s": [ + "//app\\.parler\\.com/post/*", + "//app\\.parler\\.com/b/*" + ], + "e": "//app.parler.com/oembed" + }, { "s": [ "//app\\.parta\\.io/core/embed/*", @@ -1659,29 +1554,6 @@ export const providers = [ ], "e": "//peertube.tv/services/oembed" }, - { - "s": [ - "//www\\.picturelfy\\.com/p/*" - ], - "e": "//api.picturelfy.com/service/oembed/" - }, - { - "s": [ - "//piggy\\.to/@*/*", - "//piggy\\.to/view/*" - ], - "e": "//piggy.to/oembed" - }, - { - "s": [ - "//*\\.builder\\.pikasso\\.xyz/embed/*" - ], - "e": "//builder.pikasso.xyz/api/oembed" - }, - { - "s": [], - "e": "//beta.pingvp.com.kpnis.nl/p/oembed.php" - }, { "s": [ "//tools\\.pinpoll\\.com/embed/*" @@ -1741,12 +1613,6 @@ export const providers = [ ], "e": "//api.portfolium.com/oembed" }, - { - "s": [ - "//present\\.do/decks/*" - ], - "e": "//gateway.cobalt.run/present/decks/oembed" - }, { "s": [ "//prezi\\.com/v/*", @@ -1760,6 +1626,15 @@ export const providers = [ ], "e": "//programmingly.dev/api/oembed" }, + { + "s": [ + "//www\\.pyzia\\.app/dashboard?*", + "//pyzia\\.app/dashboard?*", + "//www\\.pyzia\\.app/embed/chart?*", + "//pyzia\\.app/embed/chart?*" + ], + "e": "//www.pyzia.app/api/oembed" + }, { "s": [ "//qtpi\\.gg/fashion/*" @@ -1791,24 +1666,6 @@ export const providers = [ ], "e": "//www.quizz.biz/api/oembed" }, - { - "s": [ - "//play\\.radiopublic\\.com/*", - "//radiopublic\\.com/*", - "//www\\.radiopublic\\.com/*", - "//*\\.radiopublic\\.com/*" - ], - "e": "//oembed.radiopublic.com/oembed" - }, - { - "s": [ - "//raindrop\\.io/*", - "//raindrop\\.io/*/*", - "//raindrop\\.io/*/*/*", - "//raindrop\\.io/*/*/*/*" - ], - "e": "//pub.raindrop.io/api/oembed" - }, { "s": [ "//www\\.rcvis\\.com/v/*", @@ -1859,6 +1716,12 @@ export const providers = [ ], "e": "//www.reverbnation.com/oembed" }, + { + "s": [ + "//risky\\.biz/*" + ], + "e": "//risky.biz/oembed" + }, { "s": [ "//roomshare\\.jp/post/*", @@ -1881,9 +1744,18 @@ export const providers = [ }, { "s": [ - "//embed\\.runkit\\.com/*," + "//www\\.rushes\\.cc/video/*", + "//www\\.rushes\\.cc/embed/*", + "//rushes\\.cc/video/*", + "//rushes\\.cc/embed/*" ], - "e": "//embed.runkit.com/oembed" + "e": "//api.rushes.cc/oembed" + }, + { + "s": [ + "//app2\\.sagenverse\\.com/embed/*" + ], + "e": "//app2.sagenverse.com/oembed" }, { "s": [ @@ -1915,13 +1787,6 @@ export const providers = [ ], "e": "//sbedit.net/oembed/" }, - { - "s": [ - "//getscenes\\.com/e/*", - "//getscenes\\.com/event/*" - ], - "e": "//getscenes.com/oembed" - }, { "s": [ "//console\\.screen9\\.com/*", @@ -1966,19 +1831,6 @@ export const providers = [ ], "e": "//shared-file-kappa.vercel.app/file/api/oembed" }, - { - "s": [ - "//shopshare\\.tv/shopboard/*", - "//shopshare\\.tv/shopcast/*" - ], - "e": "//shopshare.tv/api/shopcast/oembed" - }, - { - "s": [ - "//www\\.shortnote\\.jp/view/notes/*" - ], - "e": "//www.shortnote.jp/oembed/" - }, { "s": [ "//shoudio\\.com/*", @@ -2025,6 +1877,13 @@ export const providers = [ ], "e": "//sketchfab.com/oembed" }, + { + "s": [ + "//skhema\\.com/embed/e/*", + "//skhema\\.com/embed/c/*" + ], + "e": "//skhema.com/api/oembed" + }, { "s": [ "//www\\.skoletube\\.dk/media/*", @@ -2051,12 +1910,6 @@ export const providers = [ ], "e": "//smashnotes.com/services/oembed" }, - { - "s": [ - "//open\\.smeme\\.com/*" - ], - "e": "//open.smeme.com/api/oembed" - }, { "s": [ "//www\\.smrthi\\.com/book/*" @@ -2166,9 +2019,9 @@ export const providers = [ }, { "s": [ - "//subscribi\\.io/api/oembed*" + "//streetartcities\\.com/markers/*" ], - "e": "//subscribi.io/api/oembed" + "e": "//oembed.streetartcities.com/oembed" }, { "s": [ @@ -2203,6 +2056,12 @@ export const providers = [ ], "e": "//sway.office.com/api/v1.0/oembed" }, + { + "s": [ + "//synthcamp\\.net/r/*" + ], + "e": "//synthcamp.net/api/oembed" + }, { "s": [ "//share\\.synthesia\\.io/*" @@ -2218,7 +2077,8 @@ export const providers = [ { "s": [ "//ted\\.com/talks/*", - "//www\\.ted\\.com/talks/*" + "//www\\.ted\\.com/talks/*", + "//embed\\.ted\\.com/talks/*" ], "e": "//www.ted.com/services/v1/oembed.json" }, @@ -2229,6 +2089,12 @@ export const providers = [ ], "e": "//www.tella.tv/api/oembed" }, + { + "s": [ + "//rest-prod\\.tenet\\.textexpander\\.com/share/*" + ], + "e": "//rest-prod.tenet.textexpander.com/oembed" + }, { "s": [ "//hubspot-media-bridge\\.thedamconsultants\\.com/*" @@ -2276,6 +2142,12 @@ export const providers = [ ], "e": "//tksn.me/api/oembed/" }, + { + "s": [ + "//tlexdr\\.com/episode/*" + ], + "e": "//tlexdr.com/oembed" + }, { "s": [ "//tonicaudio\\.com/take/*", @@ -2411,18 +2283,6 @@ export const providers = [ ], "e": "//app.ustudio.com/api/v2/oembed" }, - { - "s": [ - "//veer\\.tv/videos/*" - ], - "e": "//api.veer.tv/oembed" - }, - { - "s": [ - "//veervr\\.tv/videos/*" - ], - "e": "//api.veervr.tv/oembed" - }, { "s": [ "//www\\.vevo\\.com/*" @@ -2435,6 +2295,13 @@ export const providers = [ ], "e": "//videfit.com/oembed" }, + { + "s": [ + "//vidlink\\.it/videos/*", + "//www\\.vidlink\\.it/videos/*" + ], + "e": "//www.vidlink.it/api/oembed" + }, { "s": [ "//vidmount\\.com/*" @@ -2478,12 +2345,6 @@ export const providers = [ ], "e": "//vizdom.dev/api/v1/oembed" }, - { - "s": [ - "//vizydrop\\.com/shared/*" - ], - "e": "//vizydrop.com/oembed" - }, { "s": [ "//vlipsy\\.com/*" @@ -2531,15 +2392,16 @@ export const providers = [ }, { "s": [ - "//plugins\\.webcrumbs\\.dev/*" + "//play\\.wecandeo\\.com/video/v/*" ], - "e": "//webcrumbs.dev/oembed" + "e": "//play.wecandeo.com/oembed/" }, { "s": [ - "//play\\.wecandeo\\.com/video/v/*" + "//www\\.wewtalk\\.com/voice/*", + "//wewtalk\\.com/voice/*" ], - "e": "//play.wecandeo.com/oembed/" + "e": "//www.wewtalk.com/api/oembed" }, { "s": [ @@ -2552,7 +2414,8 @@ export const providers = [ "s": [ "//fast\\.wistia\\.com/embed/iframe/*", "//fast\\.wistia\\.com/embed/playlists/*", - "//*\\.wistia\\.com/medias/*" + "//*\\.wistia\\.com/medias/*", + "//*\\.wistia\\.com/s/*" ], "e": "//fast.wistia.com/oembed.json" }, @@ -2584,6 +2447,13 @@ export const providers = [ ], "e": "//public-api.wordpress.com/oembed/" }, + { + "s": [ + "//worldeventtrading\\.com/predictions/*", + "//www\\.worldeventtrading\\.com/predictions/*" + ], + "e": "//www.worldeventtrading.com/api/oembed" + }, { "s": [ "//x\\.com/*", diff --git a/src/utils/providers.original.json b/src/utils/providers.original.json index bb790af..daa9db4 100644 --- a/src/utils/providers.original.json +++ b/src/utils/providers.original.json @@ -243,18 +243,6 @@ } ] }, - { - "provider_name": "Archivos", - "provider_url": "https://app.archivos.digital", - "endpoints": [ - { - "schemes": [ - "https://app.archivos.digital/app/view/*" - ], - "url": "https://app.archivos.digital/oembed/" - } - ] - }, { "provider_name": "AssemblrWorld", "provider_url": "https://assemblrworld.com/", @@ -412,19 +400,6 @@ } ] }, - { - "provider_name": "Beams.fm", - "provider_url": "http://beams.fm", - "endpoints": [ - { - "schemes": [ - "https://beams.fm/*" - ], - "url": "https://api.beams.fm/oEmbed", - "discovery": true - } - ] - }, { "provider_name": "Beautiful.AI", "provider_url": "https://www.beautiful.ai/", @@ -468,15 +443,19 @@ ] }, { - "provider_name": "biqnetwork", - "provider_url": "https://biqapp.com/", + "provider_name": "biqapp", + "provider_url": "https://biqapp.net/", "endpoints": [ { "schemes": [ - "https://cloud.biqapp.com/*" + "https://biqapp.net/f/*", + "https://www.biqapp.net/f/*" ], - "url": "https://biqapp.com/api/v1/video/oembed", - "discovery": true + "url": "https://biqapp.net/api/oembed", + "discovery": true, + "formats": [ + "json" + ] } ] }, @@ -596,18 +575,6 @@ } ] }, - { - "provider_name": "BrioVR", - "provider_url": "https://view.briovr.com/", - "endpoints": [ - { - "schemes": [ - "https://view.briovr.com/api/v1/worlds/oembed/*" - ], - "url": "https://view.briovr.com/api/v1/worlds/oembed/" - } - ] - }, { "provider_name": "Bumper", "provider_url": "http://www.bumper.com", @@ -715,15 +682,16 @@ ] }, { - "provider_name": "Cardinal Blue", - "provider_url": "https://minesweeper.today/", + "provider_name": "Carbon Voice", + "provider_url": "https://carbonvoice.app/", "endpoints": [ { "schemes": [ - "http://minesweeper.today/*", - "https://minesweeper.today/*" + "https://carbonvoice.app/s/*", + "https://carbonvoice.app/m/*", + "https://carbonvoice.app/c/*" ], - "url": "https://minesweeper.today/api/oembed", + "url": "https://carbonvoice.app/api/oembed", "discovery": true } ] @@ -787,17 +755,14 @@ ] }, { - "provider_name": "Chainflix", - "provider_url": "https://chainflix.net", + "provider_name": "ChanceIndex", + "provider_url": "https://chanceindex.com", "endpoints": [ { "schemes": [ - "https://chainflix.net/video/*", - "https://chainflix.net/video/embed/*", - "https://*.chainflix.net/video/*", - "https://*.chainflix.net/video/embed/*" + "https://chanceindex.com/odds/*" ], - "url": "https://www.chainflix.net/video/oembed", + "url": "https://chanceindex.com/api/oembed", "discovery": true } ] @@ -814,19 +779,6 @@ } ] }, - { - "provider_name": "chirbit.com", - "provider_url": "http://www.chirbit.com/", - "endpoints": [ - { - "schemes": [ - "http://chirb.it/*" - ], - "url": "http://chirb.it/oembed.{format}", - "discovery": true - } - ] - }, { "provider_name": "CHROCO", "provider_url": "https://chroco.ooo/", @@ -871,6 +823,22 @@ } ] }, + { + "provider_name": "Clipform", + "provider_url": "https://clipform.io/", + "endpoints": [ + { + "schemes": [ + "https://clipform.io/*" + ], + "url": "https://api.clipform.io/v1/oembed", + "discovery": true, + "formats": [ + "json" + ] + } + ] + }, { "provider_name": "Clipland", "provider_url": "http://www.clipland.com/", @@ -912,19 +880,6 @@ } ] }, - { - "provider_name": "CoCo Corp", - "provider_url": "https://ilovecoco.video", - "endpoints": [ - { - "schemes": [ - "https://app.ilovecoco.video/*/embed" - ], - "url": "https://app.ilovecoco.video/api/oembed.{format}", - "discovery": true - } - ] - }, { "provider_name": "CodeHS", "provider_url": "http://www.codehs.com", @@ -993,6 +948,24 @@ } ] }, + { + "provider_name": "Coloring Monster", + "provider_url": "https://coloringmonster.com", + "endpoints": [ + { + "schemes": [ + "https://coloringmonster.com/coloring-page/*", + "https://coloringmonster.com/monsterpieces/*" + ], + "url": "https://coloringmonster.com/oembed", + "discovery": true, + "formats": [ + "json", + "xml" + ] + } + ] + }, { "provider_name": "Commaful", "provider_url": "https://commaful.com", @@ -1018,18 +991,6 @@ } ] }, - { - "provider_name": "Crowd Ranking", - "provider_url": "http://crowdranking.com", - "endpoints": [ - { - "schemes": [ - "http://crowdranking.com/*/*" - ], - "url": "http://crowdranking.com/api/oembed.{format}" - } - ] - }, { "provider_name": "Crumb.sh", "provider_url": "https://crumb.sh", @@ -1070,18 +1031,6 @@ } ] }, - { - "provider_name": "CustomerDB", - "provider_url": "http://customerdb.com/", - "endpoints": [ - { - "schemes": [ - "https://app.customerdb.com/share/*" - ], - "url": "https://app.customerdb.com/embed" - } - ] - }, { "provider_name": "dadan", "provider_url": "https://www.dadan.io", @@ -1295,18 +1244,15 @@ ] }, { - "provider_name": "EchoesHQ", - "provider_url": "https://echoeshq.com", + "provider_name": "Ecency", + "provider_url": "https://ecency.com/", "endpoints": [ { "schemes": [ - "http://app.echoeshq.com/embed/*" - ], - "url": "https://api.echoeshq.com/oembed", - "formats": [ - "json", - "xml" + "https://ecency.com/@*/*", + "https://ecency.com/*/@*/*" ], + "url": "https://ecency.com/api/oembed", "discovery": true } ] @@ -1433,34 +1379,6 @@ } ] }, - { - "provider_name": "Ex.Co", - "provider_url": "https://ex.co", - "endpoints": [ - { - "schemes": [ - "https://app.ex.co/stories/*", - "https://www.playbuzz.com/*" - ], - "url": "https://oembed.ex.co/item", - "discovery": false - } - ] - }, - { - "provider_name": "Eyrie", - "provider_url": "https://eyrie.io/", - "endpoints": [ - { - "schemes": [ - "https://eyrie.io/board/*", - "https://eyrie.io/sparkfun/*" - ], - "url": "https://eyrie.io/v1/oembed", - "discovery": true - } - ] - }, { "provider_name": "Facebook", "provider_url": "https://www.facebook.com/", @@ -1498,21 +1416,6 @@ } ] }, - { - "provider_name": "Fader", - "provider_url": "https://app.getfader.com", - "endpoints": [ - { - "schemes": [ - "https://app.getfader.com/projects/*/publish" - ], - "url": "https://app.getfader.com/api/oembed", - "formats": [ - "json" - ] - } - ] - }, { "provider_name": "Faithlife TV", "provider_url": "https://faithlifetv.com", @@ -1530,6 +1433,19 @@ } ] }, + { + "provider_name": "FazenHaus", + "provider_url": "https://haus.fazen.co/", + "endpoints": [ + { + "schemes": [ + "https://haus.fazen.co/embed/music/*" + ], + "url": "https://haus.fazen.co/api/oembed", + "discovery": true + } + ] + }, { "provider_name": "Figma", "provider_url": "https://www.figma.com", @@ -1739,47 +1655,19 @@ ] }, { - "provider_name": "Geograph Britain and Ireland", - "provider_url": "https://www.geograph.org.uk/", - "endpoints": [ - { - "schemes": [ - "http://*.geograph.org.uk/*", - "http://*.geograph.co.uk/*", - "http://*.geograph.ie/*", - "http://*.wikimedia.org/*_geograph.org.uk_*" - ], - "url": "http://api.geograph.org.uk/api/oembed" - } - ] - }, - { - "provider_name": "Geograph Channel Islands", - "provider_url": "http://channel-islands.geograph.org/", - "endpoints": [ - { - "schemes": [ - "http://*.geograph.org.gg/*", - "http://*.geograph.org.je/*", - "http://channel-islands.geograph.org/*", - "http://channel-islands.geographs.org/*", - "http://*.channel.geographs.org/*" - ], - "url": "http://www.geograph.org.gg/api/oembed" - } - ] - }, - { - "provider_name": "Geograph Germany", - "provider_url": "http://geo-en.hlipp.de/", + "provider_name": "Fritube", + "provider_url": "https://fritube.ch", "endpoints": [ { "schemes": [ - "http://geo-en.hlipp.de/*", - "http://geo.hlipp.de/*", - "http://germany.geograph.org/*" + "https://fritube.ch/v/*" ], - "url": "http://geo.hlipp.de/restapi.php/api/oembed" + "url": "https://fritube.ch/services/oembed", + "discovery": true, + "formats": [ + "json", + "xml" + ] } ] }, @@ -1910,19 +1798,6 @@ } ] }, - { - "provider_name": "GT Channel", - "provider_url": "https://gtchannel.com", - "endpoints": [ - { - "schemes": [ - "https://gtchannel.com/watch/*" - ], - "url": "https://api.luminery.com/oembed", - "discovery": true - } - ] - }, { "provider_name": "Gumlet", "provider_url": "https://www.gumlet.com/", @@ -1992,19 +1867,6 @@ } ] }, - { - "provider_name": "helenenglish_education", - "provider_url": "https://helenenglish.education/", - "endpoints": [ - { - "schemes": [ - "https://helenenglish.education/widget*" - ], - "url": "https://helenenglish.education/embed", - "discovery": true - } - ] - }, { "provider_name": "Heyzine", "provider_url": "https://heyzine.com", @@ -2088,19 +1950,6 @@ } ] }, - { - "provider_name": "Hopvue", - "provider_url": "https://www.hopvue.com", - "endpoints": [ - { - "schemes": [ - "https://*.hopvue.com/*" - ], - "url": "https://portal.hopvue.com/api/oembed/", - "discovery": true - } - ] - }, { "provider_name": "HuffDuffer", "provider_url": "http://huffduffer.com", @@ -2235,22 +2084,6 @@ } ] }, - { - "provider_name": "Incredible", - "provider_url": "https://incredible.dev", - "endpoints": [ - { - "schemes": [ - "https://incredible.dev/watch/*" - ], - "url": "https://oembed.incredible.dev/oembed", - "discovery": true, - "formats": [ - "json" - ] - } - ] - }, { "provider_name": "Indaco", "provider_url": "https://player.indacolive.com/", @@ -2426,14 +2259,19 @@ ] }, { - "provider_name": "itemis CREATE", - "provider_url": "https://play.itemis.io", + "provider_name": "Jawafdehi", + "provider_url": "https://jawafdehi.org", "endpoints": [ { "schemes": [ - "https://play.itemis.io/*" + "https://jawafdehi.org/case/*" ], - "url": "https://create.storage.api.itemis.io/api/embed" + "url": "https://api.jawafdehi.org/oembed/", + "discovery": true, + "formats": [ + "json", + "xml" + ] } ] }, @@ -2476,20 +2314,18 @@ ] }, { - "provider_name": "KakaoTv", - "provider_url": "https://tv.kakao.com/", + "provider_name": "JustSpin", + "provider_url": "https://www.justspin.cc/", "endpoints": [ { "schemes": [ - "https://tv.kakao.com/channel/*/cliplink/*", - "https://tv.kakao.com/m/channel/*/cliplink/*", - "https://tv.kakao.com/channel/v/*", - "https://tv.kakao.com/channel/*/livelink/*", - "https://tv.kakao.com/m/channel/*/livelink/*", - "https://tv.kakao.com/channel/l/*" + "https://www.justspin.cc/workouts/*" ], - "url": "https://tv.kakao.com/oembed", - "discovery": true + "url": "https://www.justspin.cc/api/oembed", + "discovery": true, + "formats": [ + "json" + ] } ] }, @@ -2505,19 +2341,6 @@ } ] }, - { - "provider_name": "Kidoju", - "provider_url": "https://www.kidoju.com/", - "endpoints": [ - { - "schemes": [ - "https://www.kidoju.com/en/x/*/*", - "https://www.kidoju.com/fr/x/*/*" - ], - "url": "https://www.kidoju.com/api/oembed" - } - ] - }, { "provider_name": "Kirim.Email", "provider_url": "https://kirim.email/", @@ -2559,32 +2382,6 @@ } ] }, - { - "provider_name": "kmdr", - "provider_url": "https://kmdr.sh", - "endpoints": [ - { - "schemes": [ - "https://app.kmdr.sh/h/*", - "https://app.kmdr.sh/history/*" - ], - "url": "https://api.kmdr.sh/services/oembed" - } - ] - }, - { - "provider_name": "Knacki", - "provider_url": "http://jdr.knacki.info", - "endpoints": [ - { - "schemes": [ - "http://jdr.knacki.info/meuh/*", - "https://jdr.knacki.info/meuh/*" - ], - "url": "https://jdr.knacki.info/oembed" - } - ] - }, { "provider_name": "Knowledge Pad", "provider_url": "https://knowledgepad.co/", @@ -2601,16 +2398,20 @@ ] }, { - "provider_name": "Kooapp", - "provider_url": "https://kooapp.com", + "provider_name": "Kommodo", + "provider_url": "https://kommodo.ai/", "endpoints": [ { "schemes": [ - "https://*.kooapp.com/koo/*", - "http://*.kooapp.com/koo/*" + "https://kommodo.ai/recordings/*", + "https://kommodo.ai/guides/*" ], - "url": "https://embed.kooapp.com/services/oembed", - "discovery": true + "url": "https://kommodo.ai/api/oembed", + "discovery": true, + "formats": [ + "json", + "xml" + ] } ] }, @@ -2691,19 +2492,6 @@ } ] }, - { - "provider_name": "LeMans.Pod", - "provider_url": "https://umotion-test.univ-lemans.fr/", - "endpoints": [ - { - "schemes": [ - "https://umotion-test.univ-lemans.fr/video/*" - ], - "url": "https://umotion-test.univ-lemans.fr/oembed", - "discovery": true - } - ] - }, { "provider_name": "Lille.Pod", "provider_url": "https://pod.univ-lille.fr/", @@ -2743,6 +2531,25 @@ } ] }, + { + "provider_name": "LiveCodes", + "provider_url": "https://livecodes.io/", + "endpoints": [ + { + "schemes": [ + "https://livecodes.io/", + "https://livecodes.io/?*", + "https://*.livecodes.io/", + "https://*.livecodes.io/?*" + ], + "url": "https://livecodes.io/oembed", + "discovery": true, + "formats": [ + "json" + ] + } + ] + }, { "provider_name": "Livid", "provider_url": "https://livid.com", @@ -2932,32 +2739,12 @@ ] }, { - "provider_name": "Minerva", - "provider_url": "https://www.minervaknows.com", + "provider_name": "Miro", + "provider_url": "https://miro.com/", "endpoints": [ { "schemes": [ - "https://www.minervaknows.com/featured-recipes/*", - "https://www.minervaknows.com/themes/*", - "https://www.minervaknows.com/themes/*/recipes/*", - "https://app.minervaknows.com/recipes/*", - "https://app.minervaknows.com/recipes/*/follow" - ], - "url": "https://oembed.minervaknows.com", - "formats": [ - "json" - ], - "discovery": true - } - ] - }, - { - "provider_name": "Miro", - "provider_url": "https://miro.com/", - "endpoints": [ - { - "schemes": [ - "https://miro.com/app/board/*" + "https://miro.com/app/board/*" ], "url": "https://miro.com/api/v1/oembed", "discovery": true @@ -3233,15 +3020,23 @@ ] }, { - "provider_name": "NoPaste", - "provider_url": "https://nopaste.ml", + "provider_name": "Nouncify", + "provider_url": "https://nouncify.com/", "endpoints": [ { "schemes": [ - "https://nopaste.ml/*" + "https://nouncify.com/i/*", + "https://nouncify.com/brand/*", + "https://nouncify.com/e/*", + "https://sandbox.nouncify.com/i/*", + "https://sandbox.nouncify.com/brand/*", + "https://sandbox.nouncify.com/e/*" ], - "url": "https://oembed.nopaste.ml", - "discovery": false + "url": "https://nouncify.com/api/oembed", + "formats": [ + "json" + ], + "discovery": true } ] }, @@ -3396,6 +3191,23 @@ } ] }, + { + "provider_name": "Orizn Widgets", + "provider_url": "https://embed.orizn.app", + "endpoints": [ + { + "schemes": [ + "https://embed.orizn.app/frame/*", + "https://embed.orizn.app/widgets/*" + ], + "url": "https://embed.orizn.app/api/oembed", + "discovery": true, + "formats": [ + "json" + ] + } + ] + }, { "provider_name": "Outplayed.tv", "provider_url": "https://outplayed.tv/", @@ -3423,22 +3235,6 @@ } ] }, - { - "provider_name": "OZ", - "provider_url": "https://www.oz.com/", - "endpoints": [ - { - "schemes": [ - "https://www.oz.com/*/video/*" - ], - "url": "https://core.oz.com/oembed", - "formats": [ - "json", - "xml" - ] - } - ] - }, { "provider_name": "Padlet", "provider_url": "https://padlet.com/", @@ -3467,6 +3263,20 @@ } ] }, + { + "provider_name": "Parler", + "provider_url": "https://app.parler.com/", + "endpoints": [ + { + "schemes": [ + "https://app.parler.com/post/*", + "https://app.parler.com/b/*" + ], + "url": "https://app.parler.com/oembed", + "discovery": true + } + ] + }, { "provider_name": "Parta.io", "provider_url": "https://parta.io/", @@ -3509,59 +3319,6 @@ } ] }, - { - "provider_name": "Picturelfy", - "provider_url": "https://www.picturelfy.com/", - "endpoints": [ - { - "schemes": [ - "http://www.picturelfy.com/p/*", - "https://www.picturelfy.com/p/*" - ], - "url": "https://api.picturelfy.com/service/oembed/", - "discovery": false - } - ] - }, - { - "provider_name": "Piggy", - "provider_url": "https://piggy.to", - "endpoints": [ - { - "schemes": [ - "https://piggy.to/@*/*", - "https://piggy.to/view/*" - ], - "url": "https://piggy.to/oembed" - } - ] - }, - { - "provider_name": "Pikasso", - "provider_url": "https://builder.pikasso.xyz", - "endpoints": [ - { - "schemes": [ - "https://*.builder.pikasso.xyz/embed/*" - ], - "url": "https://builder.pikasso.xyz/api/oembed", - "discovery": true, - "formats": [ - "json" - ] - } - ] - }, - { - "provider_name": "PingVP", - "provider_url": "https://www.pingvp.com/", - "endpoints": [ - { - "url": "https://beta.pingvp.com.kpnis.nl/p/oembed.php", - "discovery": true - } - ] - }, { "provider_name": "Pinpoll", "provider_url": "https://www.pinpoll.com/products/tools", @@ -3697,22 +3454,6 @@ } ] }, - { - "provider_name": "Present", - "provider_url": "https://present.do", - "endpoints": [ - { - "schemes": [ - "https://present.do/decks/*" - ], - "url": "https://gateway.cobalt.run/present/decks/oembed", - "discovery": true, - "formats": [ - "json" - ] - } - ] - }, { "provider_name": "Prezi Video", "provider_url": "https://prezi.com/", @@ -3740,6 +3481,25 @@ } ] }, + { + "provider_name": "Pyzia", + "provider_url": "https://www.pyzia.app/", + "endpoints": [ + { + "schemes": [ + "https://www.pyzia.app/dashboard?*", + "https://pyzia.app/dashboard?*", + "https://www.pyzia.app/embed/chart?*", + "https://pyzia.app/embed/chart?*" + ], + "url": "https://www.pyzia.app/api/oembed", + "discovery": true, + "formats": [ + "json" + ] + } + ] + }, { "provider_name": "QTpi", "provider_url": "https://qtpi.gg/", @@ -3809,44 +3569,6 @@ } ] }, - { - "provider_name": "RadioPublic", - "provider_url": "https://radiopublic.com", - "endpoints": [ - { - "schemes": [ - "https://play.radiopublic.com/*", - "https://radiopublic.com/*", - "https://www.radiopublic.com/*", - "http://play.radiopublic.com/*", - "http://radiopublic.com/*", - "http://www.radiopublic.com/*", - "https://*.radiopublic.com/*" - ], - "url": "https://oembed.radiopublic.com/oembed", - "discovery": true - } - ] - }, - { - "provider_name": "Raindrop", - "provider_url": "https://raindrop.io", - "endpoints": [ - { - "schemes": [ - "https://raindrop.io/*", - "https://raindrop.io/*/*", - "https://raindrop.io/*/*/*", - "https://raindrop.io/*/*/*/*" - ], - "url": "https://pub.raindrop.io/api/oembed", - "discovery": true, - "formats": [ - "json" - ] - } - ] - }, { "provider_name": "rcvis", "provider_url": "https://www.rcvis.com/", @@ -3939,6 +3661,22 @@ } ] }, + { + "provider_name": "Risky Business", + "provider_url": "https://risky.biz/", + "endpoints": [ + { + "schemes": [ + "https://risky.biz/*" + ], + "url": "https://risky.biz/oembed", + "discovery": true, + "formats": [ + "json" + ] + } + ] + }, { "provider_name": "Roomshare", "provider_url": "http://roomshare.jp", @@ -3983,15 +3721,34 @@ ] }, { - "provider_name": "Runkit", - "provider_url": "https://runkit.com", + "provider_name": "rushes.cc", + "provider_url": "https://www.rushes.cc", + "endpoints": [ + { + "schemes": [ + "https://www.rushes.cc/video/*", + "https://www.rushes.cc/embed/*", + "https://rushes.cc/video/*", + "https://rushes.cc/embed/*" + ], + "url": "https://api.rushes.cc/oembed", + "discovery": true, + "formats": [ + "json" + ] + } + ] + }, + { + "provider_name": "Sagenverse", + "provider_url": "https://sagenverse.com", "endpoints": [ { "schemes": [ - "http://embed.runkit.com/*,", - "https://embed.runkit.com/*," + "https://app2.sagenverse.com/embed/*" ], - "url": "https://embed.runkit.com/oembed", + "url": "https://app2.sagenverse.com/oembed", + "discovery": true, "formats": [ "json" ] @@ -4061,20 +3818,6 @@ } ] }, - { - "provider_name": "Scenes", - "provider_url": "https://getscenes.com", - "endpoints": [ - { - "schemes": [ - "https://getscenes.com/e/*", - "https://getscenes.com/event/*" - ], - "url": "https://getscenes.com/oembed", - "discovery": true - } - ] - }, { "provider_name": "Screen9", "provider_url": "http://www.screen9.com/", @@ -4171,33 +3914,6 @@ } ] }, - { - "provider_name": "Shopshare", - "provider_url": "https://shopshare.tv", - "endpoints": [ - { - "schemes": [ - "https://shopshare.tv/shopboard/*", - "https://shopshare.tv/shopcast/*" - ], - "url": "https://shopshare.tv/api/shopcast/oembed", - "discovery": true - } - ] - }, - { - "provider_name": "ShortNote", - "provider_url": "https://www.shortnote.jp/", - "endpoints": [ - { - "schemes": [ - "https://www.shortnote.jp/view/notes/*" - ], - "url": "https://www.shortnote.jp/oembed/", - "discovery": true - } - ] - }, { "provider_name": "Shoudio", "provider_url": "http://shoudio.com", @@ -4297,6 +4013,23 @@ } ] }, + { + "provider_name": "Skhema", + "provider_url": "https://skhema.com/", + "endpoints": [ + { + "schemes": [ + "https://skhema.com/embed/e/*", + "https://skhema.com/embed/c/*" + ], + "url": "https://skhema.com/api/oembed", + "discovery": true, + "formats": [ + "json" + ] + } + ] + }, { "provider_name": "Skoletube", "provider_url": "https://www.skoletube.dk/", @@ -4349,19 +4082,6 @@ } ] }, - { - "provider_name": "Smeme", - "provider_url": "https://smeme.com", - "endpoints": [ - { - "schemes": [ - "https://open.smeme.com/*" - ], - "url": "https://open.smeme.com/api/oembed", - "discovery": true - } - ] - }, { "provider_name": "Smrthi", "provider_url": "https://www.smrthi.com", @@ -4592,15 +4312,14 @@ ] }, { - "provider_name": "Subscribi", - "provider_url": "https://subscribi.io/", + "provider_name": "Street Art Cities", + "provider_url": "https://streetartcities.com/", "endpoints": [ { "schemes": [ - "https://subscribi.io/api/oembed*" + "https://streetartcities.com/markers/*" ], - "url": "https://subscribi.io/api/oembed", - "discovery": true + "url": "https://oembed.streetartcities.com/oembed" } ] }, @@ -4678,6 +4397,23 @@ } ] }, + { + "provider_name": "SynthCamp", + "provider_url": "https://synthcamp.net/", + "endpoints": [ + { + "schemes": [ + "https://synthcamp.net/r/*" + ], + "url": "https://synthcamp.net/api/oembed", + "discovery": true, + "formats": [ + "json", + "xml" + ] + } + ] + }, { "provider_name": "Synthesia", "provider_url": "https://www.synthesia.io/", @@ -4715,7 +4451,9 @@ "schemes": [ "http://ted.com/talks/*", "https://ted.com/talks/*", - "https://www.ted.com/talks/*" + "http://www.ted.com/talks/*", + "https://www.ted.com/talks/*", + "https://embed.ted.com/talks/*" ], "url": "https://www.ted.com/services/v1/oembed.{format}", "discovery": true @@ -4736,6 +4474,22 @@ } ] }, + { + "provider_name": "TextExpander", + "provider_url": "https://textexpander.com", + "endpoints": [ + { + "schemes": [ + "https://rest-prod.tenet.textexpander.com/share/*" + ], + "url": "https://rest-prod.tenet.textexpander.com/oembed", + "discovery": true, + "formats": [ + "json" + ] + } + ] + }, { "provider_name": "The DAM consultants", "provider_url": "https://hubspot-media-bridge.thedamconsultants.com/", @@ -4832,6 +4586,19 @@ } ] }, + { + "provider_name": "TLexDR", + "provider_url": "https://tlexdr.com/", + "endpoints": [ + { + "schemes": [ + "https://tlexdr.com/episode/*" + ], + "url": "https://tlexdr.com/oembed", + "discovery": true + } + ] + }, { "provider_name": "Tonic Audio", "provider_url": "https://tonicaudio.com/", @@ -5114,26 +4881,6 @@ } ] }, - { - "provider_name": "VeeR VR", - "provider_url": "http://veer.tv/", - "endpoints": [ - { - "schemes": [ - "http://veer.tv/videos/*" - ], - "url": "https://api.veer.tv/oembed", - "discovery": true - }, - { - "schemes": [ - "http://veervr.tv/videos/*" - ], - "url": "https://api.veervr.tv/oembed", - "discovery": true - } - ] - }, { "provider_name": "VEVO", "provider_url": "http://www.vevo.com/", @@ -5161,6 +4908,23 @@ } ] }, + { + "provider_name": "VidLink", + "provider_url": "https://vidlink.it", + "endpoints": [ + { + "schemes": [ + "https://vidlink.it/videos/*", + "https://www.vidlink.it/videos/*" + ], + "url": "https://www.vidlink.it/api/oembed", + "discovery": true, + "formats": [ + "json" + ] + } + ] + }, { "provider_name": "VidMount", "provider_url": "https://vidmount.com/", @@ -5260,18 +5024,6 @@ } ] }, - { - "provider_name": "Vizydrop", - "provider_url": "https://vizydrop.com", - "endpoints": [ - { - "schemes": [ - "https://vizydrop.com/shared/*" - ], - "url": "https://vizydrop.com/oembed" - } - ] - }, { "provider_name": "Vlipsy", "provider_url": "https://vlipsy.com/", @@ -5372,31 +5124,28 @@ ] }, { - "provider_name": "Webcrumbs", - "provider_url": "https://webcrumbs.org/", + "provider_name": "wecandeo", + "provider_url": "https://www.wecandeo.com/", "endpoints": [ { "schemes": [ - "https://plugins.webcrumbs.dev/*" - ], - "url": "https://webcrumbs.dev/oembed", - "formats": [ - "json", - "xml" + "https://play.wecandeo.com/video/v/*" ], + "url": "https://play.wecandeo.com/oembed/", "discovery": true } ] }, { - "provider_name": "wecandeo", - "provider_url": "https://www.wecandeo.com/", + "provider_name": "Wewtalk", + "provider_url": "https://www.wewtalk.com/", "endpoints": [ { "schemes": [ - "https://play.wecandeo.com/video/v/*" + "https://www.wewtalk.com/voice/*", + "https://wewtalk.com/voice/*" ], - "url": "https://play.wecandeo.com/oembed/", + "url": "https://www.wewtalk.com/api/oembed", "discovery": true } ] @@ -5423,7 +5172,8 @@ "schemes": [ "https://fast.wistia.com/embed/iframe/*", "https://fast.wistia.com/embed/playlists/*", - "https://*.wistia.com/medias/*" + "https://*.wistia.com/medias/*", + "https://*.wistia.com/s/*" ], "url": "https://fast.wistia.com/oembed.{format}", "discovery": true @@ -5493,6 +5243,20 @@ } ] }, + { + "provider_name": "World Event Trading", + "provider_url": "https://www.worldeventtrading.com/", + "endpoints": [ + { + "schemes": [ + "https://worldeventtrading.com/predictions/*", + "https://www.worldeventtrading.com/predictions/*" + ], + "url": "https://www.worldeventtrading.com/api/oembed", + "discovery": true + } + ] + }, { "provider_name": "X", "provider_url": "http://www.x.com/", diff --git a/src/utils/providers.prev.js b/src/utils/providers.prev.js index d584b17..513d042 100644 --- a/src/utils/providers.prev.js +++ b/src/utils/providers.prev.js @@ -1,4 +1,4 @@ -// provider data, synchronized at 2026-05-03T05:39:11.041Z +// provider data, synchronized at 2026-05-03T06:03:25.358Z /* eslint-disable */ diff --git a/src/utils/retrieve.js b/src/utils/retrieve.js index d4b9e78..373a4bd 100644 --- a/src/utils/retrieve.js +++ b/src/utils/retrieve.js @@ -28,7 +28,7 @@ const profetch = async (url, options = {}) => { * Fetch a URL and return the response body as text. * * @param {string} url - URL to fetch - * @param {object} [options={}] - Fetch options (headers, proxy, agent, signal) + * @param {object} [options={}] - Fetch options (headers, proxy, signal) * @returns {Promise} Response body as text * @throws {Error} If HTTP status is 400 or higher */ @@ -38,11 +38,10 @@ export const getHtml = async (url, options = {}) => { 'user-agent': 'Mozilla/5.0 (X11; Linux x86_64; rv:109.0) Gecko/20100101 Firefox/115.0', }, proxy = null, - agent = null, signal = null, } = options - const res = proxy ? await profetch(url, { proxy, signal }) : await fetch(url, { headers, agent, signal }) + const res = proxy ? await profetch(url, { proxy, signal }) : await fetch(url, { headers, signal }) const status = res.status if (status >= 400) { @@ -57,7 +56,7 @@ export const getHtml = async (url, options = {}) => { * Fetch a URL and parse the response body as JSON. * * @param {string} url - URL to fetch - * @param {object} [options={}] - Fetch options (headers, proxy, agent, signal) + * @param {object} [options={}] - Fetch options (headers, proxy, signal) * @returns {Promise} Parsed JSON response * @throws {Error} If HTTP status is 400+ or response is not valid JSON */ @@ -67,11 +66,10 @@ export const getJson = async (url, options = {}) => { 'user-agent': 'Mozilla/5.0 (X11; Linux x86_64; rv:109.0) Gecko/20100101 Firefox/115.0', }, proxy = null, - agent = null, signal = null, } = options - const res = proxy ? await profetch(url, { proxy, signal }) : await fetch(url, { headers, agent, signal }) + const res = proxy ? await profetch(url, { proxy, signal }) : await fetch(url, { headers, signal }) const status = res.status if (status >= 400) { From 62f5dd8ad4fd9bb56100b974fbcfbf3d50c05ea1 Mon Sep 17 00:00:00 2001 From: Dong Nguyen Date: Wed, 22 Jul 2026 16:19:24 +0700 Subject: [PATCH 2/3] v5.0.0 - Change custom proxy approach Related issue: #195 --- README.md | 86 +++++++++++++++------------------ index.d.ts | 26 ++-------- package.json | 2 +- src/main.js | 8 +-- src/utils/autoDiscovery.js | 8 +-- src/utils/autoDiscovery.test.js | 2 +- src/utils/fetchEmbed.js | 6 +-- src/utils/fetchEmbed.test.js | 2 +- src/utils/retrieve.js | 52 +++----------------- src/utils/retrieve.test.js | 69 ++++++++++++-------------- 10 files changed, 94 insertions(+), 167 deletions(-) diff --git a/README.md b/README.md index f391a93..65cd7c6 100644 --- a/README.md +++ b/README.md @@ -53,7 +53,7 @@ Load and extract oembed data. ```ts extract(String url) extract(String url, Object params) -extract(String url, Object params, Object fetchOptions) +extract(String url, Object params, Function fetcher) ``` #### Parameters @@ -76,82 +76,74 @@ Here are several popular params: Note that some params are supported by these providers but not by the others. Please see the provider's oEmbed API docs carefully for exact information. -##### `fetchOptions` *optional* +##### `fetcher` *optional* -`fetchOptions` is an object that can have the following properties: +A custom fetch function with the signature `(url: string) => Promise`. +Use this to customize HTTP behavior: proxy, headers, TLS, authentication, timeouts, etc. -- `headers`: to set request headers -- `proxy`: another endpoint to forward the request to -- `signal`: AbortController signal or AbortSignal timeout to terminate the request +Defaults to `globalThis.fetch`. -You can use this param to set request headers to fetch. - -For example: +**Node.js** (with proxy via undici): ```js import { extract } from '@extractus/oembed-extractor' +import { fetch, ProxyAgent } from 'undici' -const url = 'https://codepen.io/ndaidong/pen/LYmLKBw' -extract(url, null, { - headers: { - 'user-agent': 'Opera/9.60 (Windows NT 6.0; U; en) Presto/2.1.1' - } -}) +const dispatcher = new ProxyAgent('http://proxy.example.com:8080') +const myFetcher = (url) => fetch(url, { dispatcher }) + +const result = await extract('https://www.youtube.com/watch?v=x2bqscVkGxk', {}, myFetcher) ``` -You can also specify a proxy endpoint to load remote content, instead of fetching directly. - -For example: +**Bun** (with proxy): ```js import { extract } from '@extractus/oembed-extractor' -const url = 'https://codepen.io/ndaidong/pen/LYmLKBw' -extract(url, null, { - headers: { - 'user-agent': 'Opera/9.60 (Windows NT 6.0; U; en) Presto/2.1.1' - }, +const myFetcher = (url) => fetch(url, { proxy: { - target: 'https://your-secret-proxy.io/loadJson?url=', - headers: { - 'Proxy-Authorization': 'Bearer YWxhZGRpbjpvcGVuc2VzYW1l...' - } - } + url: 'http://proxy.example.com:8080', + }, }) + +const result = await extract('https://www.youtube.com/watch?v=x2bqscVkGxk', {}, myFetcher) ``` -With the above setting, request will be forwarded to `https://your-secret-proxy.io/loadJson?url={OEMBED_ENDPOINT}`. +**Deno** (with proxy): -By default, there is no request timeout. You can use the option `signal` to cancel request at the right time. +```js +import { extract } from 'npm:@extractus/oembed-extractor' -The common way is to use AbortControler: +const client = Deno.createHttpClient({ + proxy: { url: 'http://localhost:8080' }, +}) +const myFetcher = (url) => fetch(url, { client }) -```js -const controller = new AbortController() +const result = await extract('https://www.youtube.com/watch?v=x2bqscVkGxk', {}, myFetcher) +``` -// stop after 5 seconds -setTimeout(() => { - controller.abort() -}, 5000) +**Custom headers**: -const oembed = await extract(url, null, { - signal: controller.signal, +```js +const myFetcher = (url) => fetch(url, { + headers: { + 'user-agent': 'MyBot/1.0', + 'authorization': 'Bearer token123', + }, }) + +const result = await extract(url, {}, myFetcher) ``` -A newer solution is AbortSignal's `timeout()` static method: +**Request timeout**: ```js -// stop after 5 seconds -const oembed = await extract(url, null, { +const myFetcher = (url) => fetch(url, { signal: AbortSignal.timeout(5000), }) -``` - -For more info: -- [AbortController constructor](https://developer.mozilla.org/en-US/docs/Web/API/AbortController) -- [AbortSignal: timeout() static method](https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal/timeout_static) +const result = await extract(url, {}, myFetcher) +``` ### `.setProviderList()` diff --git a/index.d.ts b/index.d.ts index b6591bc..232fee7 100644 --- a/index.d.ts +++ b/index.d.ts @@ -135,36 +135,20 @@ export interface Params { } /** - * Configuration for proxy-based requests. + * Custom fetch function. Receives a URL and returns a Response promise. + * Use this to customize HTTP behavior (proxy, headers, TLS, etc.). */ -export interface ProxyConfig { - /** Base URL of the proxy server */ - target?: string - /** Headers to send to the proxy (e.g. Proxy-Authorization) */ - headers?: Record -} - -/** - * Advanced fetch options for extract(). - */ -export interface FetchOptions { - /** Custom request headers */ - headers?: Record - /** Proxy configuration */ - proxy?: ProxyConfig - /** AbortSignal to cancel the request */ - signal?: AbortSignal -} +export type Fetcher = (url: string) => Promise /** * Extract oEmbed data from a given URL. * * @param url - URL of a valid oEmbed resource * @param params - Optional parameters (maxwidth, maxheight, etc.) - * @param fetchOptions - Advanced fetch options (headers, proxy, signal) + * @param fetcher - Custom fetch function. Defaults to globalThis.fetch. * @returns Promise resolving to oEmbed data */ -export function extract(url: string, params?: Params, fetchOptions?: FetchOptions): Promise +export function extract(url: string, params?: Params, fetcher?: Fetcher): Promise /** * Check if a URL is supported by any registered provider. diff --git a/package.json b/package.json index ab8838a..183d05d 100644 --- a/package.json +++ b/package.json @@ -1,5 +1,5 @@ { - "version": "4.2.0", + "version": "5.0.0", "name": "@extractus/oembed-extractor", "description": "Get oEmbed data from given URL.", "homepage": "https://github.com/extractus/oembed-extractor", diff --git a/src/main.js b/src/main.js index 0a0ce9b..a8341ae 100644 --- a/src/main.js +++ b/src/main.js @@ -11,19 +11,19 @@ import { getEndpoint } from './utils/provider.js' * * @param {string} url - URL of a valid oEmbed resource * @param {object} [params] - Optional parameters (maxwidth, maxheight, theme, lang, etc.) - * @param {object} [options] - Fetch options (headers, proxy, agent, signal) + * @param {Function} [fetcher] - Custom fetch function (url) => Promise. Defaults to globalThis.fetch. * @returns {Promise} oEmbed data object * @throws {Error} If URL is invalid */ -export const extract = async (url, params = {}, options = {}) => { +export const extract = async (url, params = {}, fetcher = globalThis.fetch) => { if (!isValidURL(url)) { throw new Error('Invalid input URL') } const endpoint = getEndpoint(url) return endpoint - ? fetchEmbed(url, params, endpoint, options) - : extractWithDiscovery(url, params, options) + ? fetchEmbed(url, params, endpoint, fetcher) + : extractWithDiscovery(url, params, fetcher) } export { diff --git a/src/utils/autoDiscovery.js b/src/utils/autoDiscovery.js index 3790917..1f78524 100644 --- a/src/utils/autoDiscovery.js +++ b/src/utils/autoDiscovery.js @@ -10,12 +10,12 @@ import { getHtml, getJson } from './retrieve.js' * * @param {string} url - Resource URL to discover oEmbed for * @param {object} [params={}] - Additional oEmbed query parameters - * @param {object} [options={}] - Fetch options (headers, proxy, agent, signal) + * @param {Function} fetcher - Custom fetch function (url) => Promise * @returns {Promise} oEmbed response data * @throws {Error} If no oEmbed link tag is found in the HTML */ -export default async (url, params = {}, options = {}) => { - const html = await getHtml(url, options) +export default async (url, params = {}, fetcher) => { + const html = await getHtml(url, fetcher) const doc = new DOMParser().parseFromString(html, 'text/html') const elm = doc.querySelector('link[type="application/json+oembed"]') if (!elm) { @@ -30,7 +30,7 @@ export default async (url, params = {}, options = {}) => { } }) const link = `${origin}${pathname}?${searchParams.toString()}` - const body = await getJson(link, options) + const body = await getJson(link, fetcher) body.method = 'auto-discovery' return body } diff --git a/src/utils/autoDiscovery.test.js b/src/utils/autoDiscovery.test.js index ba2178d..86459f3 100644 --- a/src/utils/autoDiscovery.test.js +++ b/src/utils/autoDiscovery.test.js @@ -48,7 +48,7 @@ describe('test if autoDiscovery() works correctly', () => { 'Content-Type': 'application/json', }) - const result = await autoDiscovery(url, params) + const result = await autoDiscovery(url, params, globalThis.fetch) assert.ok(result) nock.cleanAll() }) diff --git a/src/utils/fetchEmbed.js b/src/utils/fetchEmbed.js index cb6e56a..0679430 100644 --- a/src/utils/fetchEmbed.js +++ b/src/utils/fetchEmbed.js @@ -31,10 +31,10 @@ const getFacebookGraphToken = () => { * @param {string} url - Original resource URL * @param {object} [params={}] - oEmbed parameters (maxwidth, maxheight, etc.) * @param {string} [endpoint=''] - Provider oEmbed API endpoint - * @param {object} [options={}] - Fetch options (headers, proxy, agent, signal) + * @param {Function} fetcher - Custom fetch function (url) => Promise * @returns {Promise} oEmbed response data */ -export default async (url, params = {}, endpoint = '', options = {}) => { // eslint-disable-line +export default async (url, params = {}, endpoint = '', fetcher) => { // eslint-disable-line const query = { url, format: 'json', @@ -54,7 +54,7 @@ export default async (url, params = {}, endpoint = '', options = {}) => { // esl const queryParams = new URLSearchParams(query).toString() const link = endpoint + '?' + queryParams - const body = await getJson(link, options) + const body = await getJson(link, fetcher) body.method = 'provider-api' return body } diff --git a/src/utils/fetchEmbed.test.js b/src/utils/fetchEmbed.test.js index 86d39d4..1407144 100644 --- a/src/utils/fetchEmbed.test.js +++ b/src/utils/fetchEmbed.test.js @@ -114,7 +114,7 @@ describe('test if fetchEmbed() works correctly', () => { maxheight = 0, } = params - const result = await fetchEmbed(url, { maxwidth, maxheight }, endpoint) + const result = await fetchEmbed(url, { maxwidth, maxheight }, endpoint, globalThis.fetch) assert.ok(result) assert.equal(result.provider_name, expected.provider_name) assert.equal(result.type, expected.type) diff --git a/src/utils/retrieve.js b/src/utils/retrieve.js index 373a4bd..d42d217 100644 --- a/src/utils/retrieve.js +++ b/src/utils/retrieve.js @@ -1,47 +1,15 @@ // utils -> retrieve -/** - * Fetch a resource through a proxy endpoint. - * - * @param {string} url - Target URL to fetch - * @param {object} [options={}] - Options containing proxy config and signal - * @param {object} [options.proxy] - Proxy configuration - * @param {string} options.proxy.target - Proxy base URL - * @param {object} [options.proxy.headers] - Headers to send to the proxy - * @param {object} [options.signal] - AbortSignal for request cancellation - * @returns {Promise} Fetch response object - */ -const profetch = async (url, options = {}) => { - const { proxy = {}, signal = null } = options - const { - target, - headers = {}, - } = proxy - const res = await fetch(target + encodeURIComponent(url), { - headers, - signal, - }) - return res -} - /** * Fetch a URL and return the response body as text. * * @param {string} url - URL to fetch - * @param {object} [options={}] - Fetch options (headers, proxy, signal) + * @param {Function} fetcher - Custom fetch function (url) => Promise * @returns {Promise} Response body as text * @throws {Error} If HTTP status is 400 or higher */ -export const getHtml = async (url, options = {}) => { - const { - headers = { - 'user-agent': 'Mozilla/5.0 (X11; Linux x86_64; rv:109.0) Gecko/20100101 Firefox/115.0', - }, - proxy = null, - signal = null, - } = options - - const res = proxy ? await profetch(url, { proxy, signal }) : await fetch(url, { headers, signal }) +export const getHtml = async (url, fetcher) => { + const res = await fetcher(url) const status = res.status if (status >= 400) { @@ -56,20 +24,12 @@ export const getHtml = async (url, options = {}) => { * Fetch a URL and parse the response body as JSON. * * @param {string} url - URL to fetch - * @param {object} [options={}] - Fetch options (headers, proxy, signal) + * @param {Function} fetcher - Custom fetch function (url) => Promise * @returns {Promise} Parsed JSON response * @throws {Error} If HTTP status is 400+ or response is not valid JSON */ -export const getJson = async (url, options = {}) => { - const { - headers = { - 'user-agent': 'Mozilla/5.0 (X11; Linux x86_64; rv:109.0) Gecko/20100101 Firefox/115.0', - }, - proxy = null, - signal = null, - } = options - - const res = proxy ? await profetch(url, { proxy, signal }) : await fetch(url, { headers, signal }) +export const getJson = async (url, fetcher) => { + const res = await fetcher(url) const status = res.status if (status >= 400) { diff --git a/src/utils/retrieve.test.js b/src/utils/retrieve.test.js index e312157..f4a9368 100644 --- a/src/utils/retrieve.test.js +++ b/src/utils/retrieve.test.js @@ -3,60 +3,51 @@ import { describe, it } from 'node:test' import assert from 'node:assert' -import nock from 'nock' - import { getJson } from './retrieve.js' -const parseUrl = (url) => { - const re = new URL(url) - return { - baseUrl: `${re.protocol}//${re.host}`, - path: re.pathname, +const mockFetch = (data) => { + return async () => { + return new Response(JSON.stringify(data), { + status: 200, + headers: { 'content-type': 'application/json' }, + }) } } describe('test getJson() method', () => { - it('test getJson from good source', async () => { - const url = 'https://some.where/good/source' - const { baseUrl, path } = parseUrl(url) - nock(baseUrl).get(path).reply(200, { data: { name: 'oembed-parser' } }, { - 'Content-Type': 'application/json', - }) - const result = await getJson(url) + it('test getJson with custom fetcher', async () => { + const fetcher = mockFetch({ data: { name: 'oembed-parser' } }) + const result = await getJson('https://some.where/good/source', fetcher) assert.equal(result.data.name, 'oembed-parser') - nock.cleanAll() }) - it('test getJson using proxy', async () => { - const url = 'https://some.where/good/source-with-proxy' - const { baseUrl, path } = parseUrl(url) - nock(baseUrl).get(path).reply(200, { data: { name: 'oembed-parser' } }, { - 'Content-Type': 'application/json', - }) - nock('https://proxy-server.com') - .get('/api/proxy?url=https%3A%2F%2Fsome.where%2Fgood%2Fsource-with-proxy') - .reply(200, { data: { name: 'oembed-parser' } }) - - const result = await getJson(url, { - proxy: { - target: 'https://proxy-server.com/api/proxy?url=', - }, - }) + it('test getJson with proxy fetcher', async () => { + const fetcher = async (url) => { + assert.ok(url.includes('proxy-server.com')) + return new Response(JSON.stringify({ data: { name: 'oembed-parser' } }), { + status: 200, + headers: { 'content-type': 'application/json' }, + }) + } + const proxyFetcher = async (url) => { + const proxyTarget = 'https://proxy-server.com/api/proxy?url=' + return fetcher(proxyTarget + encodeURIComponent(url)) + } + const result = await getJson('https://some.where/good/source', proxyFetcher) assert.equal(result.data.name, 'oembed-parser') - nock.cleanAll() }) - it('test getJson invalid json reponsse', async () => { - const url = 'https://some.where/bad/source' - const { baseUrl, path } = parseUrl(url) - nock(baseUrl).get(path).reply(200, 'this is not json string', { - 'Content-Type': 'application/json', - }) + it('test getJson invalid json response', async () => { + const fetcher = async () => { + return new Response('this is not json string', { + status: 200, + headers: { 'content-type': 'application/json' }, + }) + } try { - await getJson(url) + await getJson('https://some.where/bad/source', fetcher) } catch (err) { assert.ok(err) } - nock.cleanAll() }) }) From 91b908877b57fc0e8229d6247ae83ce282b35a1d Mon Sep 17 00:00:00 2001 From: Dong Nguyen Date: Wed, 22 Jul 2026 16:30:10 +0700 Subject: [PATCH 3/3] Fix url test --- src/utils/retrieve.test.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/utils/retrieve.test.js b/src/utils/retrieve.test.js index f4a9368..7eaef07 100644 --- a/src/utils/retrieve.test.js +++ b/src/utils/retrieve.test.js @@ -23,7 +23,8 @@ describe('test getJson() method', () => { it('test getJson with proxy fetcher', async () => { const fetcher = async (url) => { - assert.ok(url.includes('proxy-server.com')) + const { hostname } = new URL(url) + assert.equal(hostname, 'proxy-server.com') return new Response(JSON.stringify({ data: { name: 'oembed-parser' } }), { status: 200, headers: { 'content-type': 'application/json' },