ts-open-graph-scraper
Version:
Node.js scraper module for Open Graph and Twitter Card info, based on https://github.com/jshemas/openGraphScraper
48 lines (47 loc) • 1.65 kB
JavaScript
;
var __extends = (this && this.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
Object.defineProperty(exports, "__esModule", { value: true });
var OGError = (function (_super) {
__extends(OGError, _super);
function OGError(msg, requestError, res) {
var _this = this;
if (!msg && requestError && requestError.message) {
_this = _super.call(this, requestError.message) || this;
}
else {
_this = _super.call(this, msg) || this;
}
_this.requestError = requestError;
_this.response = res;
return _this;
}
Object.defineProperty(OGError.prototype, "code", {
get: function () {
return this.requestError && this.requestError.code;
},
enumerable: true,
configurable: true
});
Object.defineProperty(OGError.prototype, "statusCode", {
get: function () {
return this.response && this.response.statusCode;
},
enumerable: true,
configurable: true
});
return OGError;
}(Error));
exports.OGError = OGError;
exports.default = OGError;