1import { ApifyClient } from 'apify-client';
2
3
4
5const client = new ApifyClient({
6 token: '<YOUR_API_TOKEN>',
7});
8
9
10const input = {
11 "operation": "search",
12 "location": "Madrid",
13 "locations": [
14 "Barcelona",
15 "Valencia"
16 ],
17 "agencyUrls": [],
18 "transactionType": "sale",
19 "propertyType": "all",
20 "newConstruction": false,
21 "minPrice": 0,
22 "maxPrice": 0,
23 "minRooms": 0,
24 "minBathrooms": 0,
25 "minSurface": 0,
26 "maxSurface": 0,
27 "sortBy": "relevance",
28 "maxResults": 90
29};
30
31
32const run = await client.actor("sian.agency/fotocasa-property-scraper").call(input);
33
34
35console.log('Results from dataset');
36console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
37const { items } = await client.dataset(run.defaultDatasetId).listItems();
38items.forEach((item) => {
39 console.dir(item);
40});
41
42