Grab link contained in a JS script

Asked

Viewed 271 times

0

I need to create a function that locates and places the value of a link contained in a javascript in a variable for another function to use this variable later.

Let’s go to the real example:

The code is contained within a "script" TAG belonging to an "iframe". Iframe code:

<iframe class="embed-responsive-item" src="https://player.vimeo.com/video/163969741?autoplay=true" frameborder="0" allowfullscreen=""></iframe>

I need to locate within this "iframe" the following information:

{"profile":164,"width":640,"mime":"video/mp4","fps":30,"url":"https://gcs-vimeo.akamaized.net/exp=1507047701~acl=%2A%2F519593631.mp4%2A~hmac=781e23a73042594f4bf64f28d21e5c59171367a3bbcf0753a578d2be56cbd7e9/vimeo-prod-skyfire-std-us/01/2793/6/163969741/519593631.mp4","cdn":"akamai_interconnect","quality":"360p","id":519593631,"origin":"gcs","height":360}

And then treat that information so that only the:

https://gcs-vimeo.akamaized.net/exp=1507047701~acl=%2A%2F519593631.mp4%2A~hmac=781e23a73042594f4bf64f28d21e5c59171367a3bbcf0753a578d2be56cbd7e9/vimeo-prod-skyfire-std-us/01/2793/6/163969741/519593631.mp4

This is the site where the real iframe is: https://www.comofaz.com.br/video/como-calcular-limites

  • If Vimeo does not have authorized/open CORS you cannot access the contents of that iframe.

  • Um. Can you confirm that for me please?

  • Remembering that I only able to select the video link manually, but I would like to do this automatically if possible, as I did with Openload.co a while ago.

  • This iframe HTML code is generated by you? or a embeded?

  • It is being generated by the page I put at the end of the post. It is a site of video tutorials.

  • You can’t do anything with an iframe from another domain via JS. You could do this with PHP or ASP, for example.

  • How would it look in php then?

Show 2 more comments
No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.