# -*- coding: utf-8 -*- # scraper instagram posts import os import sys os.environ.setdefault("DJANGO_SETTINGS_MODULE", "dsite.settings") sys.path.insert(0, '../') sys.path.insert(0, './') from django.core.wsgi import get_wsgi_application get_wsgi_application() import instagram_scraper import time from dsite import settings if __name__ == '__main__': args = { 'login_user': settings.IG_LOGIN_USERNAME, 'login_pass': settings.IG_LOGIN_PASSWORD, 'cookiejar': settings.IG_SCRAPER_COOKIE_FILE, 'latest_stamps': settings.IG_SCRAPER_LAST_STAMP_FILE, 'usernames': settings.IG_SCRAPER_USERNAMES, 'destination': settings.IG_SCRAPER_DESTINATION, } scraper = instagram_scraper.InstagramScraper(**args) scraper.authenticate_with_login() scraper.save_cookies() while True: time.sleep(10) args_ = { 'cookiejar': settings.IG_SCRAPER_COOKIE_FILE, 'latest_stamps': settings.IG_SCRAPER_LAST_STAMP_FILE, 'usernames': settings.IG_SCRAPER_USERNAMES, 'destination': settings.IG_SCRAPER_DESTINATION, 'template': '{username}-{datetime}-{shortcode}', } scraper = instagram_scraper.InstagramScraper(**args_) scraper.scrape()