fetch-opengraph
Advanced tools
Comparing version 1.0.22 to 1.0.23
@@ -16,6 +16,6 @@ export declare const metaTags: { | ||
}; | ||
export declare const fetch: (url: string) => Promise<any>; | ||
export declare const fetch: (url: string, headers?: any) => Promise<any>; | ||
declare const _default: { | ||
fetch: (url: string) => Promise<any>; | ||
fetch: (url: string, headers?: any) => Promise<any>; | ||
}; | ||
export default _default; |
24
index.js
@@ -29,3 +29,3 @@ "use strict"; | ||
}; | ||
const fetch = (url) => __awaiter(void 0, void 0, void 0, function* () { | ||
const fetch = (url, headers) => __awaiter(void 0, void 0, void 0, function* () { | ||
const { title, description, ogUrl, ogType, ogTitle, ogDescription, ogImage, twitterCard, twitterDomain, twitterUrl, twitterTitle, twitterDescription, twitterImage } = exports.metaTags; | ||
@@ -35,7 +35,3 @@ return new Promise((resolve, reject) => __awaiter(void 0, void 0, void 0, function* () { | ||
const response = yield axios_1.default.get(url, { | ||
headers: { | ||
'Cache-Control': 'no-cache', | ||
Accept: '*/*', | ||
Connection: 'keep-alive' | ||
} | ||
headers: Object.assign({ 'User-Agent': 'OpenGraph', 'Cache-Control': 'no-cache', Accept: '*/*', Connection: 'keep-alive' }, headers) | ||
}); | ||
@@ -124,17 +120,3 @@ if (response.status >= 400) { | ||
catch (error) { | ||
return resolve({ | ||
'title': '', | ||
'description': '', | ||
'og:url': url, | ||
'og:type': '', | ||
'og:title': '', | ||
'og:description': '', | ||
'og:image': '', | ||
'twitter:card': '', | ||
'twitter:domain': '', | ||
'twitter:url': url, | ||
'twitter:title': '', | ||
'twitter:description': '', | ||
'twitter:image': '', | ||
}); | ||
return reject(error); | ||
} | ||
@@ -141,0 +123,0 @@ })); |
{ | ||
"name": "fetch-opengraph", | ||
"version": "1.0.22", | ||
"version": "1.0.23", | ||
"description": "Fetch opengraph information from an url", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
11397
145