Skip to content

Commit

Permalink
Merge pull request #246 from jshemas/aug-28
Browse files Browse the repository at this point in the history
Updating
  • Loading branch information
jshemas authored Aug 29, 2024
2 parents 74447ed + 0553a33 commit 98e7f2b
Show file tree
Hide file tree
Showing 4 changed files with 86 additions and 21 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# Change Log

## 6.8.1

- Fixing issue where setting `fetchOptions.headers` would replace the default `headers`
- Updating dependencies

## 6.8.0

- Updating how `onlyGetOpenGraphInfo` works. By default it is `false` but now it accepts an array of properties for which no fallback should be used.
Expand Down
34 changes: 17 additions & 17 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "open-graph-scraper",
"description": "Node.js scraper module for Open Graph and Twitter Card info",
"version": "6.8.0",
"version": "6.8.1",
"license": "MIT",
"main": "./dist/cjs/index.js",
"types": "./types/index.d.ts",
Expand Down Expand Up @@ -39,7 +39,7 @@
"chardet": "^2.0.0",
"cheerio": "^1.0.0-rc.12",
"iconv-lite": "^0.6.3",
"undici": "^6.19.7"
"undici": "^6.19.8"
},
"files": [
"/dist",
Expand All @@ -48,9 +48,9 @@
"CHANGELOG.md"
],
"devDependencies": {
"@snyk/protect": "^1.1292.4",
"@snyk/protect": "^1.1293.0",
"@types/mocha": "^10.0.7",
"@types/node": "^18.19.44",
"@types/node": "^18.19.47",
"@typescript-eslint/eslint-plugin": "^7.18.0",
"@typescript-eslint/parser": "^7.18.0",
"chai": "^4.5.0",
Expand Down
60 changes: 60 additions & 0 deletions tests/integration/basic.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -464,4 +464,64 @@ describe('basic', function () {
expect(response).to.eql(undefined);
});
});

it('epicgames.com - should return og data using a header', function () {
return ogs({
url: 'https://dev.epicgames.com/documentation/ja-jp/unreal-engine/volume-actors-in-unreal-engine',
fetchOptions: {
headers: {
'user-agent': 'Twitterbot',
Origin: 'https://dev.epicgames.com/documentation/ja-jp/unreal-engine/volume-actors-in-unreal-engine',
},
},
})
.then(function ({ error, result, response }) {
console.log('error:', error);
console.log('result:', result);
expect(error).to.be.eql(false);
expect(result.ogSiteName).to.be.eql('Epic Games Developer');
expect(result.ogDescription).to.be.eql('Unreal Engine でのさまざまな種類の Volume アクタのリファレンス');
expect(result.ogTitle).to.be.eql('Unreal Engine での Volume アクタ | Unreal Engine 5.4 ドキュメンテーション | Epic Developer Community');
expect(result.ogType).to.be.eql('website');
expect(result.ogUrl).to.be.eql('https://dev.epicgames.com/documentation/ja-jp/unreal-engine/volume-actors-in-unreal-engine');
expect(result.twitterCard).to.be.eql('summary_large_image');
expect(result.twitterTitle).to.be.eql('Unreal Engine での Volume アクタ | Unreal Engine 5.4 ドキュメンテーション | Epic Developer Community');
expect(result.twitterDescription).to.be.eql('Unreal Engine でのさまざまな種類の Volume アクタのリファレンス');
expect(result.twitterSite).to.be.eql('@UnrealEngine');
expect(result.ogImage).to.be.eql([
{
height: '630',
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',
width: '1200',
},
]);
expect(result.twitterImage).to.be.eql([
{
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',
},
]);
expect(result.favicon).to.be.eql('https://edc-cdn.net/assets/images/favicon-light.png');
expect(result.charset).to.be.eql('utf-8');
expect(result.requestUrl).to.be.eql('https://dev.epicgames.com/documentation/ja-jp/unreal-engine/volume-actors-in-unreal-engine');
expect(result.success).to.be.eql(true);
expect(result).to.have.all.keys(
'ogSiteName',
'ogDescription',
'ogTitle',
'ogType',
'ogUrl',
'twitterCard',
'twitterTitle',
'twitterDescription',
'twitterSite',
'ogImage',
'twitterImage',
'favicon',
'charset',
'requestUrl',
'success',
);
expect(response).to.be.an('Response');
});
});
});

0 comments on commit 98e7f2b

Please sign in to comment.