Skip to content

Commit 9d97020

Browse files
authored
Create ExampleBulkVideo.py
1 parent c66dc2d commit 9d97020

File tree

1 file changed

+43
-0
lines changed

1 file changed

+43
-0
lines changed

examples/ExampleBulkVideo.py

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
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+
import urllib
14+
15+
PhotoPath = "/home/psi/python/ig/feybeclaudia_/" # Change Directory to Folder with Pics that you want to upload
16+
# Change to your Photo Hashtag
17+
IGCaption = "Your Caption + #Hashtag"
18+
19+
thumb_uri = 'https://instagram.fcgk6-1.fna.fbcdn.net/vp/d9a7b1df0e691f3663644aaed820b1e3/5A63F236/t51.2885-15/e35/26157933_212816202622096_909866749820665856_n.jpg'
20+
thumbnail = thumb_uri.split("/")[-1]
21+
thumbnail = os.path.dirname(os.path.abspath(__file__)) + '/' + thumbnail
22+
print(thumbnail)
23+
#
24+
#urllib.urlretrieve(video_url, video_local_path)
25+
#urllib.urlretrieve(thumb_uri, thumbnail)
26+
27+
x = os.chdir(PhotoPath)
28+
ListFiles = [f for f in listdir(PhotoPath) if isfile(join(PhotoPath, f))]
29+
print("Total Photo in this folder:" + str(len(ListFiles)))
30+
31+
# Start Login and Uploading Photo
32+
igapi = InstagramAPI("feybeclaudya", "poiuy09876")
33+
igapi.login() # login
34+
35+
for i in range(len(ListFiles)):
36+
photo = ListFiles[i]
37+
print("Progress :" + str([i + 1]) + " of " + str(len(ListFiles)))
38+
print("Now Uploading this photo to instagram: " + photo)
39+
igapi.uploadVideo(photo,thumbnail, caption=IGCaption)
40+
# sleep for random between 600 - 1200s
41+
n = randint(600, 1200)
42+
print("Sleep upload for seconds: " + str(n))
43+
time.sleep(n)

0 commit comments

Comments
 (0)