🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
DemoInstallSign in
Socket

webcrawlerapi-js

Package Overview
Dependencies
Maintainers
1
Versions
15
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

webcrawlerapi-js - npm Package Compare versions

Comparing version

to
1.0.9

constants.ts

7

api.ts
import {CrawlRequest, Job, JobId, ScrapeRequest, ScrapeResponse} from "./model";
import { JobStatus } from "./constants";

@@ -70,3 +71,3 @@ const BASE_PATH = "https://api.webcrawlerapi.com"

}
if (scrapeResult.status !== 'in_progress' && scrapeResult.status !== 'new') {
if (scrapeResult.status !== JobStatus.IN_PROGRESS && scrapeResult.status !== JobStatus.NEW) {
return scrapeResult;

@@ -143,3 +144,3 @@ }

const job = await this.getJob(`${jobIdResponse.id}?t=${timestamp}`);
if (job.status !== 'in_progress' && job.status !== 'new') {
if (job.status !== JobStatus.IN_PROGRESS && job.status !== JobStatus.NEW) {
// Transform each job item to include getContent method

@@ -149,3 +150,3 @@ job.job_items = job.job_items.map(item => ({

getContent: async function(): Promise<string | null> {
if (this.status !== 'done') {
if (job.status !== JobStatus.DONE || this.status !== JobStatus.DONE) {
return null;

@@ -152,0 +153,0 @@ }

@@ -13,2 +13,3 @@ "use strict";

exports.WebcrawlerClient = void 0;
const constants_1 = require("./constants");
const BASE_PATH = "https://api.webcrawlerapi.com";

@@ -71,3 +72,3 @@ const initialPullDelayMs = 2000;

}
if (scrapeResult.status !== 'in_progress' && scrapeResult.status !== 'new') {
if (scrapeResult.status !== constants_1.JobStatus.IN_PROGRESS && scrapeResult.status !== constants_1.JobStatus.NEW) {
return scrapeResult;

@@ -139,7 +140,7 @@ }

const job = yield this.getJob(`${jobIdResponse.id}?t=${timestamp}`);
if (job.status !== 'in_progress' && job.status !== 'new') {
if (job.status !== constants_1.JobStatus.IN_PROGRESS && job.status !== constants_1.JobStatus.NEW) {
// Transform each job item to include getContent method
job.job_items = job.job_items.map(item => (Object.assign(Object.assign({}, item), { getContent: function () {
return __awaiter(this, void 0, void 0, function* () {
if (this.status !== 'done') {
if (job.status !== constants_1.JobStatus.DONE || this.status !== constants_1.JobStatus.DONE) {
return null;

@@ -146,0 +147,0 @@ }

{
"name": "webcrawlerapi-js",
"version": "1.0.8",
"version": "1.0.9",
"description": "JS client for WecrawlerAPI",
"main": "./dist/index.js",
"types": "./dist/index.d.ts",
"scripts": {
"build": "tsc --outDir dist/"
},
"keywords": [

@@ -22,6 +26,3 @@ "scraping",

"license": "MIT",
"dependencies": {},
"scripts": {
"build": "tsc --outDir dist/"
}
}
"dependencies": {}
}

@@ -19,6 +19,6 @@ # JS client for WebcrawlerAPI

```javascript
import webcrawlerapi from "webcrawlerapi-js";
import { WebcrawlerClient } from "webcrawlerapi-js"
async function main() {
const client = new webcrawlerapi.WebcrawlerClient(
const client = new WebcrawlerClient(
"YOUR API ACCESS KEY HERE",

@@ -83,2 +83,3 @@ )

last_error: '',
error_code: '',
created_at: '2024-12-28T21:36:04.468Z',

@@ -85,0 +86,0 @@ updated_at: '2024-12-28T21:36:04.435Z',