News for hackers. Stuff that matters.
Re:Show HN: Jam API, turn any site into a JSON api using CSS... by WA on Thursday April 28, 2016 @06:09AM (#11587634)
HTTPS results in 500 Internal Server Error.

Edit: Well no, it's only some sites. E. g. https://medium.com

Re:Show HN: Jam API, turn any site into a JSON api using CSS... by diggan on Thursday April 28, 2016 @06:26AM (#11587681)
If you're running the example on the website/in a browser, it's probably CORS stopping you.

Try using a backend language or just curl and it should be fine.

Re:Show HN: Jam API, turn any site into a JSON api using CSS... by WA on Thursday April 28, 2016 @06:38AM (#11587734)
Well no, because my browser isn't doing the request. The underlying Node app (the Jam API) does it.

I found it: The API responds with an HTTP 500 error if you use CSS selectors that don't select anything or are simply invalid.

Probably makes sense to add some Exception handling right there.

Re:Show HN: Jam API, turn any site into a JSON api using CSS... by gavino on Thursday April 28, 2016 @06:46AM (#11587777)
I had been trying to figure out what would be causing this issue, thanks for pointing it out, I've pushed a fix real quick that will respond whether JSON is invalid or a CSS selector wasn't found on the provided URL.
Re:Show HN: Jam API, turn any site into a JSON api using CSS... by learned on Thursday April 28, 2016 @06:21AM (#11587667)
I'm also getting 500s. Looks to be a CORS issue. I've tried about a dozen big name sites so far without any luck.

Nonetheless, a great idea!

Edit: Just tried it in Node and it works brilliantly. Cool project.

Re:Show HN: Jam API, turn any site into a JSON api using CSS... by danielsamuels on Thursday April 28, 2016 @06:17AM (#11587659)
A CORS restriction perhaps?