Skip to content

Instantly share code, notes, and snippets.

View uluQulu's full-sized avatar
🚙
Coding ...

Şəhriyar Cəfər Qulu uluQulu

🚙
Coding ...
  • Azərbaycan
View GitHub Profile
@uluQulu
uluQulu / emergency_exit.py
Created August 23, 2018 01:07
Emergency exit if there is a serious situation
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:
@uluQulu
uluQulu / unfollow_util.py
Created August 23, 2018 01:05
Uncertain state handling for @tompicca
"""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
@uluQulu
uluQulu / web_address_navigator.py
Created August 16, 2018 13:45
fgisslen - selenium TimeoutExeption handling
def web_adress_navigator(browser, link):
"""Checks and compares current URL of web page and the URL to be navigated and if it is different, it does navigate"""
total_timeouts = 0
try:
current_url = browser.current_url
except WebDriverException:
try:
current_url = browser.execute_script("return window.location.href")
except WebDriverException:
@uluQulu
uluQulu / interact_by_URL.py
Created June 10, 2018 15:33
A new feature to do all kind of interactions on given URLs
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")
@uluQulu
uluQulu / guessed_Number_finder.cpp
Last active May 11, 2018 17:06
Finds the guessed number in range [0, 128) with less than 7 questions
// 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";
@uluQulu
uluQulu / directors_list.py
Last active April 16, 2018 00:26
code for @belac_
# 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')],
@uluQulu
uluQulu / get_active_users.py
Created April 11, 2018 15:02
enhanced function of getting active users from the latest n posts for @ortetgafernando
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
@uluQulu
uluQulu / get_links_for_location.py
Last active April 11, 2018 02:01
location link grabber function for @dimahadghi
@uluQulu
uluQulu / get_watchers.py
Last active September 24, 2021 06:45
A new function for InstaPy to return the entire list of your current followers
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 = []
@uluQulu
uluQulu / comment_engine.py
Created March 27, 2018 11:27
Comment problem with updating reactJS
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):