php-snapchat
php-snapchat copied to clipboard
Download video with overlay
When I try to download a snap that contains a video and a drawing/text, only the drawing/text layer is downloaded as a video... how can I download both with one request?
When the video has an overlay, the returned object is an array consisting of 'filename'->'data content' key-value pair Of length 2. One is overlay the other is video.
I'm not on my PC and don't remember exactly which.
You'd want to check if the return is an array, if so then foreach the array writing the data to a different file.
Sent from my iPhone
On Jul 22, 2014, at 22:05, Eberth Manjarrez [email protected] wrote:
When I try to download a snap that contains a video and a drawing/text, only the drawing/text layer is downloaded as a video... how can I download both with one request?
— Reply to this email directly or view it on GitHub.
Just to add;
- array(
- overlay~zip-CE6F660A-4A9F-4BD6-8183-245C9C75B8A0 => overlay_file_data,
- media~zip-CE6F660A-4A9F-4BD6-8183-245C9C75B8A0 => m4v_file_data
- )
Sent from my iPhone
On Jul 22, 2014, at 22:05, Eberth Manjarrez [email protected] wrote:
When I try to download a snap that contains a video and a drawing/text, only the drawing/text layer is downloaded as a video... how can I download both with one request?
— Reply to this email directly or view it on GitHub.
Am I doing something wrong? Not working, its creating empty files...
if(!is_array($data)) { //if not an array, then just save the video.. $data = $snapchat->getMedia($id); $filename = 'media/'. $sender . '-snap-video-' . $sent . '.mp4'; file_put_contents($filename, $data); } else { //overlay $filename = 'media/'. $sender . '-snap-overlay-' . $sent . '.png'; file_put_contents($filename, $data[0]);
//video file $filename = 'media/'. $sender . '-snap-video-' . $sent . '.mp4'; file_put_contents($filename, $data[1]); }
The array is a key value pair. There is no '0'. If you want you can use: $keys = array_keys($data); $overlay_key = $keys[0]; $media_key = $keys[1];
$overlaydata = $data[$overlay_key]; $mediadata = $data[$media_key];
Sent from my iPhone
On Jul 22, 2014, at 23:50, Eberth Manjarrez [email protected] wrote:
Am I doing something wrong? Not working, its creating empty files...
if(!is_array($data)) { //if not an array, then just save the video.. $data = $snapchat->getMedia($id); $filename = 'media/'. $sender . '-snap-video-' . $sent . '.mp4'; file_put_contents($filename, $data); } else { //overlay $filename = 'media/'. $sender . '-snap-overlay-' . $sent . '.png'; file_put_contents($filename, $data[0]);
//video file $filename = 'media/'. $sender . '-snap-video-' . $sent . '.mp4'; file_put_contents($filename, $data[1]); }
— Reply to this email directly or view it on GitHub.
thanks, that worked perfectly!
Hi, me again... it worked for snaps, but for stories I think there's something missing, I guess the whole zip to array code you wrote for the snaps has yet to be implemented for stories, or does it work differently?
I've actually never tested it on stories. I didnt realize stories uses a different method to get the media; so it doesn't test if it was zipped or not. I'll look into adding it. At the moment what you could do is check if the first two bytes are x50 x4B (hex), then perform the unzip operation.
Hi, is it possible to upload videos with an overlay? As in, let's say I downloaded the video and overlay from someone, can I "forward" that in the same way it came?
Never mind, I figured it out :) All I had to do was deactivate the unCompress method and use it manually when necessary. Thanks!!
Yup. Maybe it should be an option, defaulted to unCompress that can be overridden.
On Sun, Nov 2, 2014 at 9:03 PM, felipeedoardo [email protected] wrote:
Never mind, I figured it out :) All I had to do was deactivate the unCompress method and use it manually when necessary. Thanks!!
— Reply to this email directly or view it on GitHub https://github.com/JorgenPhi/php-snapchat/issues/39#issuecomment-61434290 .
True. Unfortunately, even though the ZIP stays intact, Snapchat doesn't seem to accept it as an upload. I went really deep into the code and just can't figure out the reason, since the data that I'm sending to be encrypted and uploaded is exactly the same data that I had just received from the API.
So I'm trying to figure out why that is.
I am able to upload the zipped file and get a media id back, however if I use that mediaID to send the snap it will not send and throw a 415 Http error.
PS: Any luck with this? Someone?