Skip to content

Commit 98e7f2b

Browse files
authored
Merge pull request #246 from jshemas/aug-28
Updating
2 parents 74447ed + 0553a33 commit 98e7f2b

File tree

4 files changed

+86
-21
lines changed

4 files changed

+86
-21
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
# Change Log
22

3+
## 6.8.1
4+
5+
- Fixing issue where setting `fetchOptions.headers` would replace the default `headers`
6+
- Updating dependencies
7+
38
## 6.8.0
49

510
- Updating how `onlyGetOpenGraphInfo` works. By default it is `false` but now it accepts an array of properties for which no fallback should be used.

package-lock.json

Lines changed: 17 additions & 17 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "open-graph-scraper",
33
"description": "Node.js scraper module for Open Graph and Twitter Card info",
4-
"version": "6.8.0",
4+
"version": "6.8.1",
55
"license": "MIT",
66
"main": "./dist/cjs/index.js",
77
"types": "./types/index.d.ts",
@@ -39,7 +39,7 @@
3939
"chardet": "^2.0.0",
4040
"cheerio": "^1.0.0-rc.12",
4141
"iconv-lite": "^0.6.3",
42-
"undici": "^6.19.7"
42+
"undici": "^6.19.8"
4343
},
4444
"files": [
4545
"/dist",
@@ -48,9 +48,9 @@
4848
"CHANGELOG.md"
4949
],
5050
"devDependencies": {
51-
"@snyk/protect": "^1.1292.4",
51+
"@snyk/protect": "^1.1293.0",
5252
"@types/mocha": "^10.0.7",
53-
"@types/node": "^18.19.44",
53+
"@types/node": "^18.19.47",
5454
"@typescript-eslint/eslint-plugin": "^7.18.0",
5555
"@typescript-eslint/parser": "^7.18.0",
5656
"chai": "^4.5.0",

tests/integration/basic.spec.ts

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -464,4 +464,64 @@ describe('basic', function () {
464464
expect(response).to.eql(undefined);
465465
});
466466
});
467+
468+
it('epicgames.com - should return og data using a header', function () {
469+
return ogs({
470+
url: 'https://dev.epicgames.com/documentation/ja-jp/unreal-engine/volume-actors-in-unreal-engine',
471+
fetchOptions: {
472+
headers: {
473+
'user-agent': 'Twitterbot',
474+
Origin: 'https://dev.epicgames.com/documentation/ja-jp/unreal-engine/volume-actors-in-unreal-engine',
475+
},
476+
},
477+
})
478+
.then(function ({ error, result, response }) {
479+
console.log('error:', error);
480+
console.log('result:', result);
481+
expect(error).to.be.eql(false);
482+
expect(result.ogSiteName).to.be.eql('Epic Games Developer');
483+
expect(result.ogDescription).to.be.eql('Unreal Engine でのさまざまな種類の Volume アクタのリファレンス');
484+
expect(result.ogTitle).to.be.eql('Unreal Engine での Volume アクタ | Unreal Engine 5.4 ドキュメンテーション | Epic Developer Community');
485+
expect(result.ogType).to.be.eql('website');
486+
expect(result.ogUrl).to.be.eql('https://dev.epicgames.com/documentation/ja-jp/unreal-engine/volume-actors-in-unreal-engine');
487+
expect(result.twitterCard).to.be.eql('summary_large_image');
488+
expect(result.twitterTitle).to.be.eql('Unreal Engine での Volume アクタ | Unreal Engine 5.4 ドキュメンテーション | Epic Developer Community');
489+
expect(result.twitterDescription).to.be.eql('Unreal Engine でのさまざまな種類の Volume アクタのリファレンス');
490+
expect(result.twitterSite).to.be.eql('@UnrealEngine');
491+
expect(result.ogImage).to.be.eql([
492+
{
493+
height: '630',
494+
url: 'https://dev.epicgames.com/community/api/documentation/image/meta_tag?path=ja-jp/unreal-engine/volume-actors-in-unreal-engine&application_version=5.4',
495+
width: '1200',
496+
},
497+
]);
498+
expect(result.twitterImage).to.be.eql([
499+
{
500+
url: 'https://dev.epicgames.com/community/api/documentation/image/meta_tag?path=ja-jp/unreal-engine/volume-actors-in-unreal-engine&application_version=5.4',
501+
},
502+
]);
503+
expect(result.favicon).to.be.eql('https://edc-cdn.net/assets/images/favicon-light.png');
504+
expect(result.charset).to.be.eql('utf-8');
505+
expect(result.requestUrl).to.be.eql('https://dev.epicgames.com/documentation/ja-jp/unreal-engine/volume-actors-in-unreal-engine');
506+
expect(result.success).to.be.eql(true);
507+
expect(result).to.have.all.keys(
508+
'ogSiteName',
509+
'ogDescription',
510+
'ogTitle',
511+
'ogType',
512+
'ogUrl',
513+
'twitterCard',
514+
'twitterTitle',
515+
'twitterDescription',
516+
'twitterSite',
517+
'ogImage',
518+
'twitterImage',
519+
'favicon',
520+
'charset',
521+
'requestUrl',
522+
'success',
523+
);
524+
expect(response).to.be.an('Response');
525+
});
526+
});
467527
});

0 commit comments

Comments
 (0)