Commit 43e91b27 authored by Francesco Poldi's avatar Francesco Poldi

Added option for custom type

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