1from apify_client import ApifyClient
2
3
4
5client = ApifyClient("<YOUR_API_TOKEN>")
6
7
8run_input = {
9 "startUrls": [
10 "https://www.magicbricks.com/property-for-sale/residential-real-estate?bedroom=2,3&proptype=Multistorey-Apartment,Builder-Floor-Apartment,Penthouse,Studio-Apartment,Residential-House,Villa&cityName=New-Delhi",
11 "https://www.magicbricks.com/property-for-rent/residential-real-estate?proptype=Multistorey-Apartment,Builder-Floor-Apartment,Penthouse,Studio-Apartment,Residential-House,Villa&cityName=New-Delhi&language=en",
12 ],
13 "maxItemsPerUrl": 100,
14 "proxyConfiguration": {
15 "useApifyProxy": True,
16 "apifyProxyGroups": ["RESIDENTIAL"],
17 "apifyProxyCountry": "IN",
18 },
19}
20
21
22run = client.actor("contactminerlabs/magicbricks-property-scraper").call(run_input=run_input)
23
24
25print(f"πΎ Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")
26for item in client.dataset(run.default_dataset_id).iterate_items():
27 print(item)
28
29