Skip to content

Commit f5a5f3f

Browse files
authored
Merge pull request #99 from RPSPandora/patch-1
Create Example-BulkUpload.py
2 parents 4521c89 + 9d58294 commit f5a5f3f

File tree

1 file changed

+36
-0
lines changed

1 file changed

+36
-0
lines changed

Example-BulkUpload.py

+36
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
#!/usr/bin/env python
2+
# -*- coding: utf-8 -*-
3+
#
4+
# Use text editor to edit the script and type in valid Instagram username/password
5+
6+
import os
7+
import time
8+
import random
9+
from os import listdir
10+
from os.path import isfile, join
11+
from random import randint
12+
from InstagramAPI import InstagramAPI
13+
14+
PhotoPath = "~/igphoto/" # Change Directory to Folder with Pics that you want to upload
15+
IGUSER = "IGUsername" # Change to your Instagram USERNAME
16+
PASSWD = "IGPassword" # Change to your Instagram Password
17+
# Change to your Photo Hashtag
18+
IGCaption = "Your Caption Here #hashtag"
19+
20+
os.chdir(PhotoPath)
21+
ListFiles = [f for f in listdir(PhotoPath) if isfile(join(PhotoPath, f))]
22+
print ("Total Photo in this folder:" + str (len(ListFiles)))
23+
24+
#Start Login and Uploading Photo
25+
igapi = InstagramAPI(IGUSER,PASSWD)
26+
igapi.login() # login
27+
28+
for i in range(len(ListFiles)):
29+
photo = ListFiles[i]
30+
print ("Progress :" + str([i+1]) + " of " + str(len(ListFiles)))
31+
print ("Now Uploading this photo to instagram: " + photo)
32+
igapi.uploadPhoto(photo,caption=IGCaption,upload_id=None)
33+
# sleep for random between 600 - 1200s
34+
n = randint(600,1200)
35+
print ("Sleep upload for seconds: " + str(n))
36+
time.sleep(n)

0 commit comments

Comments
 (0)