Python代码在照片中标记Instagram用户?使用Instagram API

时间:2019-04-24 05:14:14

标签: python instagram-api

此Python代码可自动在Instagram上发布

import os
import time
import random
from os import listdir
from os.path import isfile, join
from random import randint
from InstagramAPI import InstagramAPI

PhotoPath = "D:\Kartinka\Avto"  # Change Directory to Folder with Pics 
IGUSER = "shukurioll0"  # Change to your Instagram USERNAME
PASSWD = "********"  # Change to your Instagram Password
# Change to your Photo Hashtag
IGCaption = "#Nature This is post "

os.chdir(PhotoPath)
ListFiles = sorted([f for f in listdir(PhotoPath) if isfile(join(PhotoPath, f))])
print(ListFiles)
print("Total Photo in this folder:" + str(len(ListFiles)))

# #Start Login and Uploading Photo
igapi = InstagramAPI(IGUSER, PASSWD)
igapi.login()  # login

for i, _ in enumerate(ListFiles):
    photo = ListFiles[i]
    print("Progress :" + str([i + 1]) + " of " + str(len(ListFiles)))
    print("Now Uploading this photo to instagram: " + photo)
    igapi.uploadPhoto(photo, caption=IGCaption, upload_id=None)
    os.remove(photo)
    # sleep for random between 60 - 120s
    n = randint(5,10)
    print("Sleep upload for seconds: " + str(n))
    time.sleep(n)

这里 IGCaption ==包含帖子名称,主题标签!

我需要可以在照片中标记人物的代码 我使用了Instagram API

usertags在这里使用了我的API谁可以用我的代码进行配置 Here used usertag for

0 个答案:

没有答案
相关问题