-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathtwitterdump.py
More file actions
45 lines (35 loc) · 813 Bytes
/
twitterdump.py
File metadata and controls
45 lines (35 loc) · 813 Bytes
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
import urllib2
import threading
import timeit
import os
import time
file_count =1
def dumper():
try:
dumper_file=file("/home/sys8/twitter/temp_tracker.txt","r")
x=dumper_file.readlines()
count=len(x)
print count
index =0
#start = timeit.default_timer()
#Your statements here
def dumper(l):
#for i in x:
#print i
url=urllib2.urlopen(l).read()
user_name=l.split('/')[3]
filename="%s_db"%user_name
fileopen=open("/home/sys8/twitter/db/"+str(filename),"a+")
fileopen.write(url)
#stop = timeit.default_timer()
while index<count:
while threading.activeCount()<5:
print "downloading : "+str(index)
t=threading.Thread(target=dumper,args=(x[index],))
t.start()
index=index+1
#time.sleep(500)
#file_count=file_count+1
return
except:
pass