cloudflare
Version:
The official TypeScript library for the Cloudflare API
37 lines • 1.26 kB
JavaScript
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
import { APIResource } from "../../core/resource.mjs";
import { path } from "../../internal/utils/path.mjs";
export var BaseScrape = /* @__PURE__ */ (() => {
class BaseScrape extends 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(path `/accounts/${account_id}/browser-rendering/scrape`, {
query: { cacheTTL },
body,
...options,
})._thenUnwrap((obj) => obj.result);
}
}
BaseScrape._key = Object.freeze([
'browserRendering',
'scrape',
]);
return BaseScrape;
})();
export class Scrape extends BaseScrape {
}
//# sourceMappingURL=scrape.mjs.map