-
Notifications
You must be signed in to change notification settings - Fork 0
/
instacrawler.py
52 lines (44 loc) · 1.27 KB
/
instacrawler.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
# Author:
# copyright 2017
# Questions contact
import os
# starting folder name. auto starts with 0
counter = 0
num_craw = -1
instaUsername = ""
instaPassword = ""
def run():
global counter,instaUsername,instaPassword,num_craw
f = open("list.txt")
name = f.readline().rstrip('\n')
while name != "":
#check total number of pics to craw
if num_craw == -1:
num_craw = name
name = f.readline().rstrip('\n')
continue
#check username
if instaUsername == "":
instaUsername = name
name = f.readline().rstrip('\n')
continue
#check password
if instaPassword == "":
instaPassword = name
name = f.readline().rstrip('\n')
continue
dirNum = str(counter)
os.system("mkdir ./"+dirNum)
#hashtag
if name[0] == "#":
name = name[1:]
para = name+" ./"+dirNum+" -n "+num_craw
systemCommand = "instaLooter hashtag "
#profile
else:
para = name+" ./"+dirNum+" -n "+num_craw
systemCommand = "instaLooter user"
os.system(systemCommand+para)
counter+=1
name = f.readline().rstrip('\n')
run()