Giter VIP home page Giter VIP logo

nineapi's Introduction

Index

Documentation is here: https://nineapi.readthedocs.org

So I'm sick and tired with web apps. I want normal adequate desktop apps for all the things.

Same relates to 9GAG. Everyone says there's no official API for 9GAG, but of course there is - you just need to go deeper.

Here's what I did in 20 minutes:

  • Decompiling 9GAG app for Android and digging within its JS sources (that's right - JavaScript, not Java: 9GAG app seems to be written in React Native.) to find the logic for signing requests.
  • Dumping HTTP traffic with spoofed SSL certificates to see actual request & response bodies.

So far there seem to be multiple domains used including api.9gag.com, ad.9gag.com, notify.9gag.com, admin.9gag.com and comment-cdn.9gag.com. I was able to make my own requests and retrieve the data I want.

Any fellow coders willing to contribute to this? We would be the first ones to reverse-engineer an actual 9GAG API. How cool is that?

nineapi's People

Contributors

and3rson avatar coolfool avatar marekkon5 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

nineapi's Issues

Unable to access sections other than 'hot' and 'trending'

Hey,

unfortunately I am unable to access different sections like 'fresh'. The get_posts() function is just working for the 'hot' and 'trending' section.

Trying to access a different section gives me the following reply:

"{\"meta\":{\"timestamp\":1519333793,\"status\":\"Failure\",\"sid\":\":IDWBRXTUNWeMRVRywEVRdHTUFVY\",\"errorMessage\":\"\",\"errorCode\":\"invalidListType\"},\"data\":{\"dummyField\":\"dummyValue\"}}"

It reports about an 'invalidListType' argument.
Do you know which query argument is missing and what are the syntax and semantics of it?

Get post count = 1 is empty

I used the
get_posts(self, group=1, type_='hot', count=10, entry_types=['animated', 'photo', 'video', 'album'], olderThan=None)
method of the client class
with count = 1 it returns an empty list.
count = 2 returns a list with two post

Does anybody have any advice or can somebody confirm this behaviour?

JSONDecodeError

Wonder if this still works for anyone. I am getting:

html..
<title>Access denied | api.9gag.com used Cloudflare to restrict access</title>
..

in response (instead of json data)

Issues with 9gag Token

The 9gag Token generated by random_sha1() is 40 characters long, and doesn't work now.

On intercepting 9gag token generated by the app, the token is 44 characters long.

It definitely depends on current timestamp as it becomes invalid after some time.

A sample 9gag token is as follows

Y29tLm5pbmVnYWcuYW5kcm9pZC5hcHAqNDFlbmNmYWFp

If we could fix this, that would be really great.

Emoji Unicode

Since there are emojis in posts names on 9gag......... my app crashed due to unicode not-supported.

U0001f4cc - is pin emoji from https://9gag.com/gag/a05LDmv

Traceback (most recent call last):
File "mytest.py", line 11, in
print(post)
File "/home/pi/nineapi/nineapi/client.py", line 193, in str
self.url
UnicodeEncodeError: 'ascii' codec can't encode character u'\U0001f4cc' in position 0: ordinal not in range(128)

Login Issue

Hey Im trying to implement your solution in node and Im getting 401 on login requests

Can you help me find the problem, this is my headers:

headers:
{ '9GAG-9GAG_TOKEN': 'b9116705f47c6a1ea0dab3704299c74e2f90e7af',
'9GAG-TIMESTAMP': '1512853562688',
'9GAG-APP_ID': 'com.ninegag.android.app',
'9GAG-DEVICE_UUID': 'e11e2abd6bee41478d570fc7a8cfe35a',
'X-Device-UUID': 'e11e2abd6bee41478d570fc7a8cfe35a',
'9GAG-DEVICE_TYPE': 'android',
'9GAG-BUCKET_NAME': 'MAIN_RELEASE',
'X-Package-ID': 'com.ninegag.android.app',
'9GAG-REQUEST-SIGNATURE': '7880eb1a0bfb953e964938faf5f94409c9271f20' },

and this is my login uri :

http://api.9gag.com/v2/user-token/loginMethod/9gag/loginName/[email protected]/password/c3581516868fb3b71746931cac66390e/language/en_US/pushToken/ae3f12b4db9090723b468ebde1589d1a2a93fe9a

And Im getting a 401 with:
{"meta":{"errorMessage":"Not authorized.","status":"Failure","errorCode":"UNAUTHORIZED","sid":"9gVQ01EVjlHTUVkMMRVTywEVFRjTn1TY"},"data":{"dummyField":"dummyValue"}}

I changed my real email for dummyMail but in the original request its my real 9gag mail - user.

I checked first with your code (which is working by me) and run some checks, I generate the same signature as you (based on the same timestamp, same uuid and appid picked from your code).
Im getting Mad :(
BTW you have duplicated X-Package-ID header in your code :

    headers = {
        '9GAG-9GAG_TOKEN': self.token,
        '9GAG-TIMESTAMP': str(utils.get_timestamp()),
        '9GAG-APP_ID': self.app_id,
        'X-Package-ID': self.app_id,
        '9GAG-DEVICE_UUID': self.device_uuid,
        'X-Device-UUID': self.device_uuid,
        '9GAG-DEVICE_TYPE': 'android',
        '9GAG-BUCKET_NAME': 'MAIN_RELEASE',
        'X-Package-ID': 'com.ninegag.android.app'
    }

Thanks in Advance!

Regards.

Pagination

I got your library working in my project, but 9gag limits the count of posts in each request.

Would it be possible to paginate the requests?

Thanks!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.