Rob-- / SnapWrap

Wrapper for the unofficial and undocumented Snapchat API (using Snapchat's latest endpoints).
MIT License
57 stars 7 forks source link

Incomeing update (SnapWrap is now broken) #14

Closed jkaberg closed 5 years ago

jkaberg commented 9 years ago

Logging into my bot account today I noticed this;

image

Running the very latest git source of SnapWrap

jkaberg commented 9 years ago

This is also now confirmed by

{u'message': u'Visit https://snapchat.com/download to update Snapchat to the latest version to be able to log in.', u'logged': False}

danwatco commented 9 years ago

This would be to do with the user agent that is used when sending the request. It is stated as an iphone that is running an older ios. It should be fine as we are using the latest endpoints. The servers just think you're running an older version. Just ignore the message and continue

danwatco commented 9 years ago

It does still let you log in through the bot right? or not?

ObjectiveTruth commented 9 years ago

Works fine for me. Its just telling you to update your Apple Snapchat app

jkaberg commented 9 years ago

@danwatco No the bot cannot login, the above msg

{u'message': u'Visit https://snapchat.com/download to update Snapchat to the latest version to be able to log in.', u'logged': False}

is what I get when trying to login. I added a print result here https://github.com/Rob--/SnapWrap/blob/master/SnapWrap/Client/__init__.py#L138 to be able to see it

Also it throws an exception:

Traceback (most recent call last): File "snapbot.py", line 14, in bot = CustomBot(*["xxxx", "xxxx"]) File "/opt/snapbot/SnapWrap/snapchat.py", line 12, in init info = self.client.login(username, password) File "/opt/snapbot/SnapWrap/Client/init.py", line 141, in login if 'auth_token' in result['updates_response']: KeyError: 'updates_response'

ObjectiveTruth commented 9 years ago

I'm also getting this error now, tried to change the user-agent to a higher version

'User-Agent': 'Snapchat/8.3.1 (iPhone5,1; iOS 6.1.4; gzip)'

instead of

'User-Agent': 'Snapchat/8.2.1 (iPhone5,1; iOS 6.1.4; gzip)'

and it seems to pass the login but isn't downloading snaps anymore

jkaberg commented 9 years ago

@ObjectiveTruth I tried changing the User-Agent aswell but still getting the same error

Rob-- commented 9 years ago

Meh, I'll look into this soon - if Snapchat are updating the app they might be changing some endpoints such as bq/login. I'll wait to see if they release an update.

jkaberg commented 9 years ago

@Rob-- they released an update today (android), verision 9.4.1.0

melaurent commented 9 years ago

I think this is more complicated that a simple endpoint change. As I read on an issue on the repo php-snapchat, it looks like they have a new api more secure and just stopped supporting the old one.

ObjectiveTruth commented 9 years ago

Sifting through it all heres what I've found: Login is fine, because the get_updates returns valid JSON data with the expected information The issue I believe is with get_blob() specifically on this line's call to decrypt()

According to this documentation, the response is only 200 OK if the id provided is valid, which it does.

You can check by extracting out the self._request() into an object and viewing the status_code attribute

jkaberg commented 9 years ago

@ObjectiveTruth You sure your not using the login token somehow(cache)? I'm getting the update message no matter what user-agent I use

EDIT: Sorry about that instead of editing Client/init.py I edited the header parms in Client/utils.py and now I'm getting unauthorized

jkaberg commented 9 years ago

Seems these guys got it going again, https://github.com/mgp25/Snap-API

I'm not to familiar with PHP tho :-/

danwatco commented 9 years ago

Do you know what they did to make it work? Was there a specific commit? @jkaberg

jkaberg commented 9 years ago

@danwatco No, didn't notice any specific commit. However it does work, did a test run earlier today.

KiranPanesar commented 9 years ago

Snap-API is working because they are using the Android endpoints. An Android user's Snapchat account is authenticated against their Google Account. This function is generating the Google OAuth token.

From what I can tell, Snapchat's iOS app doesn't work this way, they have opted for a more similar approach to their originally security, but with new (possibly rotating keys). Still looking into that one.

Rob-- commented 9 years ago

This library also uses the Android endpoints - that function is implemented into this library as it is required for the loq login endpoint.

flyingrub commented 9 years ago

does your lib work right now ? @Rob--

Permafacture commented 9 years ago

It is indeed broken right now :(

Rob-- commented 8 years ago

It seems as though it is still possible to use Snapchat's API albeit very hard. If you decompile the APK you can find all the endpoints and you can see how the requests formed. From a quick look I can see how the login request is formed: return LoginTask.this.mGoogleAuthManager.a(LoginTask.this.mLoginName, LoginTask.this.mPassword, this.val$payload.timestamp, LoginTask.PATH);. But it's incredibly hard to read the obfuscated code, and Snapchat seem to detect when a fake certificate is being used (even if trusted by the device) so I can't even use a proxy. Not sure if anyone else has any other suggestions?

rpsforza commented 8 years ago

@Rob-- Are you interested in continuing development on the Snapchat API? Hit me up.

danwatco commented 8 years ago

@bsforza70 I'd be interested if @Rob-- isn't, do you have any info - as far as I know there is no working APIs at the moment.