def connect(): global account_flag username, password = get_account() print(account_flag) instagram = Instagram() instagram.with_credentials(username, password, path_to_cache_folder) instagram = Instagram() print("connected") return instagram
def dowload_data(self, username, threshold): instagram = Instagram() medias = instagram.get_medias(username, threshold) dirName = "" for media in medias: media = instagram.get_media_by_url(media.link) image = Image(media) dirName = image.saveImage() return dirName
def dowload_data(self, username, threshold): instagram = Instagram() medias = instagram.get_medias(username, threshold) dirName = "" for media in medias: QtCore.QCoreApplication.processEvents() media = instagram.get_media_by_url(media.link) image = Image(media) dirName = image.saveImage() return dirName
def __get_account_medias_by_username(username): instagram = Instagram() medias = instagram.get_medias(username, ) media = medias[6] print(media) account = media.owner print(account) return media
from context import Instagram # pylint: disable=no-name-in-module import time instagram = Instagram() instagram.with_credentials('JJPtest123', 'jjptest', '/pathtocache') instagram.login() # If account is public you can query Instagram without auth instagram = Instagram() #f = open('lilmiquela.txt', 'w', encoding="utf-8") #account_name = input("The account name: ") #account_post_number = input("The number of post: ") #medias = instagram.get_medias(account_name, account_post_number) medias = instagram.get_medias("lilmiquela", 610) #将时间戳转换为普通时间 def time_tran(created_at): time_local = time.localtime(created_at) created_time = time.strftime("%Y-%m-%d %H:%M:%S",time_local) return created_time #media = medias[0] #account = media.owner #print(account.get_username()) cont = 0
from context import Instagram # pylint: disable=no-name-in-module from time import sleep instagram = Instagram() cookie="/home/fanibi/Downloads/cookies.txt" instagram.set_cookies(cookie) #Search for account accounts = instagram.search_accounts_by_username('3.1415926535897932384626433832') print(accounts[0]) #get media account=accounts[0] account=account.username medias=instagram.get_medias(account,5) media1=medias[0] #like a picture:Does not work not logged in # instagram.like(media1.identifier) #unlike picture:Does not work not logged in # instagram.unlike(media1.identifier) #Try to get stories stories = instagram.get_stories() user_stories = stories[0] print(user_stories.owner) for story in user_stories.stories: print(story)
def __init__(self): print("initializing Meta Logger") Meta_Logger.instagram = Instagram() Meta_Logger.instagram.with_credentials(username, password, path_to_cache_folder) Meta_Logger.instagram.login()