dinubs/jam-api
dinubs/jam-api has 1,358 GitHub stars and 57 forks. GitHot measured 0 stars in 24 hours. Last checked 2026-11-08 06:33 UTC. Last push 2019-05-13.
Parse web pages using CSS query selectors
Measured star growth
- in 24h
- 0
- in 7 days
- Collecting history
- in 15 days
- Collecting history
- in 1 month
- Collecting history
Net star changes over overlapping periods, not daily totals. Missing measurements are left blank. Stars measure attention, not software quality.
README.md
OriginalThis project is no longer active developement, please see CoolQLCool for a similar more active project (ref)
Jam API
Jam API is a service that allows you to turn any site into a JSON accessible api using CSS selectors. To get started simply run a post request to https://www.jamapi.xyz with formdata of "url" and "json_data", here's an example of what your data should look like:
{
"title": "title",
"logo": ".nav-logo img",
"paragraphs": [{ "elem": ".home-post h1", "value": "text"}],
"links": [{"elem": ".home-post > a:first-of-type", "location": "href"}]
}
Using API you can simply generate JSON data from any website.
Code samples
nodejs
const request = require('request');
request.post('https://www.jamapi.xyz/', {form: {url: 'http://www.gavin.codes/', json_data: '{"title": "title"}'}}, function(err, response, body) {
console.log(body);
})
Javascript
fetch('https://www.jamapi.xyz', {
method: 'POST',
headers: {
'Accept': 'application/json',
'Content-Type': 'application/json'
},
body: JSON.stringify({
url: 'http://www.gavin.codes/',
json_data: '{"title": "title"}'
})
}).then(function(response) {
return response.json();
}).then(function(json) {
document.body.innerHTML = json;
});
Ruby
require 'httparty'
response = HTTParty.post("https://www.jamapi.xyz/",
:body => { "url" => "http://www.gavin.codes/", "json_data" => "{'title': 'title'}"})
puts response.to_json
Python
import requests
payload = {'url': 'http://www.gavin.codes/', 'json_data': '{"title": "title"}'}
r = requests.post("https://www.jamapi.xyz", data=payload)
print(r.json())
curl
curl -X POST \
-F 'url=http://www.gavin.codes/' \
-F 'json_data={"title":"title"}' \
https://www.jamapi.xyz
Features
Will auto pull the img src on corresponding elements, will auto pull the href from links. If passing JSON, you must provide a "elem" property, and then the element attributes you want. When you pass an array with JSON you'll get a structure that looks as follows:
[
{
"index": 0,
"value": {
"value": "Porter Robinson – Sad Machine (Cosmo’s Midnight Remix)"
}
},
{
"index": 1,
"value": {
"value": "Listen to Rachel Platten’s “Stand By You”"
}
}]
All the attributes you provide as JSON will be put inside of the value property, and the index property is to be able to track what index it ocurred in the DOM. I nested JSON values into it's own so that you can still have an "index" property returned and not run into issues.
How it works
Main power of the program is in services/html_to_json.js. Start site with node index after doing npm install.
Suggested node version is at least 4.2.2
Explore related projects
freeCodeCamp/freeCodeCamp
freeCodeCamp.org's open-source codebase and curriculum. Learn math, programming, and computer science for free.
458,738 starsdonnemartin/system-design-primer
Learn how to design large-scale systems. Prep for the system design interview. Includes Anki flashcards.
377,305 starsreact/react
The library for web and native user interfaces.
252,401 starsvuejs/vue
This is the repo for Vue 2. For Vue 3, go to https://github.com/vuejs/core
212,629 stars