php-snapchat icon indicating copy to clipboard operation
php-snapchat copied to clipboard

New Version

Open gidbot-old opened this issue 9 years ago • 188 comments

In snapchat_agent the version needs to be changed to '9.0.1'

Additionally, has anyone been able to post stories since the update?

gidbot-old avatar Jan 29 '15 23:01 gidbot-old

I'm on the 9.0.2.1 beta and a lot has changed, though posting stories shouldn't give any issues. how are you uploading stories?

Snowlav avatar Jan 29 '15 23:01 Snowlav

$snapchat = new Snapchat('uname', 'password'); $id = $snapchat->upload( Snapchat::MEDIA_IMAGE, file_get_contents('/path/to/image.png') ); $snapchat->send($id, array('uname'));

gidbot-old avatar Jan 30 '15 00:01 gidbot-old

If you are using the 9.0+ user agent, you need to make sure you have implemented the new Login parameters.

Check out my working 9.0.2.0 login request here:

http://github.com/liamcottle/snaplib On 30/01/2015 1:07 pm, "gbrosenthal" [email protected] wrote:

In snapchat_agent the version needs to be changed to '9.0.1'

Additionally, has anyone been able to post stories since the update?

— Reply to this email directly or view it on GitHub https://github.com/JorgenPhi/php-snapchat/issues/89.

liamcottle avatar Jan 30 '15 00:01 liamcottle

Logging in isnt the issue. Im able to get users etc... so i know im authenticated

gidbot-old avatar Jan 30 '15 00:01 gidbot-old

Make sure you send all the following data correctly. This hasn't changed at all compared to 8.1.1

User-Agent: Snapchat/9.0.2.0 (Nexus 4; Android 17; gzip)

/bq/retry_post_story

Description

Used to post a story

Request

  • my_story - (Boolean)
  • time - Time to display the snap (Float)
  • group_ids- (Array)
  • media_id - [USERNAME]~[RANDOM UUID] (String)
  • story_timestamp - (Timestamp)
  • zipped - 0 or 1 (Int)
  • caption_text_display - (String)
  • client_id - Same as media_id (String)
  • type - Media type (Int)
  • data - Encoded snap data
  • req_token
  • timestamp
  • username

Response

  • json - (Array)
    • story - (Array)
      • caption_text_display - (String)
      • client_id : Same as media_id (String)
      • id - [USERNAME]~[TIMESTAMP] (String)
      • mature_content - (Boolean)
      • media_id - [USERNAME]~[RANDOM UUID] (String)
      • media_iv - Base64 encoded encryption IV for the snap data (String)
      • media_key - Base64 encoded decryption key for the snap data (String)
      • media_type - Media type (Int)
      • media_url - A URL to fetch the story data, generally https://feelinsonice-hrd.appspot.com/bq/story_blob?story_id=[media_id] (String)
      • thumbnail_iv - Base64 encoded encryption IV for the thumbnail image (String)
      • thumbnail_url - A URL to fetch the thumbnail image, generally https://feelinsonice-hrd.appspot.com/bq/story_thumbnail?story_id=[media_id] (String)
      • time - Number of seconds to display snap (Float)
      • time_left - Time left before expiration of the story (Timestamp)
      • timestamp - Time posted (Timestamp)
      • username - Username of the user who posted the story (String)
      • zipped - (Boolean)

liamjack avatar Jan 30 '15 00:01 liamjack

Sorry, just realized that my example was sending to single users. But i havent been able to do that either haha.

gidbot-old avatar Jan 30 '15 00:01 gidbot-old

But it also looks like a lot of those variables are not set by this library. Ie not in 'function setStory' in the snapchat class, nor 'function post' in the snapchat_agent one

gidbot-old avatar Jan 30 '15 00:01 gidbot-old

The library is not exactly up to date, if you want it to work you need to know what the actual application sends to the API, and then you have to add / remove parameters to each request in the library.

Here is some API documentation : https://github.com/JorgenPhi/php-snapchat/wiki/API-v2-Research

liamjack avatar Jan 30 '15 00:01 liamjack

I'm getting real tired of snapchat and their api updates, I'll tell you that much

Snowlav avatar Jan 30 '15 00:01 Snowlav

Well the API updates are a good thing, it brings new features to the application for us to use and abuse. We just need to keep up with constantly analyzing the application's API calls.

liamjack avatar Jan 30 '15 16:01 liamjack

The latter is hard though, I do not mind it actually, but snapchat is not only adding user features but I have the feeling they are also making it harder for us to abuse every update.

Snowlav avatar Jan 30 '15 18:01 Snowlav

Any fix for this yet? I can login and update snaps and save snaps, but cannot upload or set a story. It just uploads a blank gray thumbnail and disappears when i try to click on it This literally worked yesterday with no change. I tried updating my user agent to 9.0.2, and 9.0.1 and still doesn't work.. What am i missing?

$final1 = "http://-snip-watermark.php?filename=$value"; $id = $snapchat->upload( Snapchat::MEDIA_IMAGE, file_get_contents($final1)); $snapchat->setStory($id,5);

const VERSION = 'Snapchat/9.0.1.0'; CURLOPT_USERAGENT => 'Snapchat/9.0.1.0 (Nexus 4; Android 17; gzip)',

Scape373 avatar Jan 30 '15 18:01 Scape373

I've been able to upload (get a 200 Response), but I havent been able to send single snaps or set my story. If anyone has been able to get this library working in the last couple days, please share.

gidbot-old avatar Jan 30 '15 19:01 gidbot-old

Are you uploading a JPG image ? What responses do you get?

Can you elaborate "I can login and update snaps and save snaps, but cannot upload or set a story. It just uploads a blank gray thumbnail and disappears when i try to click on it" Do you mean on the application?

Snowlav avatar Jan 30 '15 20:01 Snowlav

Remember this lib is outdated guys, if you are mixing new headers with old endpoints, or old endpoints with new endpoints etc, it will not work. Which endpoint are you guys using to login and which are you using to set story.

In the new versions of snapchat you no longer need to use upload and send but simply post to story.

We need more information than that is given right now.

Snowlav avatar Jan 30 '15 20:01 Snowlav

Speaking of outdated, if anyone wants access to accept pull changes and write to the repo directly, let me know. I don't have the time to keep this relevant. On Jan 30, 2015 2:14 PM, "Snowlav" [email protected] wrote:

Remember this lib is outdated guys, if you are mixing new headers with old endpoints, or old endpoints with new endpoints etc, it will not work. Which endpoint are you guys using to login and which are you using to set story.

In the new versions of snapchat you no longer need to use upload and send but simply post to story.

We need more information than that is given right now.

— Reply to this email directly or view it on GitHub https://github.com/JorgenPhi/php-snapchat/issues/89#issuecomment-72263354 .

JorgenPhi avatar Jan 30 '15 20:01 JorgenPhi

So what you are saying is my code should look more like this now?:

It's still not working.. :(

Gets contents of folder uploads the images in the folder

$directory = 'saved'; $scanned = array_diff(scandir($directory), array('..', '.')); foreach($scanned as $value){ //Watermark $snapchat->setStory($value,5); var_dump($value); }

$value comes out as a string: string '6.jpg' (length=5)

Scape373 avatar Jan 30 '15 22:01 Scape373

Logging in with 9.0.2.0's API is pratically impossible for the Android version. They have started checking device tokens, so you need to fetch a valid device token before logging in, and there is a new "Authorization" header containing a Google OAuth2 token....

liamjack avatar Jan 31 '15 17:01 liamjack

@cuonic isn't the google oath2 token optional, and by device token do you mean a device ID ? These can be generated pretty easy right ?

Snowlav avatar Jan 31 '15 17:01 Snowlav

It's no longer option, if you don't provide the "ptoken" on login you get "401 UNAUTHORIZED", if you create one randomly you get "Oh no! Your login temporarily failed, so please try again later. If your login continues to fail, please visit https://support.snapchat.com/a/failed-login :)"

The message doesn't change when adding or removing the Authorization header

On 31/01/2015 18:49, Snowlav wrote:

@cuonic https://github.com/cuonic isn't the google oath2 token optional, and by device token do you mean a device ID ? These can be generated pretty easy right ?

— Reply to this email directly or view it on GitHub https://github.com/JorgenPhi/php-snapchat/issues/89#issuecomment-72327909.

liamjack avatar Jan 31 '15 17:01 liamjack

hmm so we would need to fetch valid info first using fiddlr or something alike, and once logged in store auth token, that is if we are using the 9.0.2.0 api. Is this correct, or not possible?

Snowlav avatar Jan 31 '15 17:01 Snowlav

Yeah, but that's not really a solution, you shouldn't have to run the official application along side just to get tokens, we need to emulate this.

On 31/01/2015 18:56, Snowlav wrote:

hmm so we would need to fetch valid info first using fiddlr or something alike, and once logged in store auth token, that is if we are using the 9.0.2.0 api. Is this correct, or not possible?

— Reply to this email directly or view it on GitHub https://github.com/JorgenPhi/php-snapchat/issues/89#issuecomment-72328243.

liamjack avatar Jan 31 '15 18:01 liamjack

I like this challenge

Snowlav avatar Jan 31 '15 18:01 Snowlav

But I question if it's feasible

Snowlav avatar Jan 31 '15 18:01 Snowlav

is it possible to bring out an api lib for a previous no longer supported by snapchat version, without getting our accounts banned?

Snowlav avatar Jan 31 '15 18:01 Snowlav

Well using 8.1.1's API for the moment will probably work for a while, but then they will kill it.

On 31/01/2015 19:05, Snowlav wrote:

is it possible to bring out an api for a previous no longer supported by snapchat version, without getting our accounts banned?

— Reply to this email directly or view it on GitHub https://github.com/JorgenPhi/php-snapchat/issues/89#issuecomment-72328573.

liamjack avatar Jan 31 '15 18:01 liamjack

Any other options? Long term solutions?

Snowlav avatar Jan 31 '15 18:01 Snowlav

I've seen the OAuth thing before it became mandatory in the beta, AFAIK it looks like signing up does not have to use OAuth though. And the ptoken is new to me.

@Snowlav We can only look inside the APK I guess, unless there are other solutions.

hako avatar Jan 31 '15 18:01 hako

@hako inside the APK you mean modding the apk or reverse engineering it in the hopes of finding a solution?

Snowlav avatar Jan 31 '15 18:01 Snowlav

ptoken is the Google Cloud Messaging Registration ID, it's the same value that you post to /ph/device in the device_token param. It's used by the snapchat server to send notifications to your device via GCM.

As for logging in, I have noticed they have made the header Authorization mandatory. Also, it must be a valid one...

If you pass a blank value in the Authorization header, you'll get a 401, the snapchat server checks the Google servers (I guess) to check if the Bearer value is legit, if not 401...

I have made a successful login by using an already created bearer for the Authorization header from a snapchat app login request.

So, if we can make valid value for the Authorization header, we can get in.

liamcottle avatar Jan 31 '15 22:01 liamcottle