Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Online JSONP converter/wrapper

I would like to fetch a source of file and wrap it within JSONP.

For example, I want to retrieve pets.txt as text from a host I don't own. I want to do that by using nothing but client-side JavaScript.

I'm looking for online service which can convert anything to JSONP.


YQL

Yahoo Query Language is one of them.

http://query.yahooapis.com/v1/public/yql?q=select%20*%20from%20html%20where%20url%3D"http://elv1s.ru/x/pets.txt"&format=json&callback=grab

This works if URL is not blocked by robots.txt. YQL have respect to robots.txt. I can't fetch http://userscripts.org/scripts/source/62706.user.js because it blocked via robots.txt.

http://query.yahooapis.com/v1/public/yql?q=select%20*%20from%20html%20where%20url%3D"http://userscripts.org/scripts/source/62706.user.js"&format=json&callback=grab

"forbidden":"robots.txt for the domain disallows crawling for url: http://userscripts.org/scripts/source/62706.user.js"


So I'm looking for another solutions.

like image 506
NVI Avatar asked Jan 25 '10 10:01

NVI


People also ask

How do I beautify JSON in Notepad ++?

To install the plugin do the following steps: Open notepad++ -> ALT+P -> Plugin Manager -> Selcet JSON Viewer -> Click Install. Restart notepad++ Now you can use shortcut to format json as CTRL + ALT +SHIFT + M or ALT+P -> Plugin Manager -> JSON Viewer -> Format JSON.


2 Answers

I built jsonpwrapper.com.

It's unstable and slower than YQL, but it doesn't care about robots.txt.

like image 93
NVI Avatar answered Sep 29 '22 11:09

NVI


Here's another one, much faster, built on DigitalOcean & CloudFlare, utilizing caching et al: http://json2jsonp.com

like image 21
fevangelou Avatar answered Sep 29 '22 09:09

fevangelou