Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/endygamedev/instagram-scraper
:selfie: Instagram Engagement Data.
https://github.com/endygamedev/instagram-scraper
data-scraping instagram scrapy selenium selenium-python selenium-webdriver web-scraping
Last synced: 27 days ago
JSON representation
:selfie: Instagram Engagement Data.
- Host: GitHub
- URL: https://github.com/endygamedev/instagram-scraper
- Owner: endygamedev
- License: gpl-3.0
- Created: 2021-07-29T17:57:12.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2021-08-24T12:30:45.000Z (over 3 years ago)
- Last Synced: 2024-11-09T04:32:54.156Z (3 months ago)
- Topics: data-scraping, instagram, scrapy, selenium, selenium-python, selenium-webdriver, web-scraping
- Language: Python
- Homepage:
- Size: 124 KB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
Instagram Engagement DataThis repository is an order from a freelance.
## Task
I have one instagram profile with 2 posts on it that I need to find out of each like if they follow the user or not. So for example if the profile has 100k followers and 50k likes on one of their posts, I need to find out how many of those 50k likes follow the profile. If you can write a script where I can easily swap profile usernames if I want to test another instagram profile for the same data extraction that would be great. Please write the script in python if possible. Expected output would be the script code and a csv file with a column for the username "@" of the "likes" on each post, a column with a 1/0 or a Yes/No if that username "@" that liked the post also follows the profile.## Documentation
`class Scraper(username: str, password: str)` — main class that takes all the information from Instagram`def Scraper.authentication() -> None` — function with which you can log into Instagram
`def Scraper.get_follower_list(profile: str) -> List[str]` — function that creates a list of followers
`def Scraper.get_likes_list(post: str) -> List[str]` — function that creates a list of users who have liked the post
`def Scraper.end() -> None` — function that exits the `webdriver`
`def Scraper.run_and_save(profile: str, post: str, post="": str) -> None` — function that launches the scraper and saves the data to a `.csv` file
You can also use GUI — [gui.py](/src/gui.py).
## Example
```python
from scraper import Scraper
from pprint import pprintusername = "username" # Your `username` from Instagram account
password = "password" # Your `password` from Instagram account
profile_name = "profile" # Instagram profile that interests you, for example: 'endygamedev_'
post_link = "post_url" # Instagram post that insterest you, for example: 'https://www.instagram.com/p/CRmQr4yrBz0/'scraper = Scraper(username, password)
scraper.authentication()follower_list = scraper.get_follower_list(profile_name)
pprint({len(follower_list): follower_list})likes_list = scraper.get_likes_list(post_link)
pprint({len(likes_list): likes_list})scraper.run_and_save(profile_name, post_link)
scraper.end()
```## Dependencies
For the script to work correctly, you need to install [Firefox](https://www.mozilla.org/en-US/firefox/new/) and [Geckodriver](https://github.com/mozilla/geckodriver/releases) or you can use another browser, but for this you need to watch yourself how to connect `webdriver`.## License
`instagram-scraper` is licensed under the [GNU General Public License v3.0](./LICENSE).