Get Download Link from Google Generated URL - php

i've been stuck on this error for over some days now.
I have this app, that helps do some youtube conversion.
I am using Youtube DL for the conversion, and after that, it generates a unique api in the form
https://r17---sn-p5qlsnl7.googlevideo.com/videoplayback?key=yt6&gir=yes&expire=1506012043&mt=1505990314&sparams=clen%2Cdur%2Cei%2Cgir%2Cid%2Cip%2Cipbits%2Citag%2Ckeepalive%2Clmt%2Cmime%2Cmm%2Cmn%2Cms%2Cmv%2Cpl%2Crequiressl%2Csource%2Cexpire&pl=23&dur=727.741&lmt=1502263140756131&ip=54.147.55.117&ms=au&keepalive=yes&ei=K5fDWY3TFe6S8gSCjJnwBw&mv=u&source=youtube&id=o-AMxd1cK50iCKgEiy6DllYTFo-SeXUKSQ1fpmR3vdgsVa&mn=sn-p5qlsnl7&mm=31&signature=D5A495AD2061D93871BFDB91BF3843B061E5C73A.32EB5728DA132892E6CAA88581C77352DC6AC097&requiressl=yes&clen=10878177&itag=251&ipbits=0&mime=audio%2Fwebm&ratebypass=yes
The problem now is, the link above expires after 24 hours or less, and when i click on it, it takes me to a web browser with the media version, and when i click on download, it stores the file as videoplayback which at most cases does not play on using my pc's audio/video player.
How do i download the audio from the link directly, and also give it a unique name, instead of videoplayback..
Please help//

Related

How to save a file in a hidden location php

I have to build an application where users can download videos from a site but cannot share them. My first solution is to save these files in a hidden location on the users computer since one of the requirements is that the user should be able to watch the downloaded videos offline.
Please how do I go about saving a file in a location the user cannot see using php.
Thanks.
One solution is to generate token for each request for a video. That token would have its lifetime. Php script should be serving the content instead of giving direct access to resource to user. The script should check if the token is still active before serving the content.
It is up to you how to pass the token. The simplest way is to make it contained in uri.
No matter where you put your videos in your directory structure, you always send the data as a partial request. Once data is acquired by the user, it could be saved an reproduced.
There are techniques, however, to protect your video from direct download through curl, wget or other ways of download. And this is using a secure token and an expiration, passed as parameters. This way your video download window will be limited and generating the token manually would be pretty hard.
Chidiebere Onwunyirigbo, its a Great Question. One solution for your requirement is Steganography. It is the process of concealing your data (videos) behind other files (multimedia files like image, audio, video), in your case preferable would be Image Steganography. It is quite a old technology but new to many, you can get several ready tools/code for it on the internet which you can customize as per your need. From your side you have to provide the file that is already embedded inside the image for download. Only the tool coded for retrieval and rendering the hidden video can render your video. So, for this part all the users of your site have to first download this desktop application from your site for viewing the video. This will keep your videos safe on the users computer offline, because every user who takes the video will require the reverse steganography tool to be downloaded from your site. You can even embed secret info like users IP inside the Stego image along with the video and for each tool download, associate user computer's IP with the tool. If IP embedded inside Stego image matches with that of tool only then you allow to play else redirect application to get it registered. But the limitation would be that, the users will have to download your application and will be able to view videos only on your desktop application which will render the Steganographed video.
You cannot hide information on the user computer. Even if your process are running on a windows comp as SYSTEM user, a power user can take ownership of the files.
The only solution you have, are developing or using a known DRM system, for allowing only playing the video on a determined computer or another specifications (for example, if the program have the authentication token of some user).
At any case, you need to do two things for this:
- You need a custom application to play the video, if you want to check DRM.
- You need to recode / modify something on the video before download, for adding on them a code for allow only play on the destination computer or data used for authenticating DRM.

Getting file as logged in user

I wanted to ask if the follow is possible in PHP. Let's say there is a file on my google drive with the ID '123-abc', would it be possible to fetch it as if I was logged in to my account, without using the API?
Let's say I'm trying to download a file from 'https://drive.google.com/uc?export=download&id=123-abc', is there a way to tell the website i'm signed in by logging in with PHP? I also don't want to make the file public.
See https://developers.google.com/drive/v3/reference/files#resource for the available video metadata. Specifically:-
videoMediaMetadata object Additional metadata about video media. This
may not be available immediately upon upload.
videoMediaMetadata.width integer The width of the video in pixels.
videoMediaMetadata.height integer The height of the video in pixels.
videoMediaMetadata.durationMillis long The duration of the video in
milliseconds.
I suggest you use the "try it now" facility of https://developers.google.com/drive/v3/reference/files/get to get a file and see if the vailable meta data is what you are looking for.

obfuscating video url / video link

Is there any way from which i can obfuscate my video url or video link ? I am embedding video in <video> of html 5. I have disabled right click of the page using jquery. But still user can download video thru download manager. I want to restrict it. How can i do it?
My website is in Opencart 2
If the user can view the video, you CAN'T restrict the download.
As a side note, any attempts to restrict user access to elements that he/she can see or interact are a waste of time, any savvy user will bypass them easily.

JW Player Google Analytics Pro tracking

I am working on a video listing website which uses JW Player and its plugins. Embed code of the video can be placed anywhere in the web but we need to track which video plays in which site and its count of views and plays.
We are using Google Analytics Pro plugin for JW Player to track the traffic. But is there any way for me to track the report to
See all the sites that the player is embedded on to see how many people played the video from that site
How many plays are done for each video from from these sites
Exactly which videos are played
Currently we are using following code inside JW Player
s1.addVariable('gapro.accountid', 'UA-21590286-1');
//alert(this.data.captions[this.slide])
s1.addVariable("gapro.trackstarts","true");
s1.addVariable("gapro.trackpercentage","true");
s1.addVariable("gapro.tracktime","true");
s1.addVariable("gapro.idstring","||Channel Name||-||Story Name||");
Following is a sample embed code for playing a video..
Thanks in advance for the support.
Best Regards
Deepu S Nath
The JW GA plug-in should report which site is hosting the player in the Hostname parameter.
1/ Check that when you play a video on your player embedded on a site, a GIF request is sent to google-analytics.com :
http://www.google-analytics.com/__utm.gif?
utmwv=4.9.2&utms=2&utmn=1209321314&
utmhn=www.longtailvideo.com&utmt=event&
utme=5(Video%20Plays*http%3A%2F%2Fcontent.longtailvideo.com%2Fvideos%2Fbunny.flv*
http%3A%2F%2Fwww.longtailvideo.com%2Faddons%2Fplugins%2F107%2Fget-examples.html%3Faddon%3D107%26vid%3D292%26q%3D)
(I have truncated the request which should be much longer).
2/ Confirm that the utmhn value reported is the hostname of the site where the player is hosted. It looks like the JW player plug in reports the Video Play as an Event where the Category is Play, Action is the file source URL and Label is the URL where the video is played.
3/ In Google Analytics, look for a report displaying Event Labels by Hostnames (or create it using a custom report). You should use a filter to view only Event Label = "Video Plays".
This should show you how many plays you had from each site. You can use similar reports to view which video were player from each site (using Event Action).
On a final note, I do not think that the JW player is tracking 'Load' events - when the player is loaded, so you won't see if a player was loaded but no video played. You can confirm by checking if a GIF request is sent when the player is loaded.
I just found that there is no direct solution for my requirement using the google pro plugin.. Instead we implemented a custom solution as follows..
Created a custom Tracker which uses the google analytics APIs directly instead of "Google Analytics Pro" plugin. For that I have Utilized the JWplayer API to interact with the video player and get the video related data and it was be passed to the Google Analytics API. Later in the Google Analytics account, created a custom report with the required metrics and dimensions.. This helped me to get all the tracking details and create the required report. :) I really appreciate the support I got from Antoine which helped me to understand some basics and move towards a solution.
I just checked your site and found that the embed code consists of iFrame and this is the reason why you are unable to track the hostname at which the embed video gets played.As you are using iframes in the embed video code, you wont be able to track the site details were the video is embedded. You always get storybridge.tv as the site url. (iFrame do not support cross domain interaction)
To avoid this problem we have to use tag (Similar to old Youtube Embed Code) which will help the plugin to get the details of the site at which video is played.

How to make it difficult to download a video except with player

I'm creating a video sharing website like YouTube. I want to make it so that it is difficult to download the videos to your hard drive. I want them to still be able to download the videos into F4Player just like any other video.
I am going to make it so that when somneone requests a video using the ID, a PHP script uses the ID to find the real filepath to the video. The PHP script then passes the video, that way no one will find where the video is actually stored. I also have htaccess set up so that no one can hotlink to my images or videos.
What else can I do?
EDIT: If it was the only way to get what I need I'd be wiling to make my own player in Java instead of using F4layer, but I strongly prefer using F4Player.
Write your own client side browser plugins, that would handle your proprietary encrypted connection to the video stream.

Categories