Commit 200f93ad authored by Francesco Poldi's avatar Francesco Poldi

Added option for custom type

parent 2bfff3c4
...@@ -41,6 +41,7 @@ class Config: ...@@ -41,6 +41,7 @@ class Config:
Index_tweets = "twint" Index_tweets = "twint"
Index_follow = "twintGraph" Index_follow = "twintGraph"
Index_users = "twintUser" Index_users = "twintUser"
Index_type = "items"
Debug = False Debug = False
Resume = None Resume = None
Images = False Images = False
......
...@@ -44,15 +44,15 @@ def Tweet(Tweet, config): ...@@ -44,15 +44,15 @@ def Tweet(Tweet, config):
day = weekdays[strftime("%A", localtime(Tweet.datetime))] day = weekdays[strftime("%A", localtime(Tweet.datetime))]
actions = [] actions = []
nLikes = 0 nLikes = 1
nReplies = 0 nReplies = 1
nRetweets = 0 nRetweets = 1
dt = f"{Tweet.datestamp} {Tweet.timestamp}" dt = f"{Tweet.datestamp} {Tweet.timestamp}"
j_data = { j_data = {
"_index": config.Index_tweets, "_index": config.Index_tweets,
"_type": "items", "_type": config.Index_type,
"_id": Tweet.id + "_raw_" + config.Essid, "_id": Tweet.id + "_raw_" + config.Essid,
"_source": { "_source": {
"id": Tweet.id, "id": Tweet.id,
...@@ -76,7 +76,7 @@ def Tweet(Tweet, config): ...@@ -76,7 +76,7 @@ def Tweet(Tweet, config):
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,
"_type": "items", "_type": config.Index_type,
"_id": Tweet.id + "_likes_" + str(nLikes) + "_" + config.Essid, "_id": Tweet.id + "_likes_" + str(nLikes) + "_" + config.Essid,
"_source": { "_source": {
"id": Tweet.id, "id": Tweet.id,
...@@ -102,7 +102,7 @@ def Tweet(Tweet, config): ...@@ -102,7 +102,7 @@ def Tweet(Tweet, config):
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,
"_type": "items", "_type": config.Index_type,
"_id": Tweet.id + "_replies_" + str(nReplies) + "_" + config.Essid, "_id": Tweet.id + "_replies_" + str(nReplies) + "_" + config.Essid,
"_source": { "_source": {
"id": Tweet.id, "id": Tweet.id,
...@@ -128,7 +128,7 @@ def Tweet(Tweet, config): ...@@ -128,7 +128,7 @@ def Tweet(Tweet, config):
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,
"_type": "items", "_type": config.Index_type,
"_id": Tweet.id + "_retweets_" + str(nRetweets) + "_" + config.Essid, "_id": Tweet.id + "_retweets_" + str(nRetweets) + "_" + config.Essid,
"_source": { "_source": {
"id": Tweet.id, "id": Tweet.id,
...@@ -161,7 +161,7 @@ def Follow(user, config): ...@@ -161,7 +161,7 @@ def Follow(user, config):
j_data = { j_data = {
"_index": config.Index_follow, "_index": config.Index_follow,
"_type": "items", "_type": config.Index_type,
"_id": user + "_" + config.Username + "_" + config.Essid, "_id": user + "_" + config.Username + "_" + config.Essid,
"_source": { "_source": {
"user": user, "user": user,
...@@ -181,7 +181,7 @@ def UserProfile(user, config): ...@@ -181,7 +181,7 @@ def UserProfile(user, config):
j_data = { j_data = {
"_index": config.Index_users, "_index": config.Index_users,
"_type": "items", "_type": config.Index_type,
"_id": user.id + "_" + user.join_date + "_" + user.join_time + "_" + config.Essid, "_id": user.id + "_" + user.join_date + "_" + user.join_time + "_" + config.Essid,
"_source": { "_source": {
"id": user.id, "id": user.id,
......
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