1import { ApifyClient } from 'apify-client';
2
3
4
5const client = new ApifyClient({
6 token: '<YOUR_API_TOKEN>',
7});
8
9
10const input = {
11 "searchUrl": "https://www.comparis.ch/immobilien/result/list?requestobject=%7B%22DealType%22%3A10%2C%22SiteId%22%3A0%2C%22RootPropertyTypes%22%3A%5B%5D%2C%22PropertyTypes%22%3A%5B%5D%2C%22RoomsFrom%22%3Anull%2C%22RoomsTo%22%3Anull%2C%22FloorSearchType%22%3A0%2C%22LivingSpaceFrom%22%3Anull%2C%22LivingSpaceTo%22%3Anull%2C%22PriceFrom%22%3Anull%2C%22PriceTo%22%3Anull%2C%22ComparisPointsMin%22%3A0%2C%22AdAgeMax%22%3A0%2C%22AdAgeInHoursMax%22%3Anull%2C%22DistanceFromGeoLocationKm%22%3Anull%2C%22MinAvailableDate%22%3Anull%2C%22MinChangeDate%22%3Anull%2C%22WithImagesOnly%22%3Afalse%2C%22WithPointsOfInterestOnly%22%3Afalse%2C%22Keyword%22%3Anull%2C%22WithVirtualToursOnly%22%3Afalse%2C%22ConstructionDateFrom%22%3Anull%2C%22ConstructionDateTo%22%3Anull%2C%22LastRenovationFrom%22%3Anull%2C%22LastRenovationTo%22%3Anull%2C%22NumberOfParkingLotsFrom%22%3Anull%2C%22NumberOfParkingLotsTo%22%3Anull%2C%22SurfaceOfLandFrom%22%3Anull%2C%22SurfaceOfLandTo%22%3Anull%2C%22WithChildrenOnly%22%3Afalse%2C%22WithPetsOnly%22%3Afalse%2C%22WithWheelchairOnly%22%3Afalse%2C%22WithLiftOnly%22%3Afalse%2C%22WithBalconyOnly%22%3Afalse%2C%22WithGardenOnly%22%3Afalse%2C%22ElevationDistanceSorting%22%3Anull%2C%22SortingCriteria%22%3A3%2C%22SortingDirection%22%3A2%7D",
12 "maxResults": 200
13};
14
15
16const run = await client.actor("agenscrape/comparis-ch-real-estate-scraper").call(input);
17
18
19console.log('Results from dataset');
20console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
21const { items } = await client.dataset(run.defaultDatasetId).listItems();
22items.forEach((item) => {
23 console.dir(item);
24});
25
26