Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion components/apify/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@ The Apify API unleashes the power to automate web scraping, process data, and or

**Real Estate Listings Aggregator**

- Create a workflow where Apify actors periodically fetch the latest real estate listings from multiple websites. Process and normalize the data with Pipedream's code steps, then automatically update a Google Sheet that serves as a central repository for all listings, keeping potential buyers informed with the latest options.
- Create a workflow where Apify Actors periodically fetch the latest real estate listings from multiple websites. Process and normalize the data with Pipedream's code steps, then automatically update a Google Sheet that serves as a central repository for all listings, keeping potential buyers informed with the latest options.
45 changes: 25 additions & 20 deletions components/apify/actions/get-dataset-items/get-dataset-items.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ import { LIMIT } from "../../common/constants.mjs";

export default {
key: "apify-get-dataset-items",
name: "Get Dataset Items",
name: "Get dataset items",
description: "Returns data stored in a dataset. [See the documentation](https://docs.apify.com/api/v2/dataset-items-get)",
version: "0.0.6",
version: "0.0.7",
annotations: {
destructiveHint: false,
openWorldHint: true,
Expand Down Expand Up @@ -52,32 +52,37 @@ export default {
},
},
async run({ $ }) {
const params = {
limit: LIMIT,
offset: this.offset,
clean: this.clean,
fields: this.fields,
omit: this.omit,
};
const {
clean, fields, omit, limit,
} = this;
const datasetId = this.datasetId?.replace("/", "~");
const offset = this.offset ?? 0;

const results = [];
let total;
let currentOffset = offset;

do {
while (limit === undefined || results.length < limit) {
const pageSize = limit === undefined
? LIMIT
: Math.min(LIMIT, limit - results.length);
const { items } = await this.apify.listDatasetItems({
datasetId: this.datasetId,
params,
datasetId,
params: {
offset: currentOffset,
limit: pageSize,
clean,
fields,
omit,
},
});
if (!items?.length) {
break;
}
results.push(...items);
if (results.length >= this.limit) {
currentOffset += items.length;
if (items.length < pageSize) {
break;
}
total = items?.length;
params.offset += LIMIT;
} while (total);

if (results.length > this.limit) {
results.length = this.limit;
}

if (results.length > 0) {
Expand Down
9 changes: 7 additions & 2 deletions components/apify/actions/get-kvs-record/get-kvs-record.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,14 @@ import apify from "../../apify.app.mjs";

export default {
key: "apify-get-kvs-record",
name: "Get Key-Value Store Record",
name: "Get key-value store record",
description: "Gets a record from a key-value store.",
version: "0.0.5",
version: "0.0.6",
annotations: {
destructiveHint: false,
openWorldHint: true,
readOnlyHint: true,
},
type: "action",
props: {
apify,
Expand Down
Loading
Loading