1import { ApifyClient } from 'apify-client';
2
3
4
5const client = new ApifyClient({
6 token: '<YOUR_API_TOKEN>',
7});
8
9
10const input = {
11 "mode": "search",
12 "locations": [
13 "London"
14 ],
15 "startUrls": [
16 {
17 "url": "https://www.onthemarket.com/for-sale/property/london/"
18 },
19 {
20 "url": "https://www.onthemarket.com/for-sale/property/london/?page=2"
21 },
22 {
23 "url": "https://www.onthemarket.com/for-sale/property/london/?sort-field=price&sort-order=asc&page=2"
24 },
25 {
26 "url": "https://www.onthemarket.com/for-sale/2-bed-flats-apartments/london/?min-price=300000&max-price=900000&sort-field=price&radius=3"
27 },
28 {
29 "url": "https://www.onthemarket.com/for-sale/detached/london/"
30 },
31 {
32 "url": "https://www.onthemarket.com/for-sale/property/sw19/"
33 },
34 {
35 "url": "https://www.onthemarket.com/to-rent/property/manchester/"
36 },
37 {
38 "url": "https://www.onthemarket.com/to-rent/property/london/?page=2"
39 },
40 {
41 "url": "https://www.onthemarket.com/new-homes/property/london/"
42 },
43 {
44 "url": "https://www.onthemarket.com/for-sale/property/london/?new-homes=true"
45 },
46 {
47 "url": "https://www.onthemarket.com/details/20490019/"
48 },
49 {
50 "url": "https://www.onthemarket.com/details/20622528"
51 },
52 {
53 "url": "https://www.onthemarket.com/property/london/"
54 },
55 {
56 "url": "https://www.onthemarket.com/agents/branch/1-clickproperties-acton/"
57 },
58 {
59 "url": "https://www.onthemarket.com/agents/london/"
60 }
61 ],
62 "incrementalMode": false,
63 "emitUnchanged": false,
64 "emitExpired": false,
65 "ignoreFieldsForChanges": []
66};
67
68
69const run = await client.actor("abotapi/onthemarket-scraper").call(input);
70
71
72console.log('Results from dataset');
73console.log(`๐พ Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
74const { items } = await client.dataset(run.defaultDatasetId).listItems();
75items.forEach((item) => {
76 console.dir(item);
77});
78
79