0

I am trying to perform a hack, what my primary goal is to get the mp4 links of youtube videos. In past, I have been downloading the text file from http://www.youtube.com/get_video_info?video_id=videoidand extracting the links from there, this works in the apps but in browser its not possible because its a cross site request and browsers do not allow it.

To counter this I used easyXDM, now the problem is the file is being downloaded on the user's machine instead of opening in Javascript. Here's the easyXDM code

$(document).ready(function(){  var socket = new easyXDM.Socket({
        remote: "http://www.youtube.com/get_video_info?video_id=PBOBJRto728", // the path to the provider
        onMessage:  getVideo
    }); 
   });

Here's the page http://www.voltsoft.com/default.html, you can go there and see what's happening.

How can I read the data from the file in javascript?

Ashwin Singh
  • 7,197
  • 4
  • 36
  • 55

1 Answers1

0

easyXDM is not going to faciliate your needs. In order for easyXDM to function you need it hosted on the two domains you want to communicate between. In this case you need it on both voltsoft.com and youtube.com. You can't use easyXDM here because you can't upload arbitrary HTML/JS content to youtube.com.

Generally the solution in this situation is that you either need to proxy the remote contents server-side or you need the cooperation of the remote server.

chashi
  • 486
  • 1
  • 3
  • 9
  • As you can see its actually working, earlier it was not possible to get the file, because of youtube not allowing cross domain call, but now with XDM youtube is atleast returning the file, the only problem being I can't open the file in js, its going directly for download. – Ashwin Singh May 29 '13 at 09:25
  • Ah, but it's not working the way you believe it to be. What's happening is that easyXDM is trying to open an iframe to the remote provider. The remote provider is easyXDM specific. On your page, you've misconfigured your remote parameter by pointing it to the ultimate resource you want to retrieve instead of the remote easyXDM provider. Because of this misconfiguration, easyXDM is incorrectly trying to open an iframe to the youtube url you specified. Your browser then downloads the response of that youtube url I think because the youtube response indicates X-Frame-Options:SAMEORIGIN. – chashi May 29 '13 at 13:30
  • No, you can't use easyXDM here since you can't put easyXDM onto the youtube.com domain. – chashi May 30 '13 at 17:41
  • Was browsing other posts and found this, perhaps this will fit your needs: http://stackoverflow.com/a/12941673/2167396 – chashi May 30 '13 at 17:45