Skip to content

Commit

Permalink
v3.1.0rc1
Browse files Browse the repository at this point in the history
- Refactor some parts to run on deno/bun
- Remove some rarely used configuration methods
- Sync to last provider list
- Update dependencies
  • Loading branch information
ndaidong committed Sep 18, 2022
1 parent 44fba5f commit 652a1c9
Show file tree
Hide file tree
Showing 22 changed files with 2,848 additions and 17,092 deletions.
18 changes: 5 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@ Extract oEmbed content from given URL.
import { extract } from 'oembed-parser'

// with CommonJS environments

// const { extract } = require('oembed-parser')

// or specify exactly path to cjs variant
// const { extract } = require('oembed-parser/dist/cjs/oembed-parser.js')

const url = 'https://www.youtube.com/watch?v=8jPQjjsBbIc'
Expand Down Expand Up @@ -112,7 +116,7 @@ findProvider('https://www.facebook.com/video.php?v=999999999')

Result looks like below:

```json
```js
{
fetchEndpoint: 'https://graph.facebook.com/v10.0/oembed_video',
providerName: 'Facebook',
Expand Down Expand Up @@ -154,18 +158,6 @@ const providers = [
setProviderList(providers)
```

### `.setRequestOptions(Object requestOptions)`

Define options to call oembed HTTP request.

`oembed-parser` is using [axios](https://github.com/axios/axios) to send HTTP requests. Please refer [axios' request config](https://axios-http.com/docs/req_config) for more info.

### `.getRequestOptions()`

Return current request options.

Default values can be found [here](https://github.com/ndaidong/oembed-parser/blob/main/src/config.js#L5).

## Facebook and Instagram

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.
Expand Down
10 changes: 4 additions & 6 deletions build.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* @ndaidong
**/

import { readFileSync, writeFileSync, copyFileSync } from 'fs'
import { readFileSync, writeFileSync } from 'fs'
import { execSync } from 'child_process'

import { buildSync } from 'esbuild'
Expand All @@ -25,7 +25,10 @@ const baseOpt = {
bundle: true,
charset: 'utf8',
target: ['es2020', 'node14'],
pure: ['console.log', 'debug', 'alert'],
legalComments: 'none',
minify: false,
sourcemap: false,
write: true
}

Expand All @@ -51,8 +54,3 @@ writeFileSync(
JSON.stringify(cjspkg, null, ' '),
'utf8'
)

copyFileSync(
'src/utils/providers.latest.js',
'dist/cjs/providers.latest.js'
)
2 changes: 1 addition & 1 deletion cjs-eval.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// cjs-eval.js
// to quickly test with a single url or file

const { extract } = require('./dist/cjs/oembed-parser')
const { extract } = require('oembed-parser')

const run = async (url) => {
try {
Expand Down
15,419 changes: 2,702 additions & 12,717 deletions dist/cjs/oembed-parser.js

Large diffs are not rendered by default.

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.9",
"version": "3.1.0rc1",
"main": "./oembed-parser.js"
}
Loading

0 comments on commit 652a1c9

Please sign in to comment.