diff --git a/.gitignore b/.gitignore index 43271eb..c01dab5 100644 --- a/.gitignore +++ b/.gitignore @@ -2,4 +2,5 @@ scraper/** !scraper/*.py .venv/ __pycache__/ -static/ \ No newline at end of file +static/ +posts/ \ No newline at end of file diff --git a/scraper/scraper.py b/scraper/scraper.py new file mode 100644 index 0000000..ceb6d17 --- /dev/null +++ b/scraper/scraper.py @@ -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...") \ No newline at end of file