Include scraper.py

This commit is contained in:
Nora Goodman 2025-05-26 18:36:11 -04:00
parent 7d01a75550
commit d94e3a0c99
2 changed files with 20 additions and 1 deletions

3
.gitignore vendored
View file

@ -2,4 +2,5 @@ scraper/**
!scraper/*.py
.venv/
__pycache__/
static/
static/
posts/

18
scraper/scraper.py Normal file
View file

@ -0,0 +1,18 @@
# wait between 1050 and 1150 seconds
import instaloader
from time import sleep
from random import randint
from os import listdir
L = instaloader.Instaloader()
L.load_session_from_file("down.loader54321")
profile_of_interest = instaloader.Profile.from_username(L.context, "rocfnb")
files = listdir('.')
for post in profile_of_interest.get_posts():
if not post.shortcode in files :
L.download_post(post, target=post.shortcode)
sleep(randint(1050, 1150))
else:
print("Already downloaded " + post.shortcode +", skipping...")