SyphonX is a tool that extracts data from HTML data, transforming it into JSON of any shape or size. It combines the power of CSS Selectors and jQuery, Regular Expressions, and Javascript into a declarative template format to elegantly solve the simplest to the most complex data extraction problems.
Run the following from the command-line with Node.js v18 or higher...
npx syphonx run $/examples/weather.yaml
The above command should produce an output similar to the below which is the result of extracting the current weather conditions from https://weather.com/weather/today/.
"Anaheim, CA As of 6:55 pm PST 54° Cloudy Day 67° • Night 49° Cloudy alertLevel2 Gale Warning +6 More"
-
npm init es6 -y
to create a new project -
yarn add syphonx
to install the syphonx dependency -
touch index.js
and add the code below to the file
import * as syphonx from "syphonx"
const template = await syphonx.fetchTemplate("$/examples/weather.yaml")
const result = await syphonx.online(template)
console.log(result.data)
-
node index.js
to run
This should produce an output similar to the below which is the result of extracting the current weather conditions from https://weather.com/weather/today/.
"Anaheim, CA As of 6:55 pm PST 54° Cloudy Day 67° • Night 49° Cloudy alertLevel2 Gale Warning +6 More"