jorgenphi / php-snapchat Goto Github PK
View Code? Open in Web Editor NEWA PHP library for the Snapchat API - With Commit History
License: MIT License
A PHP library for the Snapchat API - With Commit History
License: MIT License
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?
The script works fine but when i let the cron run overnight it ends op saying:
"get auth_token failed"
I think this is caused because it keeps relogin every time instead of saving the auth_token to a file for reuse.
I'm having issues with the stories decryption (snaps are still okay), have Snapchat's encryption methods changed or are other people experience the same issue? Any ideas as to what they're doing now?
Hi,
How can I download the photos and the videos that is taken by my self? I don't want to download my friends snaps, I just want to download the pictures and the videos that I take.
Best regards
Bryan
Snapchat::$cache can be null or not defined in getUpdates and getFriendStories, when login fails or after a logout.
Code to reproduce:
$snap = new Snapchat('gjdrglkmdr', 'gdkrweokew'); // invalid username and password combination
$snap->getUpdates();
outputs
PHP Notice: Undefined property: Snapchat::$cache in C:\Users\Gabriel\Documents\
GitHub\php-snapchat\src\snapchat.php on line 234
Notice: Undefined property: Snapchat::$cache in C:\Users\Gabriel\Documents\GitHu
b\php-snapchat\src\snapchat.php on line 234
PHP Fatal error: Call to a member function get() on a non-object in C:\Users\Ga
briel\Documents\GitHub\php-snapchat\snapchat.php on line 234
Fatal error: Call to a member function get() on a non-object in C:\Users\Gabriel
\Documents\GitHub\php-snapchat\src\snapchat.php on line 234
Hey :)
i have made a small local snapchat site where I can see my snaps on my computer.
And I know that media_type 0 is pictures and 1 is video.
but what does Media_type 3 stand for?
Hi,
I've been working with this api and it's great, but for some reason I just can't login on my account anymore. The login code wasn't changed, it just didn't work anymore.
Is it possible that you arn't allowed on 2 computers to be logged in on the same time?
because that could be the problem.
when I do a login I get an 500 error
I found that it returns a array but it seams to be empty even though i already send a snap to the account present
I've been trying this script but am having trouble with the Login. I am passing my username and password (I verified they are working on the device) but the login keeps failing.
This is my PHP test page :
getSnaps(); echo "2" ; ?>Any help would be appreciated. Thanks.
Hello,
I changed this line:
$media_id = strtoupper($this->username) . '~' . time();
to this:
$media_id = strtoupper($this->username) . '~' . strtoupper(gen_uuid());
in snapchat.php
And the snap sending is working.
You can find the gen_uuid function here.
Hello,
I save the object "$snapchat" in session with this method: http://www.php.net/manual/en/oop4.serialization.php
This avoids having to redo a connection (with a new token) on Snapchat servers at each change of page.
But if I connect to Snapchat with mobile application, it makes a new connection and changes the token. So, the old token saved in PHP session (on my website) is no longer valid.
My question is the following: How to check if the token is still valid? If it is still valid, use it normally. But, if it is no longer valid, make a new connection (reconnect with the login() function).
Thank you in advance.
Best regards,
Yoann
Does anyone know the limitations or prerequisites for the video upload for story board?
is there a resolution / codec / file size limitations?
With the current LIB Version using SnapChat 6.0.2 with iPhone user agent, it returns a response saying we need to upgrade to the new snapchat version.
I can't seem to get more than 49 rows from getAddedFriends.
When I know I have more than 49 friends..
Hi, i have one problem.
When i want to register me, this error as returned :
public 'message' => string 'Please upgrade Snapchat to the latest version to create an account.' (length=67)
I have set const version to 7.0.4 and curl user adgent to 7.0.4 too, please help me...
Hi,
When i run the following code on my machine, I get an fatal error. It worked fine until two days ago.
$snapchat = new Snapchat( SNAP_USER, SNAP_PASS );
$snaps = $snapchat->getSnaps();
Fatal error: Call to a member function get() on a non-object in /www-root/lib/snapchat.php on line 234
Any help would be appreciated!
I encountered an issue using this API, and I traced it down to the API using the 'https://feelinsonice-hrd.appspot.com/bq' endpoint in file src/snapchat_agent.php on line 24. After changing my code to use the https://feelinsonice.appspot.com/ph endpoint, all is well.
Hi,
Thank for your project, it's useful for me and thank again.
I am using upload and send image from your project but the result is always failed. I don't know reason why ? Can you double check services ?
It seems Snapchat has released a big update with a lot of new features, like messaging and video chat - http://mashable.com/2014/05/01/hands-on-with-the-new-snapchat/?utm_cid=mash-com-Tw-main-link
Hi,
I have see recently stories have a problem, after a look, stories meda_type return :
In first, an int (0, 1 or 2), if i refresh, media_type is picture or video, and if i frefresh again, media_type is null.
What is the problem?
Hello, it was working just perfect all the time, but yesterday after snapchat updates(I got some on my phones too) it stopped uploading photos. I not changed anything on my code so I think they changed something inside and now this feature not working...
Can you check and update this? Thank you!
Hello :)
I want to download snap to my computer but I can't find the media id :)
I have done a var_dump to see the array:
$snaps = $snapchat->getSnaps();
var_dump($snaps);
and the array look like this:
0 =>
object(stdClass)[83]
public 'id' => string '255300413927923884r' (length=19)
public 'media_id' => boolean false
public 'media_type' => int 0
.......
but I can't se the media_id? some idea? :)
Hey everybody! I was making great progress analyzing the new API, but my IP address was recently blocked so I figured now would be a good time to fill you all in.
(This was taken from version 5.0.2 on android && is likely missing endpoints. Snapchat refused my SSL certificate for about 25% of the connections.)
/loq is the new major endpoint. It contains:
/login - (nearly identical to /bq/login)
/all_updates
/conversation
/conversations
/conversation_post_messages
/send - (nearly identical to /ph/send)
/bq contains these new endpoints:
/chat_typing
/upload_chat_media
Now, the "chat media" has a different encryption algorithm than snaps, and I have not found a way to decrypt them. Any help on this would be useful.
Use this issue to document any findings in the new API so we can build an updated library. :)
Thanks.
This isn't really an issue with the API, but how would one go about keeping the use logged in throughout multiple pages? It creates an object when you login which is needed to fetch snaps, but if I pass that on using a session variable it messes the object up.
And I can't convert it to a array as the other functions like getSnaps() need it in object form! There are also sub-objects which mess up.
Anyone got any example code they would use to pass the object on or keep the user logged in? I want to use some Ajax to fetch recent snaps ect...
I have noticed that if you log into the Snapchat app, then try and use the username and auth_token with this API you can no longer get any snapchats as the app just made a new auth_token.
What would be the best way to detect that this has happened?
If I do a check to see if any Snaps have been retrieved to see if the API auth_token is still valid I could get false results as there simply could be no new snaps.
Only way I can think of doing it is to see if the "cache" object in the Snapchat object has any contents as I noticed that it is empty if you login the app without logging back into the API.
Ideas?
Having looked into the app, it looks like Snapchat's new chat feature is encrypted (or at least the traffic) to an extent that HTTP Debugging tools Fiddler and Charles cannot capture requests, even with SSL debugging on.
I'm guessing that the chat system is using TCP instead of HTTP to transfer messages.
I've tried Wireshark and TCPDump but no luck.
I can:
Get the chat messages
I cannot:
Post a message.
I just tried in my SnapChat Android App to send a snap to all my 150+ contacts and it was only able to send up to 30 contacts. I tried twice and same result. It's odd snapchat doesn't even block the ability to send up to more than 30 contacts.
Update.. it sends to all. just don't add 30+ sent snaps in feeds.
I was wondering if there's a way to send texts / messages / chat to a user.
What I want to do is build two forms and a button.
One for username of recipient and one for the message, and a "send" button.
Thanks in advance! Uploading stories is going great so far!
Hey everybody. I figured now would be a good time to start looking back at the new snapchat protocol and quickly learned that snapchat [REDACTED]. This makes it much more difficult to proxy the ssl requests. I also tried to change all instances of https:// with http:// using apktool, but the app launches the splash screen, but then crashes. Makes me wonder if the app's signature[REDACTED] or if I am just using apktool incorrectly. Has anyone been able to proxy the new snapchat app?
Just a few minutes ago, when I try to login I only get a false. Anybody noticing the same issue now?
I've noticed today that some stories aren't being decrypted properly, or something...
When a story blob has been fetched successfully and then been decrypted, it outputs data that looks "still encrypted", and that data doesn't seem to resemble any file type at all. Not a jpg, mp4 or gif/png etc.
Has anyone else noticed this lately? or...
Is it possible for the api to be updated to include sending a text based message on snapchat? - i.e. the text messages that are possible with the new version of the app
login succeed, bug getMedia() method fails. Anybody else?
Hello, how to get the media id to retrieve a video or picture?
The documentation is not very clear about this, in the example ('122FAST2FURIOUS334r), the media id used comes from where?
// Download a specific snap:
$data = $snapchat->getMedia('122FAST2FURIOUS334r');
file_put_contents('/home/jorgen/snap.jpg', $data);
I get my good flow yet is there some media id empty :/
Thank you for your help
Hi there,
when I do an output with print_r of the $friends array, I receive details of name, can_see_custom_stories and type.
How can I make the output with only the name?
Dear,
The code for specific story's thumbnail ......
$data = $snapchat->getStoryThumb('[story_media_id]', '[story_key]', '[thumbnail_iv]');
For a common story, [story_key] is absent. I have used here media_key instead of story_key. Is this right?
But still I am not getting any results for thumbnail. It returns like this
87Á���äÿa)ß�kä„ÙEËe»eØm"Œ%JÁþó§|gÅëðâaÛdתv�„_Ó{�óPN»i� =‡ýä³X¯PŽ*ä23¾�Sr�æ��S¨}ŒI&;Å�ÈÆ\òkf¸ñ�U¬
What should I do now?
It's just 10 minutes ago this happened. never changed anything in my host.
Anybody else the same? I can connect using my localhost. I hope it's not my host they blocked. :( any suggestions please? or is somebody here hosting this lib that I can use please?
Does someone else has the problem that no snaps are sent?
Issue solved
Hello i am trying to add a new snapchat user through the API
I have made my self a form with:
I'm sending the form and requesting the next code
$SC = new Snapchat;
getHtml::getTagP($SC->register($_POST['gebruiker'], $_POST['wachtwoord'], $_POST['email'], $_POST['geboortedatum']));
I have puted random in that function an echo with text and found out that it stops at the next line of code (rule 190)
if (!isset($result->token))
{
return FALSE;
}
Now is my next question...
Sorry for my questions, but i couldn't find much information regarding this
Kind regards,
Martin Meijer
SOLVED.
I was trying to download image using getMedia function but it always return false to me even though I pass correct media ID using getSnaps. When I call getSnaps then it returns me something like following.
object(stdClass)#31 (11) {
["id"]=>
string(19) "275650406800983071s"
["media_id"]=>
string(59) "HIGAURAVBHAI~893749F7-3E18-46B5-9B13-7B660DEEB458TEJMEHTA86"
["media_type"]=>
int(0)
["time"]=>
bool(false)
["sender"]=>
string(12) "xxxxxxxxxx"
["recipient"]=>
string(10) "tejmehta86"
["status"]=>
int(2)
["screenshot_count"]=>
int(0)
["sent"]=>
float(1406800983071)
["opened"]=>
float(1406801280703)
["broadcast"]=>
bool(false)
}
Then I pass "id" to function getMedia to get image. But this function always returns me false. Please let me know, what am I doing wrong. Following is my sequence.
while (1)
{
$snaps = $snapchat->getSnaps();
if ( $snaps != false)
{
var_dump($snaps[0]);
echo "Snap ID = ".$snaps[0]->id."\n";
$data = $snapchat->getMedia($snaps[0]->id);
var_dump($data);
file_put_contents('snap.jpg', $data);
break;
}
}
sleep(1);
}
Hello,
I actually use this API for SnapChat. It works perfectly, so thank to the creator and contributor but how we do for add a text with a media (video or image) ?
It will can be very useful to have a caption !
So, if someone can help me, thank a lot !
Hello !
First of all, sorry for bad language, i'm french.
I have make a site with your API, It works perfectly.
But i have some questions.
If i would put my website online, can I have problems with Snapchat?
And the API is safe? Will work always? Because i don't want to remake my website...
And if you want i can post some files i have made for use this API.
Good bye,
Jean.
When downloading a video with text, no data is returned. The test was done on a iPhone 4.
Hi, first off, amazing work reverse engineering this. I was looking at utilising this library for a project, then looked at the Snap Chat Terms of use and got confused, Has anyone used this library for large send outs of snaps? Or is this just an exercise in reverse engineering APIs?
I'm just concerned if I do use this commercially the account could be blacklisted. That would suck..
The upload and send of snaps failed: i receive nothing :/ Can you help me please? (Sorry for my english)
I have successfully imported the snapchat.php file using require_once, seems to logged in successfully as it's returning an object.
But when I try and fetch my feed i'm getting the following errors:
Notice: Undefined property: Snapchat::$cache in C:\xampp\htdocs\snapchat\src\snapchat.php on line 234
Fatal error: Call to a member function get() on a non-object in C:\xampp\htdocs\snapchat\src\snapchat.php on line 234
Any plans on making the library use the "new" API endpoints and formats? Using the old ones increases the speed of getting your server blocked by Snapchat, something I endure continiously.
I have tried it myself but have yet to find a good way to use their new format they send in responses.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.