Coder Social home page Coder Social logo

parler-py-api's Introduction

Parler API interface for Python

This UNOFFICIAL library designed to programatically fetch data from parler.com

IMPORTANT ANNOUNCEMENT:

This library supports the new (as of 2022-02-06) Parler open-api / logged-in endpoints. Both logged in and guest modes are supported.

Show is back on! Now this library supports the even newer (as of 2022-10-21) Parler /v0/ and /v0/public endpoints. Same caveats, both logged in and guest modes are supported

To do list:

  • Implement unfinished authed functions
  • Rework experiments
  • Have a github action (several!) to archive posts, run analysises, etc..
  • Implement controls for header x-ratelimit-limit and x-ratelimit-limit-remaining
  • Testing, testing
  • Publish to pypi

Authentication:

There are two modes of using the API. Authenticated and Guest.

Authentication is done by initializing the Parler class, importing Parler.with_auth and initializing an AuthSession with your credentials.

from Parler import with_auth as authed

au = authed.AuthSession(debug=False)
au.is_logged_in # ==> False
au.login(
	identifier=os.getenv("email"),
	password=os.getenv("password")
)

au.is_logged_in # ==> True

Here is a chart of how the functions are "loginwalled" or not.

Function Description API Type needed
.profile() Get information from a specified username Guest
.user_feed() Get Parleys and echoes from a specified username Guest
.trending() Get trending people Guest
.feed() Get feed Authenticated
.users() Search for users Authenticated
.hashtags() Search for hashtags Authenticated
.following() Get following profiles from specified username Authenticated
.comments() Get comments from a specified post ID Authenticated

Installation

From pypi:

pip install parler-api

Clone and run locally:

If using pipenv:

pipenv install
pipenv shell

If using pip:

pip install -r requirements.txt

Experiments:

Collected the suggested hashtags for a 9 hour period, data here

Other experiments available as well.

Contributing:

Feel free to improve the code, submit your experiments and sample code or fix bugs. Before submitting a PR, run pep8 linter on your code.

Donate:

If you found this package useful, consider donating.

Disclaimer:

I am in now way affiliated with Parler, it's subsidiaries or any entity related to the company. I am not responsible for what you do with this Python package.

2009/24/EC Art 5:

The person having a right to use a copy of a computer program shall be entitled, without the authorisation of the rightholder, to observe, study or test the functioning of the program in order to determine the ideas and principles which underlie any element of the program if he does so while performing any of the acts of loading, displaying, running, transmitting or storing the program which he is entitled to do.

parler-py-api's People

Contributors

davidlking avatar dependabot[bot] avatar extralime avatar konradit avatar llang629 avatar neon-ninja 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  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

parler-py-api's Issues

401 Unauthorized

I'm getting an Exception: {'status': 401} error when running, for example, python3 01_stop_the_steal.py. I'm fairly sure this is simply down to me not having set the environment variable tokens (JST and MST). However, my main question is where Parler provides these tokens, as searching for their API there doesn't appear to be much documentation (possibly worth an addition to the README)?

Cheers.

Unclear Where Data is Being Stored/Written

Hi there @KonradIT, I was testing out your unofficial API in an attempt to do some research with Parler. I was trying to run 02_multiple_hashtags.py, only to find that it took an incredible amount of time to run—eventually I had to just stop it altogether. I figured this isn't that absurd since I was trying to retrieve data for a large number of hashtags. So, with that thought, I just tried out one. I'm not sure how long this will take, but I do have an outstanding question about how all of this is working:

Where are these JSON files being written to in the first place? I have no way of looking at what's currently being collected because I don't have an understanding of that. Any help or clarification is appreciated. Thanks!

Issues How JSON is Being Written + Manually Stopping Collection

Hi @KonradIT,

First off, thanks for your help before with the prior issue I opened. Second, thank you for developing this unofficial API in the first place—it has been of great use to me!

Now, to get to my point, I am still utilizing your experiment 02_multiple_hashtags.py. I have run into a couple of issues along the way and was wondering if you had any advice/clarification that you could provide:

  1. When the posts and links are being written to JSON files, there is always a closing square (i.e., "]") bracket being written in each of the files at arbitrary places. This, in turn, produces a JSON decoding error that claims it is expecting it to be the end of the file (even though it clearly isn't yet). For now, I have been going into the files myself and removing these so that it decodes to proper JSON.

  2. When I am manually choosing to stop the data collection myself before it has retrieved all possible posts, there are often instances for which it will write more objects to the Links file than it did to the corresponding Posts file. This results in having an uneven ratio of links to posts. Is there a way I can ensure that it stops writing at the same number for each?

This might just be something I have to fix myself if I am going to stop the script at random times. Not sure though.

Thanks!

Followers always returning 20

Hi @KonradIT did you change your API regarding followers? The data worked a week ago and now I am always getting 20 followers for every profile even when I exceed the limit. Any update on this, please? 😄

"Score", "State", "Interactions" and possibility of fetching geolocation

Hi @KonradIT !

First, thanks a million for developing this software. It is a unique tool for researchers, especially in times like these!

  1. I wanted to ask you some clarifications, as I see that there is not (yet) any documentation for this project.
  • What do the "Score", "State", and "Interactions" fields mean exactly? At first I thought "Score" was the number of followers of a user, but when I compared with profiles on Parler.com I see that it is a different number. Is "State" the US State (Minnesota, NY, Iowa etc..) of the post?
  1. Do you think it would be possible to fetch the location in which each post was posted? Something similar to the "coordinate" or "place" attributes of tweets in tweepy? If Parler.com releases that information, it would be a great addition!

Thanks again and keep up the amazing work,

Leo

Attach image?

For the paler.post() call, any guidance on how to upload an image and attach to the post?

Bad Gateway & Too many requests

Hey nice library, I modified it a little and kept running into response 502 (bad gate way) and 429 (too many requests). I have written a static response handler that checks the response code, then sleeps for 5 seconds upon encountering one of the responses above. After the res is passed through the handler, it returns the res from where it was called, at which point the call is made again or the script continues. I would request to pull, however the response handler requires a rewrite of the other methods. Feel free to close this issue ASAP.

How do I get the the MST and JST tokens?

Hi,
I am new to using Parler. I have understood that I should get MST and JST tokens from the cookies on Chrome, but I simply see only one long string (see screenshot)
screenshot
I do not understand if this is because the Parler settings/API has changed, but your code needs these values. In which way can I get them?

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.