spruce_the_data: messy HTML and text to clean JSON
Pricing
from $10.00 / 1,000 cleaned items
Go to Apify Store
spruce_the_data: messy HTML and text to clean JSON
Turns messy scraped text or HTML into clean JSON that matches your schema.
spruce_the_data: messy HTML and text to clean JSON
Pricing
from $10.00 / 1,000 cleaned items
Turns messy scraped text or HTML into clean JSON that matches your schema.
You can access the spruce_the_data: messy HTML and text to clean JSON programmatically from your own applications by using the Apify API. You can also choose the language preference from below. To use the Apify API, you’ll need an Apify account and your API token, found in API & Integrations in Apify Console.
1from apify_client import ApifyClient2
3# Initialize the ApifyClient with your Apify API token4# Replace '<YOUR_API_TOKEN>' with your token.5client = ApifyClient("<YOUR_API_TOKEN>")6
7# Prepare the Actor input8run_input = {9 "texts": ["<h1> Stellar Gooseneck Kettle 1.0L </h1><span class=\"price\">$49.99</span> In stock"],10 "outputSchema": {11 "type": "object",12 "properties": {13 "name": { "type": "string" },14 "price": { "type": [15 "number",16 "null",17 ] },18 "currency": {19 "type": [20 "string",21 "null",22 ],23 "description": "ISO 4217 code, e.g. USD",24 },25 "in_stock": { "type": [26 "boolean",27 "null",28 ] },29 },30 "required": [31 "name",32 "price",33 "currency",34 "in_stock",35 ],36 },37}38
39# Run the Actor and wait for it to finish40run = client.actor("sprucethedata/clean-json").call(run_input=run_input)41
42# Fetch and print Actor results from the run's dataset (if there are any)43print(f"💾 Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")44for item in client.dataset(run.default_dataset_id).iterate_items():45 print(item)46
47# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-startThe Apify API client for Python is the official library that allows you to use spruce_the_data: messy HTML and text to clean JSON API in Python, providing convenience functions and automatic retries on errors.
Install the apify-client
$pip install apify-clientOther API clients include: