cloudflare
Version:
The official TypeScript library for the Cloudflare API
42 lines • 1.45 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.Scrape = exports.BaseScrape = void 0;
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
const resource_1 = require("../../core/resource.js");
const path_1 = require("../../internal/utils/path.js");
var BaseScrape = /* @__PURE__ */ (() => {
class BaseScrape extends resource_1.APIResource {
/**
* Get meta attributes like height, width, text and others of selected elements.
*
* @example
* ```ts
* const scrapes = await client.browserRendering.scrape.create(
* {
* account_id: 'account_id',
* url: 'https://www.example.com/',
* elements: [{ selector: 'h1' }],
* },
* );
* ```
*/
create(params, options) {
const { account_id, cacheTTL, ...body } = params;
return this._client.post((0, path_1.path) `/accounts/${account_id}/browser-rendering/scrape`, {
query: { cacheTTL },
body,
...options,
})._thenUnwrap((obj) => obj.result);
}
}
BaseScrape._key = Object.freeze([
'browserRendering',
'scrape',
]);
return BaseScrape;
})();
exports.BaseScrape = BaseScrape;
class Scrape extends BaseScrape {
}
exports.Scrape = Scrape;
//# sourceMappingURL=scrape.js.map