-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathEmotionCrawl.py
More file actions
41 lines (32 loc) · 1.19 KB
/
EmotionCrawl.py
File metadata and controls
41 lines (32 loc) · 1.19 KB
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
import sys
import twitterSearchV0 as twitterSearch
from optparse import OptionParser
keywords = []
geo = ''
FileRoot = ''
words = []
if __name__ == "__main__":
if len(sys.argv) < 3:
print 'Use search correctly:python EmotionCrawl <user.config> --geo(optional) <place> --radius(optional) <radius in meters> <keyphraseList.list> File'
print ' If geotag absent, a default world level would be used '
sys.exit()
else:
if str(sys.argv[1]).split(".")[-1] == "config":
filepath = str(sys.argv[1])
else:
print "second argument needs to be a .config file with your twitter api credentials"
if str((sys.argv[2]))=='--geo':
geo = str((sys.argv[3]))
rad = float(sys.argv[4])
keywords = str(sys.argv[5])
else:
keywords = str(sys.argv[2])
if keywords.split(".")[-1].strip() == "list":
f = open(keywords,"rb")
words = f.readlines()
else:
print keywords
print "Please input a .list file with keyphrases seperated by newlines"
search = twitterSearch.EmoCrawl(filepath, words, geo)
#search.makePost();
search.search()