

ASk HN: A json - jsonp proxy service - retube

Hi All,<p>I've run up against the cross-site ajax issue of not being able to request a json from another domain. Sadly this domain does not offer a jsonp alternative.<p>Of course I can write/host my own proxy, but 1) I was wondering whether there are any proxy services already available (Yahoo yql?) or 2) if not, whether it would be worth setting one up for public use?<p>Feedback/thoughts appreciated!
======
paulirish
<http://jsonpify.com/> is probably ideal for you.... The API is like
[http://jsonpify.com/api?url=XXX&format=xml&jsonp=myc...](http://jsonpify.com/api?url=XXX&format=xml&jsonp=mycallback)

but you can also do this with <http://pipes.yahoo.com/pipes/> and
<http://developer.yahoo.com/yql/console/> . Both are excellent and used often
for this exact purpose.

~~~
donohoe
I've used YQL via the Console and works a charm unless the site prohibits it
in its robots.txt (like Google Image Search)
<http://developer.yahoo.com/yql/console>

------
petercooper
Does the other domain have a CORS policy? If so:

[http://ajaxian.com/archives/cor-blimey-cross-domain-ajax-
is-...](http://ajaxian.com/archives/cor-blimey-cross-domain-ajax-is-really-
here)

~~~
retube
No idea. Thanks for the link, I'll investigate.

~~~
pmjordan
It should be noted that as far as I know, CORS only works with FF 3.5+, Safari
4+, Chrome (4+?), IE8+ and current versions of Mobile Safari. You'll still
need a JSON(p) proxy for others, but if CORS is supported by the server, it's
worth using just for the speed gain & bandwidth savings.

------
charliepark
Check out GDATA (from Google) and YQL (from Yahoo). Actually, here's a
tutorial that goes into using jQuery and YQL:
[http://ajaxian.com/archives/using-yql-as-a-proxy-for-
cross-d...](http://ajaxian.com/archives/using-yql-as-a-proxy-for-cross-domain-
ajax)

~~~
retube
ok great thanks. I'll try and hack it to avoid using jQuery though, not a huge
fan of using libs if only utilising a single feature/function

------
pierrefar
I set up exactly this thing yesterday with Yahoo Pipes. But they're having
problems these days (apparently since December): lots of connection refused
errors and others. Some bloggers "broke up" with the service and others were
more blunt.

~~~
retube
do you pay for this? Are there caps on usage or restrictions on application
types you can use it for?

~~~
pierrefar
All free. Start here: <http://pipes.yahoo.com/pipes/docs?doc=overview>

~~~
retube
Cool, thanks. Just thinking, but is there not a way in javascript to just get
the contents of a URI as a string? Which you could then eval? Presumably this
will be possible with WebSockets?

------
lenni
I think Yahoo pipes does what you need: <http://pipes.yahoo.com>

~~~
retube
ok, interesting. I know nothing about pipes, so will look it that. Thanks.

~~~
buro9
Pipes is a wonderful thing, you can do a lot with it (like consume Google
Analytics emails with it to be able to make public charts by scraping the
analytics XML attachments and surfacing them as public JSON:
<http://blogoscoped.com/archive/2008-01-17-n73.html> ).

The only problem with pipes is that if you're building anything that you will
depend on (rather than it being a "nice to have") then your service now wholly
depends on Yahoo maintaining pipes.

The question I always fall back to is, "Do I want my service to be wholly
dependent on a third party if I can avoid it?". As you can avoid it, I'd
choose to write my own proxy in this instance.

