This commit is contained in:
nuclearfog 2022-12-22 16:41:07 +01:00
parent 0c37236116
commit f0da08f1db
No known key found for this signature in database
GPG Key ID: 03488A185C476379
2 changed files with 18 additions and 17 deletions

View File

@ -634,7 +634,7 @@ public class Twitter implements Connection {
params.add("since_id=" + minId);
if (maxId > 1)
params.add("until_id=" + maxId);
params.add("query=conversation_id:" + id);
params.add("query=" + StringTools.encode("conversation_id:" + id));
List<Status> result = getTweets2(TWEET_SEARCH_2, params);
List<Status> replies = new LinkedList<>();
// chose only the first tweet of a conversation
@ -1180,7 +1180,7 @@ public class Twitter implements Connection {
params.add(MediaV2.FIELDS_MEDIA);
params.add(PollV2.FIELDS_POLL);
params.add(LocationV2.FIELDS_PLACE);
params.add("max_results=" + settings.getListSize());
//params.add("max_results=" + settings.getListSize());
Response response = get(endpoint, params);
ResponseBody body = response.body();
if (body != null && response.code() == 200) {

View File

@ -92,19 +92,20 @@ public class TweetV2 implements Status {
* @param tweetCompat tweet v1.1 object
*/
public TweetV2(JSONObject json, @NonNull UserV2Map userMap, @Nullable MediaV2Map mediaMap, @Nullable PollV2Map pollMap, @Nullable LocationV2Map locationMap, @Nullable Status tweetCompat) throws JSONException {
JSONObject data = json.getJSONObject("data");
JSONObject publicMetrics = data.getJSONObject("public_metrics");
JSONObject nonPublicMetrics = data.optJSONObject("non_public_metrics");
JSONObject entities = data.optJSONObject("entities");
JSONObject geoJson = data.optJSONObject("geo");
JSONObject attachments = data.optJSONObject("attachments");
JSONArray tweetReferences = data.optJSONArray("referenced_tweets");
String idStr = data.getString("id");
String textStr = data.optString("text", "");
String timeStr = data.optString("created_at", "");
String replyUserIdStr = data.optString("in_reply_to_user_id", "-1");
String conversationIdStr = data.optString("conversation_id", "-1");
String authorId = data.getString("author_id");
if (json.has("data"))
json = json.getJSONObject("data");
JSONObject publicMetrics = json.getJSONObject("public_metrics");
JSONObject nonPublicMetrics = json.optJSONObject("non_public_metrics");
JSONObject entities = json.optJSONObject("entities");
JSONObject geoJson = json.optJSONObject("geo");
JSONObject attachments = json.optJSONObject("attachments");
JSONArray tweetReferences = json.optJSONArray("referenced_tweets");
String idStr = json.getString("id");
String textStr = json.optString("text", "");
String timeStr = json.optString("created_at", "");
String replyUserIdStr = json.optString("in_reply_to_user_id", "-1");
String conversationIdStr = json.optString("conversation_id", "-1");
String authorId = json.getString("author_id");
// string to long conversion
try {
id = Long.parseLong(idStr);
@ -128,8 +129,8 @@ public class TweetV2 implements Status {
retweetCount = publicMetrics.getInt("retweet_count");
favoriteCount = publicMetrics.getInt("like_count");
timestamp = StringTools.getTime(timeStr, StringTools.TIME_TWITTER_V2);
source = data.optString("source", "unknown");
sensitive = data.optBoolean("possibly_sensitive", false);
source = json.optString("source", "unknown");
sensitive = json.optBoolean("possibly_sensitive", false);
// add media
if (attachments != null) {
JSONArray mediaKeys = attachments.optJSONArray("media_keys");