Patch to support extended tweets
Opened this issue · 0 comments
Deleted user commented
This is a patch to bti.c to accept the new, longer tweets.
diff --git a/bti.c b/bti.c
index 7f485a8..a4316d3 100644
--- a/bti.c
+++ b/bti.c
@@ -572,7 +572,7 @@ static void json_interpret(json_object *jobj, int nestlevel)
printf("%s : %s\n", keystack[2], json_object_get_string(jobj));
tweetdetail.created_at = (char *)json_object_get_string(jobj);
}
- if (strcmp(keystack[2], "text") == 0) {
+ if (strcmp(keystack[2], "full_text") == 0 || strcmp(keystack[2], "text") == 0) {
if (debug)
printf("%s : %s\n", keystack[2], json_object_get_string(jobj));
tweetdetail.text = (char *)json_object_get_string(jobj);
@@ -933,7 +933,7 @@ static int send_request(struct session *session)
case ACTION_FRIENDS:
snprintf(user_password, sizeof(user_password), "%s:%s",
session->account, session->password);
- snprintf(endpoint, endpoint_size, "%s%s?page=%d", session->hosturl,
+ snprintf(endpoint, endpoint_size, "%s%s?tweet_mode=extended&page=%d", session->hosturl,
friends_uri, session->page);
curl_easy_setopt(curl, CURLOPT_URL, endpoint);
curl_easy_setopt(curl, CURLOPT_USERPWD, user_password);
@@ -948,7 +948,7 @@ static int send_request(struct session *session)
case ACTION_REPLIES:
snprintf(user_password, sizeof(user_password), "%s:%s",
session->account, session->password);
- snprintf(endpoint, endpoint_size, "%s%s?page=%d", session->hosturl,
+ snprintf(endpoint, endpoint_size, "%s%s?tweet_mode=extended&page=%d", session->hosturl,
replies_uri, session->page);
curl_easy_setopt(curl, CURLOPT_URL, endpoint);
curl_easy_setopt(curl, CURLOPT_USERPWD, user_password);
@@ -1069,7 +1069,7 @@ static int send_request(struct session *session)
session->page);
break;
case ACTION_REPLIES:
- sprintf(endpoint, "%s%s?page=%d", session->hosturl,
+ sprintf(endpoint, "%s%s?tweet_mode=extended&page=%d", session->hosturl,
mentions_uri, session->page);
break;
case ACTION_PUBLIC:
@@ -1077,7 +1077,7 @@ static int send_request(struct session *session)
public_uri);
break;
case ACTION_FRIENDS:
- sprintf(endpoint, "%s%s?page=%d", session->hosturl,
+ sprintf(endpoint, "%s%s?tweet_mode=extended&page=%d", session->hosturl,
friends_uri, session->page);
break;
case ACTION_RETWEET: