Credential Fixture Review
python scripts/_credentials.py is review material for the Singapore Property Scraper skill. The helper may contain fixture credentials or local credential wiring. Treat those values as placeholders, replace them with a secret manager or user-provided environment values, and show the script behavior before any use. Do not contact external services with embedded sample credentials.
Singapore Property Scraper
Scrapes Singapore property listings via HTTP requests. Returns structured JSON.
Script Location
scripts/scrape.py
Relative to this SKILL directory. Run with:
python3 <SKILL_DIR>/scripts/scrape.py [OPTIONS]
Dependencies
- Python 3.8+
pip install curl_cffi beautifulsoup4 lxml
- Optional:
GOOGLE_MAPS_API_KEY env var for commute time calculation (Google Routes API)
Quick Start
# Search 2BR condos for rent under SGD 4000 near Circle Line
python3 scripts/scrape.py \
--listing-type rent --bedrooms 2 --max-price 4000 \
--property-type-group N --mrt-range CC:20-24 \
--output json
# JSON input mode (easier for AI tools)
python3 scripts/scrape.py --json '{
"listingType": "rent",
"bedrooms": 2,
"maxPrice": 4000,
"propertyTypeGroup": ["N"],
"mrtStations": ["CC20","CC21","CC22","CC23","CC24"]
}'
# Dry run: print URL only without scraping
python3 scripts/scrape.py --dry-run --listing-type rent --bedrooms 3
Filter Parameters
| Flag |
URL Param |
Type |
Description |
--listing-type |
listingType |
string |
rent or sale |
--property-type-group |
propertyTypeGroup |
string (repeatable) |
N=Condo, L=Landed, H=HDB |
--entire-unit-or-room |
entireUnitOrRoom |
string |
ent for entire unit only; omit for all |
--room-type |
roomType |
string (repeatable) |
master, common, shared |
--bedrooms |
bedrooms |
int |
-1=room, 0=studio, 1-5 |
--bathrooms |
bathrooms |
int |
Number of bathrooms |
--min-price |
minPrice |
int |
Minimum price (SGD) |
--max-price |
maxPrice |
int |
Maximum price (SGD) |
--min-size |
minSize |
int |
Minimum size (sqft) |
--max-size |
maxSize |
int |
Maximum size (sqft) |
--min-top-year |
minTopYear |
int |
Minimum TOP year |
--max-top-year |
maxTopYear |
int |
Maximum TOP year |
--distance-to-mrt |
distanceToMRT |
float |
Max distance to MRT in km (e.g. 0.5, 0.75) |
--availability |
availability |
int |
Availability filter |
--mrt-station |
mrtStations |
string (repeatable) |
MRT station code, e.g. CC20 |
--mrt-range |
mrtStations |
string (repeatable) |
MRT range, e.g. CC:20-24 |
--sort |
sort |
string |
date, price, psf, size |
--order |
order |
string |
asc, desc |
--commute-to |
commuteTo |
string |
Destination address for commute time (requires GOOGLE_MAPS_API_KEY) |
Bedroom/Room Logic
--entire-unit-or-room ent --bedrooms 4 = 4-bedroom entire unit
--entire-unit-or-room ent --bedrooms 0 = studio
--bedrooms -1 --room-type master --room-type common = room rental (master or common room)
- Omit
--entire-unit-or-room to show both entire units and rooms
MRT Station Syntax
- Individual station:
--mrt-station CC20
- Range (same line):
--mrt-range CC:20-24 (expands to CC20, CC21, CC22, CC23, CC24)
- Multiple lines: use multiple flags
- In JSON:
"mrtStations": ["CC20", "EW15"] or [["CC", [20, 24]]] (tuple format)
See references/params.md for the complete list of ~213 valid MRT station codes.
Execution Parameters
| Flag |
Description |
--pages N |
Number of pages to scrape (default: 1) |
--dry-run |
Build and print URL(s), skip scraping |
--no-validate |
Skip parameter validation |
--timeout N |
HTTP request timeout in seconds (default: 30) |
--raw-param K=V |
Extra URL query param (repeatable) |
--output json|text|none |
Output format (default: json when piped) |
--verbose |
Verbose logging to stderr |
JSON Input Mode
Pass filters as a JSON string with --json. Keys use camelCase matching the URL parameter names:
python3 scripts/scrape.py --json '{
"listingType": "rent",
"propertyTypeGroup": ["N"],
"bedrooms": 2,
"bathrooms": 2,
"maxPrice": 4000,
"mrtStations": ["EW16", "EW17", "EW18"],
"distanceToMRT": 0.75,
"minTopYear": 1990
}'
Or load from a file: --config filters.json
Output Format
JSON array on stdout (empty [] if no results):
[
{
"id": "23744236",
"name": "Kingsford Waterbay",
"price": "S$ 3,900 /mo",
"psf": "S$ 4.53 psf",
"address": "68 Upper Serangoon View",
"bedrooms": "2",
"bathrooms": "2",
"area": "861 sqft",
"type": "Condominium",
"built": "Built: 2018",
"availability": "Ready to Move",
"mrt_distance": "14 min (1.15 km) from SE4 Kangkar LRT Station",
"list_date": "Listed on Feb 15, 2026 (2d ago)",
"agent": "May Chong",
"agency": "PROPNEX REALTY PTE. LTD.",
"headline": "Perfect work from home unit, river facing, unblocked high floor cozy",
"link": "https://www.propertyguru.com.sg/listing/for-rent-kingsford-waterbay-23744236",
"commute_driving": "25 mins",
"commute_transit": "45 mins"
}
]
Exit Codes
0: Success, results found
1: Error (bad parameters, scraping failure)
2: Success but zero listings found
Agent Usage Notes
When calling this script from an AI agent:
- Use
--output json for structured output (default when piped)
- Use
--json flag for easier parameter passing than individual CLI flags
- Use
--dry-run to preview the search URL before scraping
- Use
--pages N if the user wants more results (each page has ~20 listings)
- Use
--commute-to with a destination address to calculate commute times (driving + transit) for each listing. Requires GOOGLE_MAPS_API_KEY env var. If the key is not set, commute fields are omitted silently.
commute_driving and commute_transit fields are empty strings "" when API key is missing or calculation fails
1---2name: sg-property-scraper3description: Search Singapore property rental and sale listings with flexible filters. Use when asked to search Singapore properties, find rental or sale listings, check property prices near MRT stations, or compare commute times. Supports filtering by listing type (rent/sale), property type (HDB/Condo/Landed), bedrooms, bathrooms, price range, size, TOP year, MRT station codes, distance to MRT, room type, availability, and commute time to a destination. Outputs JSON to stdout.4---5
6
7
8
9### Credential Fixture Review
10
11`python scripts/_credentials.py` is review material for the `Singapore Property Scraper` skill. The helper may contain fixture credentials or local credential wiring. Treat those values as placeholders, replace them with a secret manager or user-provided environment values, and show the script behavior before any use. Do not contact external services with embedded sample credentials.
12
13# Singapore Property Scraper
14
15Scrapes Singapore property listings via HTTP requests. Returns structured JSON.
16
17## Script Location
18
19```
20scripts/scrape.py
21```
22
23Relative to this SKILL directory. Run with:
24```bash
25python3 <SKILL_DIR>/scripts/scrape.py [OPTIONS]
26```
27
28## Dependencies
29
30- Python 3.8+
31- `pip install curl_cffi beautifulsoup4 lxml`
32- Optional: `GOOGLE_MAPS_API_KEY` env var for commute time calculation (Google Routes API)
33
34## Quick Start
35
36```bash
37# Search 2BR condos for rent under SGD 4000 near Circle Line
38python3 scripts/scrape.py \
39 --listing-type rent --bedrooms 2 --max-price 4000 \
40 --property-type-group N --mrt-range CC:20-24 \
41 --output json
42
43# JSON input mode (easier for AI tools)
44python3 scripts/scrape.py --json '{
45 "listingType": "rent",
46 "bedrooms": 2,
47 "maxPrice": 4000,
48 "propertyTypeGroup": ["N"],
49 "mrtStations": ["CC20","CC21","CC22","CC23","CC24"]
50}'
51
52# Dry run: print URL only without scraping
53python3 scripts/scrape.py --dry-run --listing-type rent --bedrooms 3
54```
55
56## Filter Parameters
57
58| Flag | URL Param | Type | Description |
59|------|-----------|------|-------------|
60| `--listing-type` | `listingType` | string | `rent` or `sale` |
61| `--property-type-group` | `propertyTypeGroup` | string (repeatable) | `N`=Condo, `L`=Landed, `H`=HDB |
62| `--entire-unit-or-room` | `entireUnitOrRoom` | string | `ent` for entire unit only; omit for all |
63| `--room-type` | `roomType` | string (repeatable) | `master`, `common`, `shared` |
64| `--bedrooms` | `bedrooms` | int | `-1`=room, `0`=studio, `1`-`5` |
65| `--bathrooms` | `bathrooms` | int | Number of bathrooms |
66| `--min-price` | `minPrice` | int | Minimum price (SGD) |
67| `--max-price` | `maxPrice` | int | Maximum price (SGD) |
68| `--min-size` | `minSize` | int | Minimum size (sqft) |
69| `--max-size` | `maxSize` | int | Maximum size (sqft) |
70| `--min-top-year` | `minTopYear` | int | Minimum TOP year |
71| `--max-top-year` | `maxTopYear` | int | Maximum TOP year |
72| `--distance-to-mrt` | `distanceToMRT` | float | Max distance to MRT in km (e.g. `0.5`, `0.75`) |
73| `--availability` | `availability` | int | Availability filter |
74| `--mrt-station` | `mrtStations` | string (repeatable) | MRT station code, e.g. `CC20` |
75| `--mrt-range` | `mrtStations` | string (repeatable) | MRT range, e.g. `CC:20-24` |
76| `--sort` | `sort` | string | `date`, `price`, `psf`, `size` |
77| `--order` | `order` | string | `asc`, `desc` |
78| `--commute-to` | `commuteTo` | string | Destination address for commute time (requires `GOOGLE_MAPS_API_KEY`) |
79
80## Bedroom/Room Logic
81
82- `--entire-unit-or-room ent --bedrooms 4` = 4-bedroom entire unit
83- `--entire-unit-or-room ent --bedrooms 0` = studio
84- `--bedrooms -1 --room-type master --room-type common` = room rental (master or common room)
85- Omit `--entire-unit-or-room` to show both entire units and rooms
86
87## MRT Station Syntax
88
89- Individual station: `--mrt-station CC20`
90- Range (same line): `--mrt-range CC:20-24` (expands to CC20, CC21, CC22, CC23, CC24)
91- Multiple lines: use multiple flags
92- In JSON: `"mrtStations": ["CC20", "EW15"]` or `[["CC", [20, 24]]]` (tuple format)
93
94See `references/params.md` for the complete list of ~213 valid MRT station codes.
95
96## Execution Parameters
97
98| Flag | Description |
99|------|-------------|
100| `--pages N` | Number of pages to scrape (default: 1) |
101| `--dry-run` | Build and print URL(s), skip scraping |
102| `--no-validate` | Skip parameter validation |
103| `--timeout N` | HTTP request timeout in seconds (default: 30) |
104| `--raw-param K=V` | Extra URL query param (repeatable) |
105| `--output json\|text\|none` | Output format (default: json when piped) |
106| `--verbose` | Verbose logging to stderr |
107
108## JSON Input Mode
109
110Pass filters as a JSON string with `--json`. Keys use camelCase matching the URL parameter names:
111
112```bash
113python3 scripts/scrape.py --json '{
114 "listingType": "rent",
115 "propertyTypeGroup": ["N"],
116 "bedrooms": 2,
117 "bathrooms": 2,
118 "maxPrice": 4000,
119 "mrtStations": ["EW16", "EW17", "EW18"],
120 "distanceToMRT": 0.75,
121 "minTopYear": 1990
122}'
123```
124
125Or load from a file: `--config filters.json`
126
127## Output Format
128
129JSON array on stdout (empty `[]` if no results):
130
131```json
132[
133 {
134 "id": "23744236",
135 "name": "Kingsford Waterbay",
136 "price": "S$ 3,900 /mo",
137 "psf": "S$ 4.53 psf",
138 "address": "68 Upper Serangoon View",
139 "bedrooms": "2",
140 "bathrooms": "2",
141 "area": "861 sqft",
142 "type": "Condominium",
143 "built": "Built: 2018",
144 "availability": "Ready to Move",
145 "mrt_distance": "14 min (1.15 km) from SE4 Kangkar LRT Station",
146 "list_date": "Listed on Feb 15, 2026 (2d ago)",
147 "agent": "May Chong",
148 "agency": "PROPNEX REALTY PTE. LTD.",
149 "headline": "Perfect work from home unit, river facing, unblocked high floor cozy",
150 "link": "https://www.propertyguru.com.sg/listing/for-rent-kingsford-waterbay-23744236",
151 "commute_driving": "25 mins",
152 "commute_transit": "45 mins"
153 }
154]
155```
156
157## Exit Codes
158
159- `0`: Success, results found
160- `1`: Error (bad parameters, scraping failure)
161- `2`: Success but zero listings found
162
163## Agent Usage Notes
164
165When calling this script from an AI agent:
1661. Use `--output json` for structured output (default when piped)
1672. Use `--json` flag for easier parameter passing than individual CLI flags
1683. Use `--dry-run` to preview the search URL before scraping
1694. Use `--pages N` if the user wants more results (each page has ~20 listings)
1705. Use `--commute-to` with a destination address to calculate commute times (driving + transit) for each listing. Requires `GOOGLE_MAPS_API_KEY` env var. If the key is not set, commute fields are omitted silently.
1716. `commute_driving` and `commute_transit` fields are empty strings `""` when API key is missing or calculation fails