Commit 4baad9c9 authored by Francesco Poldi's avatar Francesco Poldi

Updated index and fixes

parent d4672ee0
...@@ -207,19 +207,17 @@ def main(): ...@@ -207,19 +207,17 @@ def main():
c = initialize(args) c = initialize(args)
if "likes" in str(args.es_count): if "likes" in str(args.es_count):
c.ES_count["likes"] = False c.ES_count["likes"] = True
if "replies" in str(args.es_count): if "replies" in str(args.es_count):
c.ES_count["replies"] = False c.ES_count["replies"] = True
if "retweets" in str(args.es_count): if "retweets" in str(args.es_count):
c.ES_count["retweets"] = False c.ES_count["retweets"] = True
if args.pandas_clean: if args.pandas_clean:
twint.storage.panda.clean() twint.storage.panda.clean()
c = initialize(args)
if args.favorites: if args.favorites:
if args.userlist: if args.userlist:
_userlist = loadUserList(args.userlist, "favorites") _userlist = loadUserList(args.userlist, "favorites")
......
...@@ -19,7 +19,11 @@ PUT twinttweets ...@@ -19,7 +19,11 @@ PUT twinttweets
"link": {"type": "text"}, "link": {"type": "text"},
"retweet": {"type": "text"}, "retweet": {"type": "text"},
"user_rt": {"type": "text"}, "user_rt": {"type": "text"},
"essid": {"type": "keyword"} "essid": {"type": "keyword"},
"nlikes": {"type": "integer"},
"nreplies": {"type": "integer"},
"nretweets": {"type": "integer"},
"search": {"type": "text"}
} }
} }
} }
......
...@@ -49,8 +49,8 @@ class Config: ...@@ -49,8 +49,8 @@ class Config:
Media = False Media = False
Replies = False Replies = False
Pandas_clean = True Pandas_clean = True
ES_count = {"likes":True,"replies":True,"retweets":True} ES_count = {"likes":False,"replies":False,"retweets":False}
Lowercase = False Lowercase = True
Pandas_au = True Pandas_au = True
Proxy_host = None Proxy_host = None
Proxy_port = 0 Proxy_port = 0
......
...@@ -68,12 +68,16 @@ def Tweet(Tweet, config): ...@@ -68,12 +68,16 @@ def Tweet(Tweet, config):
"link": Tweet.link, "link": Tweet.link,
"retweet": Tweet.retweet, "retweet": Tweet.retweet,
"user_rt": Tweet.user_rt, "user_rt": Tweet.user_rt,
"essid": config.Essid "essid": config.Essid,
"nlikes": int(Tweet.likes),
"nreplies": int(Tweet.replies),
"nretweets": int(Tweet.retweets),
"search": str(config.Search)
} }
} }
actions.append(j_data) actions.append(j_data)
if config.ES_count["likes"] is not False: if config.ES_count["likes"]:
for l in range(int(Tweet.likes)): for l in range(int(Tweet.likes)):
j_data = { j_data = {
"_index": config.Index_tweets, "_index": config.Index_tweets,
...@@ -100,7 +104,7 @@ def Tweet(Tweet, config): ...@@ -100,7 +104,7 @@ def Tweet(Tweet, config):
actions.append(j_data) actions.append(j_data)
nLikes += 1 nLikes += 1
if config.ES_count["replies"] is not False: if config.ES_count["replies"]:
for rep in range(int(Tweet.replies)): for rep in range(int(Tweet.replies)):
j_data = { j_data = {
"_index": config.Index_tweets, "_index": config.Index_tweets,
...@@ -127,7 +131,7 @@ def Tweet(Tweet, config): ...@@ -127,7 +131,7 @@ def Tweet(Tweet, config):
actions.append(j_data) actions.append(j_data)
nReplies += 1 nReplies += 1
if config.ES_count["retweets"] is not False: if config.ES_count["retweets"]:
for ret in range(int(Tweet.retweets)): for ret in range(int(Tweet.retweets)):
j_data = { j_data = {
"_index": config.Index_tweets, "_index": config.Index_tweets,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment