Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/labteral/pygram
Unofficial Python client for Instagram
https://github.com/labteral/pygram
bot instagram instagram-api instagram-bot instagram-client instagram-crawler instagram-download instagram-downloader instagram-feed instagram-photos instagram-scraper instagram-sdk sdk
Last synced: about 1 month ago
JSON representation
Unofficial Python client for Instagram
- Host: GitHub
- URL: https://github.com/labteral/pygram
- Owner: labteral
- License: gpl-3.0
- Created: 2020-03-28T14:35:09.000Z (almost 5 years ago)
- Default Branch: master
- Last Pushed: 2020-11-05T07:56:38.000Z (about 4 years ago)
- Last Synced: 2024-12-05T16:07:25.717Z (about 2 months ago)
- Topics: bot, instagram, instagram-api, instagram-bot, instagram-client, instagram-crawler, instagram-download, instagram-downloader, instagram-feed, instagram-photos, instagram-scraper, instagram-sdk, sdk
- Language: Python
- Homepage:
- Size: 54.7 KB
- Stars: 42
- Watchers: 3
- Forks: 5
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
Unofficial Python client for Instagram## Installation
```bash
pip install pygram
```## Methods without mandatory login
### Get user's profile
```python
from pygram import PyGram
pygram = PyGram()profile = pygram.get_profile('eminem')
```### Get user's ID
```python
from pygram import PyGram
pygram = PyGram()user_id = pygram.get_user_id('eminem')
```### Get user's posts
```python
from pygram import PyGram
pygram = PyGram()posts = pygram.get_posts('eminem', limit=10)
for post in posts:
print(post)
```### Get post's comments
```python
from pygram import PyGram
pygram = PyGram()comments = pygram.get_comments(post, limit=10)
for comment in comments:
print(comment)
```## Methods with mandatory login
### Login
```python
from pygram import PyGrampygram = PyGram('user', 'password')
```
> After the first login, a file with the name `pygram-cache.json` will be created in the current directory to avoid logging in again with every instantiation.### Get user's followers
```python
from pygram import PyGram
pygram = PyGram('user', 'password')users = pygram.get_followers('eminem', limit=10)
for user in users:
print(user)
```### Get users followed by a user
```python
from pygram import PyGram
pygram = PyGram('user', 'password')users = pygram.get_followed('drdre', limit=10)
for user in users:
print(user)
```### Like a post / comment
```python
from pygram import PyGram
pygram = PyGram('user', 'password')last_post = next(pygram.get_posts('eminem', limit=1))
pygram.like(last_post)
```### Unlike a post / comment
```python
from pygram import PyGram
pygram = PyGram('user', 'password')last_post = next(pygram.get_posts('eminem', limit=1))
pygram.unlike(last_post)
```### Comment a post / comment
```python
from pygram import PyGram
pygram = PyGram('user', 'password')pygram.comment(post, 'this is the comment')
```### Delete a comment
```python
from pygram import PyGram
pygram = PyGram('user', 'password')pygram.delete(comment)
```