0

So I noticed you can GET request (curl/wget) youtube.com and it's paths from the command line, but not from any website (except youtube obviously) using XMLHttpRequest due to YT not allowing cross-origin etc. My question is, is there ANY way around this?

  • see [**Loading cross domain html page with jQuery AJAX**](http://stackoverflow.com/q/15005500/1407478) for multiple online solutions, you can also [create a proxy by yourself](http://stackoverflow.com/q/23607901/1407478) (PHP example). – davidkonrad Oct 13 '15 at 11:40
  • _..due to YT not allowing cross-origin._ This is wrong. That's due to [the same-origin policy](https://en.wikipedia.org/wiki/Same-origin_policy) which is implemented by client (browser), not youtube. – hindmost Oct 13 '15 at 11:45

2 Answers2

0

If you specifically want to access youtube data then you can use their API's. https://developers.google.com/youtube/.

If you want to access any other site through XMLHttpRequest, then it is not possible, without the permission of the other sites.

Prabhas Nayak
  • 282
  • 1
  • 4
0

By default it's restricted to make such cross-origin requests. There is exception, you can use JSONP technique, which is allowing doing that. Howewer, service which you're asking for a data should implement possibility to answer with JSONP.

ykravv
  • 291
  • 2
  • 7