This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def emergency_exit(browser, username, logger): | |
""" Raise emergency if the is no connection to server OR user is not logged in """ | |
# ping server | |
connection_state = ping_server("instagram.com") | |
if connection_state == False: | |
logger.error("{} is not connected to the server!".format(username)) | |
return True | |
else: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"""Module which handles the follow features like unfollowing and following""" | |
import time | |
import os | |
import random | |
import json | |
import csv | |
import sqlite3 | |
from datetime import datetime, timedelta | |
from math import ceil |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def interact_by_URL(self, | |
urls=[], | |
media=None, | |
interact=False): | |
""" Interact on images at given URLs """ | |
if self.aborting: | |
return self | |
self.logger.info("Starting to interact by given URLs\n") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// NumberGuessingGame.cpp : Defines the entry point for the console application. | |
// This is an easy game which asks user a number to guess in [1, 100] range and tries to find that number with no more than 7 questiosn :) | |
#include "stdafx.h" | |
#include "std_lib_facilities.h" | |
bool binary_search(int min, int max, int guess_num) | |
{ | |
string verify; | |
cout << "Is the number you are guessing less than "<<guess_num<<"? (`yes` or `no`)\n"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Build a dictionary containing the specified movie collection | |
movie_dict = { | |
'2005' : [('Munich', 'Steven Speilberg')], | |
'2006' : [('The Prestige', 'Christopher Nolan'), ('The Departed', 'Martin Scorsese')], | |
'2007' : [('Into the Wild', 'Sean Penn')], | |
'2008' : [('The Dark Knight', 'Christopher Nolan')], | |
'2009' : [('Mary and Max', 'Adam Elliot')], | |
'2010' : [('The King\'s Speech', 'Tom Hooper')], | |
'2011' : [('The Artist', 'Michel Hazanavicius'), ('The Help', 'Tate Taylor')], | |
'2012' : [('Argo', 'Ben Affleck')], |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def get_active_users(browser, username, posts, boundary, logger): | |
"""Returns a list with usernames who liked the latest n posts""" | |
browser.get('https://www.instagram.com/' + username) | |
sleep(2) | |
total_posts = format_number(browser.find_element_by_xpath( | |
"//span[contains(@class,'_t98z6')]//span").text) | |
# if posts > total user posts, assume total posts |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def get_links_for_location(browser, | |
location, | |
amount, | |
logger, | |
media=None, | |
skip_top_posts=True): | |
"""Fetches the number of links specified | |
by amount and returns a list of links""" | |
if media is None: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def get_watchers(browser, username, logger, logfolder): | |
"""Used to get the entire list of followers with graphql""" | |
user_data = {} | |
graphql_endpoint = 'https://www.instagram.com/graphql/query/' | |
graphql_followers = ( | |
graphql_endpoint + '?query_hash=37479f2b8209594dde7facb0d904896a') | |
all_followers = [] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from random import choice | |
from .time_util import sleep | |
from .util import update_activity | |
from .util import add_user_to_blacklist | |
from selenium.common.exceptions import WebDriverException | |
import emoji | |
from selenium.webdriver.common.keys import Keys | |
def get_comment_input(browser): |