Instaloader downloading same posts over and over again

112 views Asked by At

I need to download all post with specific hashtag. I'm using Instaloader for this.

Code:

import instaloader
from datetime import datetime

# Create an instance of Instaloader class
L = instaloader.Instaloader()

L.download_pictures = False
L.download_videos = False
L.download_video_thumbnails = False
L.download_geotags = False
L.save_metadata = True
L.compress_json = False

username = input("Input username: ")

try:
    L.load_session_from_file(username)

except FileNotFoundError:
    L.interactive_login(username)

# Get the hashtag object
posts = instaloader.Hashtag.from_name(L.context, 'кровля').get_posts()

start_date = datetime(2021, 1, 1)

# Loop through the posts with the given hashtag
for post in posts:
    # Download the post
    if start_date <= post.date_utc:
        L.download_post(post, target='posts')

The problem is that program download first 10-20 posts and repeats itself infinitely. But when I use Instaloder as command line application, everything works fine. Repeating posts

Maybe someone can help me

0

There are 0 answers