π CSS Scraper Provider
The CSS Scraper provider lets you extract price data from any web page using CSS selectors. This is particularly useful for instruments not covered by other providers, such as Italian government bonds (BTP) on Borsa Italiana.
π Capabilities
- β Current Price: Scrapes the price from a web page
- β History: Not supported (β οΈ warning, not an error)
- β Search: Not supported
π§ Configuration
- Identifier: The full URL of the page to scrape
- Identifier Type:
OTHER - Parameters:
| Parameter | Required | Description | Example |
|---|---|---|---|
current_css_selector |
β | CSS selector for the price element | .summary-value strong |
currency |
β | ISO 4217 currency code | EUR |
decimal_format |
β | us (1,234.56) or eu (1.234,56) |
eu |
timeout |
β | HTTP timeout in seconds (default: 30) | 30 |
user_agent |
β | Custom User-Agent header | LibreFolio/1.0 |
π How to Find the CSS Selector
Step-by-step (Chrome)
- Open the page with the price in Chrome
- Right-click on the price value
- Select Inspect (or press
F12) - In the DevTools Elements panel, the price element will be highlighted
- Right-click the highlighted element in DevTools
- Select Copy β Copy selector
- Paste it into the
current_css_selectorfield
Step-by-step (Firefox)
- Open the page with the price in Firefox
- Right-click on the price value
- Select Inspect Element (or press
F12) - In the Inspector, right-click the highlighted element
- Select Copy β CSS Selector
- Paste it into the
current_css_selectorfield
π‘ Example: Borsa Italiana BTP
For a BTP on Borsa Italiana (e.g., IT0005634800):
URL (English version):
CSS Selector:
Configuration:
- Identifier: https://www.borsaitaliana.it/borsa/obbligazioni/mot/btp/scheda/IT0005634800.html?lang=en
- current_css_selector: .summary-value strong
- currency: EUR
- decimal_format: us (English page uses US format: 100.39)
For the Italian version, use decimal_format: eu (Italian page uses EU format: 100,39).
π’ Decimal Format
| Format | Example | When to use |
|---|---|---|
us |
1,234.56 | English/US pages (period as decimal separator) |
eu |
1.234,56 | Italian/German/French pages (comma as decimal separator) |
π οΈ Troubleshooting
"Selector not found"
The CSS selector doesn't match any element on the page. The page structure may have changed β re-inspect and copy a new selector.
"Connection timeout"
The page took too long to respond. Try increasing the timeout parameter or check if the URL is correct.
"Parse error"
The price text couldn't be parsed as a number. Check the decimal_format setting β if the page shows 100,39, use eu; if 100.39, use us.
Price shows 0 or wrong value
The selector may be matching a different element. Try a more specific selector. Use DevTools to verify exactly which element your selector matches.