Skip to content

Commit

Permalink
Merge pull request #144 from ndaidong/3.0.6
Browse files Browse the repository at this point in the history
v3.0.6
  • Loading branch information
ndaidong authored Jul 4, 2022
2 parents 980e5ef + e591852 commit 9701b53
Show file tree
Hide file tree
Showing 9 changed files with 329 additions and 22 deletions.
18 changes: 8 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ Extract oEmbed content from given URL.
## Demo

- [Give it a try!](https://demos.pwshub.com/oembed-parser)
- [Example FaaS](https://extractor.pwshub.com/oembed/parse?url=https://www.youtube.com/watch?v=8jPQjjsBbIc&apikey=demo-orePhhidnWKWPvF8EYKap7z55cN)
- [Example FaaS](https://extractor.pwshub.com/oembed/parse?url=https://www.instagram.com/tv/CVlR5GFqF68/&apikey=demo-TEyRycuuMCiGBiBocbLGSpagfj7gOF8AMyAWfEgP)


## Setup
Expand Down Expand Up @@ -169,7 +169,7 @@ Default option:
```js
{
headers: {
'user-agent': 'Mozilla/5.0 (X11; Linux x86_64; rv:95.0) Gecko/20100101 Firefox/95.0',
'user-agent': 'Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Firefox/102.0',
accept: 'application/json; charset=utf-8'
},
responseType: 'json',
Expand All @@ -182,20 +182,18 @@ Default option:

## Facebook and Instagram

Since October 24 2020, Facebook have deprecated their legacy urls and applied a new Facebook oEmbed endpoints.
In order to work with the links from Facebook and Instagram, you need a [reviewed Facebook's app](https://developers.facebook.com/docs/app-review) with [oEmbed Read](https://developers.facebook.com/docs/features-reference/oembed-read) permission.

Technically, now we have to use Facebook Graph API, with the access token from a valid and live Facebook app. `oembed-parser` will try to get these values from environment variables, so please define them, for example:
When seeing a link from Facebook or Instagram, `oembed-parser` will look for environment variables `FACEBOOK_APP_ID` and `FACEBOOK_CLIENT_TOKEN` to retrieve oembed data using your app credentials.

For example:

```bash
export FACEBOOK_APP_ID=your_app_id
export FACEBOOK_CLIENT_TOKEN=your_client_token
```

References:

- [oEmbed Read](https://developers.facebook.com/docs/features-reference/oembed-read)
- [Facebook oEmbed](https://developers.facebook.com/docs/plugins/oembed)
- [Facebook Graph API](https://developers.facebook.com/docs/graph-api/overview)
npm run eval https://www.instagram.com/tv/CVlR5GFqF68/
```

## Test

Expand Down
107 changes: 105 additions & 2 deletions dist/cjs/oembed-parser.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
"use strict";
// [email protected].5, by @ndaidong - built with esbuild at 2022-06-23T07:21:16.535Z - published under MIT license
// [email protected].6, by @ndaidong - built with esbuild at 2022-07-04T04:41:14.012Z - published under MIT license
var __create = Object.create;
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
Expand Down Expand Up @@ -12600,7 +12600,7 @@ var import_axios = __toESM(require_axios2(), 1);
var import_bellajs = __toESM(require_bella(), 1);
var requestOptions = {
headers: {
"user-agent": "Mozilla/5.0 (X11; Linux i686; rv:100.0) Gecko/20100101 Firefox/100.0",
"user-agent": "Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Firefox/102.0",
accept: "application/json; charset=utf-8"
},
responseType: "json",
Expand Down Expand Up @@ -13143,6 +13143,20 @@ var providers = [
}
]
},
{
"provider_name": "Cardinal Blue",
"provider_url": "https://minesweeper.today/",
"endpoints": [
{
"schemes": [
"http://minesweeper.today/*",
"https://minesweeper.today/*"
],
"url": "https://minesweeper.today/api/oembed",
"discovery": true
}
]
},
{
"provider_name": "Catapult",
"provider_url": "https://www.catapult.app/",
Expand Down Expand Up @@ -14162,6 +14176,21 @@ var providers = [
}
]
},
{
"provider_name": "Heyzine",
"provider_url": "https://heyzine.com",
"endpoints": [
{
"schemes": [
"https://heyzine.com/flip-book/*",
"https://*.hflip.co/*",
"https://*.aflip.in/*"
],
"url": "https://heyzine.com/api1/oembed",
"discovery": true
}
]
},
{
"provider_name": "hihaho",
"provider_url": "https://www.hihaho.com",
Expand Down Expand Up @@ -14283,6 +14312,23 @@ var providers = [
}
]
},
{
"provider_name": "iMenuPro",
"provider_url": "https://imenupro.com",
"endpoints": [
{
"schemes": [
"http://qr.imenupro.com/*",
"https://qr.imenupro.com/*"
],
"url": "https://qr.imenupro.com/api/oembed",
"formats": [
"json"
],
"discovery": true
}
]
},
{
"provider_name": "Incredible",
"provider_url": "https://incredible.dev",
Expand Down Expand Up @@ -14643,6 +14689,18 @@ var providers = [
}
]
},
{
"provider_name": "Line Place",
"provider_url": "https://place.line.me",
"endpoints": [
{
"schemes": [
"https://place.line.me/businesses/*"
],
"url": "https://place.line.me/oembed"
}
]
},
{
"provider_name": "Livestream",
"provider_url": "https://livestream.com/",
Expand Down Expand Up @@ -15218,6 +15276,20 @@ var providers = [
}
]
},
{
"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": "PingVP",
"provider_url": "https://www.pingvp.com/",
Expand Down Expand Up @@ -15289,6 +15361,24 @@ var providers = [
}
]
},
{
"provider_name": "Plusdocs",
"provider_url": "http://plusdocs.com",
"endpoints": [
{
"schemes": [
"https://app.plusdocs.com/*/snapshots/*",
"https://app.plusdocs.com/*/pages/edit/*",
"https://app.plusdocs.com/*/pages/share/*"
],
"url": "https://app.plusdocs.com/oembed",
"discovery": true,
"formats": [
"json"
]
}
]
},
{
"provider_name": "Podbean",
"provider_url": "http://podbean.com",
Expand Down Expand Up @@ -15752,6 +15842,19 @@ var providers = [
}
]
},
{
"provider_name": "Slate App",
"provider_url": "https://slateapp.com",
"endpoints": [
{
"schemes": [
"https://*.slateapp.com/work/*"
],
"url": "https://*.slateapp.com/api/v2/oembed",
"discovery": true
}
]
},
{
"provider_name": "SlideShare",
"provider_url": "http://www.slideshare.net/",
Expand Down
2 changes: 1 addition & 1 deletion dist/cjs/package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "oembed-parser-cjs",
"version": "3.0.5",
"version": "3.0.6",
"main": "./oembed-parser.js"
}
105 changes: 104 additions & 1 deletion dist/cjs/providers.latest.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// provider data, synchronized at 2022-05-23T15:07:41.370Z
// provider data, synchronized at 2022-07-04T04:38:20.547Z

/* eslint-disable */

Expand Down Expand Up @@ -445,6 +445,20 @@ export const providers = [
}
]
},
{
"provider_name": "Cardinal Blue",
"provider_url": "https://minesweeper.today/",
"endpoints": [
{
"schemes": [
"http://minesweeper.today/*",
"https://minesweeper.today/*"
],
"url": "https://minesweeper.today/api/oembed",
"discovery": true
}
]
},
{
"provider_name": "Catapult",
"provider_url": "https://www.catapult.app/",
Expand Down Expand Up @@ -1464,6 +1478,21 @@ export const providers = [
}
]
},
{
"provider_name": "Heyzine",
"provider_url": "https://heyzine.com",
"endpoints": [
{
"schemes": [
"https://heyzine.com/flip-book/*",
"https://*.hflip.co/*",
"https://*.aflip.in/*"
],
"url": "https://heyzine.com/api1/oembed",
"discovery": true
}
]
},
{
"provider_name": "hihaho",
"provider_url": "https://www.hihaho.com",
Expand Down Expand Up @@ -1585,6 +1614,23 @@ export const providers = [
}
]
},
{
"provider_name": "iMenuPro",
"provider_url": "https://imenupro.com",
"endpoints": [
{
"schemes": [
"http://qr.imenupro.com/*",
"https://qr.imenupro.com/*"
],
"url": "https://qr.imenupro.com/api/oembed",
"formats": [
"json"
],
"discovery": true
}
]
},
{
"provider_name": "Incredible",
"provider_url": "https://incredible.dev",
Expand Down Expand Up @@ -1945,6 +1991,18 @@ export const providers = [
}
]
},
{
"provider_name": "Line Place",
"provider_url": "https://place.line.me",
"endpoints": [
{
"schemes": [
"https://place.line.me/businesses/*"
],
"url": "https://place.line.me/oembed"
}
]
},
{
"provider_name": "Livestream",
"provider_url": "https://livestream.com/",
Expand Down Expand Up @@ -2520,6 +2578,20 @@ export const providers = [
}
]
},
{
"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": "PingVP",
"provider_url": "https://www.pingvp.com/",
Expand Down Expand Up @@ -2591,6 +2663,24 @@ export const providers = [
}
]
},
{
"provider_name": "Plusdocs",
"provider_url": "http://plusdocs.com",
"endpoints": [
{
"schemes": [
"https://app.plusdocs.com/*/snapshots/*",
"https://app.plusdocs.com/*/pages/edit/*",
"https://app.plusdocs.com/*/pages/share/*"
],
"url": "https://app.plusdocs.com/oembed",
"discovery": true,
"formats": [
"json"
]
}
]
},
{
"provider_name": "Podbean",
"provider_url": "http://podbean.com",
Expand Down Expand Up @@ -3054,6 +3144,19 @@ export const providers = [
}
]
},
{
"provider_name": "Slate App",
"provider_url": "https://slateapp.com",
"endpoints": [
{
"schemes": [
"https://*.slateapp.com/work/*"
],
"url": "https://*.slateapp.com/api/v2/oembed",
"discovery": true
}
]
},
{
"provider_name": "SlideShare",
"provider_url": "http://www.slideshare.net/",
Expand Down
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version": "3.0.5",
"version": "3.0.6",
"name": "oembed-parser",
"description": "Get oEmbed data from given URL.",
"homepage": "https://www.npmjs.com/package/oembed-parser",
Expand Down Expand Up @@ -38,9 +38,9 @@
]
},
"devDependencies": {
"esbuild": "^0.14.47",
"jest": "^28.1.1",
"nock": "^13.2.7"
"esbuild": "^0.14.48",
"jest": "^28.1.2",
"nock": "^13.2.8"
},
"keywords": [
"oembed",
Expand Down
Loading

0 comments on commit 9701b53

Please sign in to comment.