Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Patch to support extended tweets #47

Open
ghost opened this issue Jun 19, 2019 · 0 comments
Open

Patch to support extended tweets #47

ghost opened this issue Jun 19, 2019 · 0 comments

Comments

@ghost
Copy link

ghost commented Jun 19, 2019

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:


Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

0 participants