kheina-com / Blue-Blocker

Blocks all Twitter Blue verified users on twitter.com
Mozilla Public License 2.0
326 stars 29 forks source link

Unexpected Tweet Shape #206

Closed PatrickKennedy closed 8 months ago

PatrickKennedy commented 10 months ago

Got this error, though it doesn't seem fatal so that's a plus! Let me know if there's any more info needed, thanks! (I'm up to 3k blocked, so needless to say I reeeeally appreciate this!)

"[Blue Blocker] found unexpected tweet shape: "

{
    "itemContent": {
        "itemType": "TimelineTweet",
        "__typename": "TimelineTweet",
        "tweet_results": {
            "result": {
                "__typename": "Tweet",
                "rest_id": "1703008641115414539",
                "has_birdwatch_notes": false,
                "core": {
                    "user_results": {
                        "result": {
                            "__typename": "User",
                            "id": "VXNlcjoxMDY2MzU2NDY2NzE2NTY1NTA1",
                            "rest_id": "1066356466716565505",
                            "affiliates_highlighted_label": {},
                            "has_graduated_access": true,
                            "is_blue_verified": true,
                            "profile_image_shape": "Circle",
                            "legacy": {
                                "can_dm": true,
                                "can_media_tag": true,
                                "created_at": "Sat Nov 24 15:42:48 +0000 2018",
                                "default_profile": true,
                                "default_profile_image": false,
                                "description": "原创日常→95后📸真实博主丶知心大姐姐,未满ℕ𝕊𝔽𝕎 🔞+,丝足袜高跟👠 控,推特唯一账号,无任何其他平台‼️,文明礼貌聊天,不线下,不卖图,可定制原味,陪聊,+V需门槛哦~不坑不骗可视频,语音,举牌认证,置顶关评为恰饭广告请自行分辨",
                                "entities": {
                                    "description": {
                                        "urls": []
                                    }
                                },
                                "fast_followers_count": 0,
                                "favourites_count": 16,
                                "followers_count": 31599,
                                "friends_count": 152,
                                "has_custom_timelines": false,
                                "is_translator": false,
                                "listed_count": 4,
                                "location": "中国     推广自辨",
                                "media_count": 40,
                                "name": "雅萱吖",
                                "normal_followers_count": 31599,
                                "pinned_tweet_ids_str": [
                                    "1702688841285652793"
                                ],
                                "possibly_sensitive": false,
                                "profile_banner_url": "https://pbs.twimg.com/profile_banners/1066356466716565505/1692557408",
                                "profile_image_url_https": "https://pbs.twimg.com/profile_images/1693230126174277632/xqB_IoO9_normal.jpg",
                                "profile_interstitial_type": "",
                                "screen_name": "yaxuanya39",
                                "statuses_count": 931,
                                "translator_type": "none",
                                "verified": false,
                                "want_retweets": false,
                                "withheld_in_countries": []
                            }
                        }
                    }
                },
                "unified_card": {
                    "card_fetch_state": "NoCard"
                },
                "edit_control": {
                    "edit_tweet_ids": [
                        "1703008641115414539"
                    ],
                    "editable_until_msecs": "1694867475000",
                    "is_edit_eligible": false,
                    "edits_remaining": "5"
                },
                "is_translatable": false,
                "views": {
                    "count": "4053",
                    "state": "EnabledWithCount"
                },
                "source": "<a href=\"https://mobile.twitter.com\" rel=\"nofollow\">Twitter Web App</a>",
                "quoted_status_result": {},
                "legacy": {
                    "bookmark_count": 0,
                    "bookmarked": false,
                    "created_at": "Sat Sep 16 11:31:15 +0000 2023",
                    "conversation_id_str": "1702983517326418302",
                    "display_text_range": [
                        12,
                        51
                    ],
                    "entities": {
                        "user_mentions": [
                            {
                                "id_str": "1328704176772288513",
                                "name": "cats with jobs 🛠",
                                "screen_name": "CatWorkers",
                                "indices": [
                                    0,
                                    11
                                ]
                            }
                        ],
                        "urls": [
                            {
                                "display_url": "twitter.com/yaxuanya39/sta…",
                                "expanded_url": "https://twitter.com/yaxuanya39/status/1702999801305157927?s=20",
                                "url": "https://t.co/vLeL1C6iid",
                                "indices": [
                                    28,
                                    51
                                ]
                            }
                        ],
                        "hashtags": [],
                        "symbols": []
                    },
                    "favorite_count": 1,
                    "favorited": false,
                    "full_text": "@CatWorkers 我想你,也想睡你,更想睡醒有你。https://t.co/vLeL1C6iid",
                    "in_reply_to_screen_name": "CatWorkers",
                    "in_reply_to_status_id_str": "1702983517326418302",
                    "in_reply_to_user_id_str": "1328704176772288513",
                    "is_quote_status": true,
                    "lang": "zh",
                    "possibly_sensitive": false,
                    "possibly_sensitive_editable": true,
                    "quote_count": 0,
                    "quoted_status_id_str": "1702999801305157927",
                    "quoted_status_permalink": {
                        "url": "https://t.co/vLeL1C6iid",
                        "expanded": "https://twitter.com/yaxuanya39/status/1702999801305157927?s=20",
                        "display": "twitter.com/yaxuanya39/sta…"
                    },
                    "reply_count": 0,
                    "retweet_count": 0,
                    "retweeted": false,
                    "user_id_str": "1066356466716565505",
                    "id_str": "1703008641115414539"
                },
                "quick_promote_eligibility": {
                    "eligibility": "IneligibleNotProfessional"
                }
            }
        },
        "tweetDisplayType": "Tweet"
    },
    "clientEventInfo": {
        "details": {
            "conversationDetails": {
                "conversationSection": "HighQuality"
            },
            "timelinesDetails": {
                "controllerData": "DAACDAAEDAABCgABFICBiCBDAAUKAAIAAAAAF0BACAAAAAA="
            }
        }
    }
}
cooljeanius commented 10 months ago

Let me know if there's any more info needed, thanks!

Well what context does it appear in?

rougetimelord commented 9 months ago

Well what context does it appear in?

Different person, same issue. For me it seems to occur mostly in the context of the home and profile timelines.

aprilsbloom commented 9 months ago

same issue, occurs primarily in qrts from what i've noticed

image

{
  "entryType": "TimelineTimelineItem",
  "__typename": "TimelineTimelineItem",
  "itemContent": {
    "itemType": "TimelineTweet",
    "__typename": "TimelineTweet",
    "tweet_results": {
      "result": {
        "__typename": "Tweet",
        "rest_id": "1718160087640895695",
        "core": {
          "user_results": {
            "result": {
              "__typename": "User",
              "id": "VXNlcjoxNTY3NjE5OTI4NTQyMzk2NDE3",
              "rest_id": "1567619928542396417",
              "affiliates_highlighted_label": {},
              "has_graduated_access": true,
              "is_blue_verified": false,
              "profile_image_shape": "Circle",
              "legacy": {
                "can_dm": true,
                "can_media_tag": true,
                "created_at": "Wed Sep 07 21:05:16 +0000 2022",
                "default_profile": true,
                "default_profile_image": false,
                "description": "queer ace transfemme communist (she/they)\nBoD @HarmReduction // queer & harm reduction lege activist\n@gaynarcan@girlcock.club // @ket.bsky.social",
                "entities": {
                  "description": {
                    "urls": []
                  }
                },
                "fast_followers_count": 0,
                "favourites_count": 41990,
                "followers_count": 1266,
                "friends_count": 2267,
                "has_custom_timelines": true,
                "is_translator": false,
                "listed_count": 18,
                "location": "New Orleans, Louisiana, US",
                "media_count": 599,
                "name": "Corinne Green",
                "normal_followers_count": 1266,
                "pinned_tweet_ids_str": [],
                "possibly_sensitive": false,
                "profile_banner_url": "https://pbs.twimg.com/profile_banners/1567619928542396417/1679947505",
                "profile_image_url_https": "https://pbs.twimg.com/profile_images/1567620925041922050/qEEsYcKB_normal.jpg",
                "profile_interstitial_type": "",
                "screen_name": "gaynarcan",
                "statuses_count": 7481,
                "translator_type": "none",
                "verified": false,
                "want_retweets": false,
                "withheld_in_countries": []
              }
            }
          }
        },
        "unmention_data": {},
        "edit_control": {
          "edit_tweet_ids": [
            "1718160087640895695"
          ],
          "editable_until_msecs": "1698479861000",
          "is_edit_eligible": true,
          "edits_remaining": "5"
        },
        "is_translatable": false,
        "views": {
          "count": "692",
          "state": "EnabledWithCount"
        },
        "source": "<a href=\"http://twitter.com/download/android\" rel=\"nofollow\">Twitter for Android</a>",
        "quoted_status_result": {},
        "legacy": {
          "bookmark_count": 1,
          "bookmarked": false,
          "created_at": "Sat Oct 28 06:57:41 +0000 2023",
          "conversation_id_str": "1718160087640895695",
          "display_text_range": [
            0,
            119
          ],
          "entities": {
            "user_mentions": [],
            "urls": [],
            "hashtags": [],
            "symbols": []
          },
          "favorite_count": 20,
          "favorited": false,
          "full_text": "if you are american you are morally obligated to watch this. all three minutes. you don't need subtitles to understand.",
          "is_quote_status": true,
          "lang": "en",
          "quote_count": 0,
          "quoted_status_id_str": "1718146972144570678",
          "quoted_status_permalink": {
            "url": "https://t.co/fbK4xvuHtM",
            "expanded": "https://twitter.com/Sarah_Hassan94/status/1718146972144570678",
            "display": "twitter.com/Sarah_Hassan94…"
          },
          "reply_count": 2,
          "retweet_count": 13,
          "retweeted": false,
          "user_id_str": "1567619928542396417",
          "id_str": "1718160087640895695"
        }
      }
    },
    "tweetDisplayType": "Tweet"
  },
  "feedbackInfo": {
    "feedbackKeys": [
      "1060665035"
    ]
  },
  "clientEventInfo": {
    "component": "result",
    "element": "tweet",
    "details": {
      "timelinesDetails": {
        "controllerData": "DAACDAAFDAABDAABDAABCgABAAAAAAAAAAAAAAwAAgoAAQAAAAAAAAAACgACyojezDxwbv8KAAUfQwjfXo7yoQgABgAAAAAKAAfJAtVV14BZvAAAAAAA"
      }
    }
  }
}
cooljeanius commented 9 months ago

I think I've been seeing this in searches and hashtag clicks... @kheina could you take a look please?

rougetimelord commented 8 months ago

Ok I've figured out the problem causing this error. Occasionally the tweet object used in ParseTimelineTweet will have a quoted_status_result property that is an empty Object, which means that the following call to handleTweetObject has undefined as the first parameter. https://github.com/kheina-com/Blue-Blocker/blob/f6db6561f89b8f3c29a9a181b6d81534208eab09/src/parsers/instructions.ts#L98-L102 The error occurs in handleTweetObject, because undefined does not have a hasOwnProperty property (ironic isn't it) https://github.com/kheina-com/Blue-Blocker/blob/f6db6561f89b8f3c29a9a181b6d81534208eab09/src/parsers/instructions.ts#L69 The fix would be to validate if quoted_status_result.result exists here: https://github.com/kheina-com/Blue-Blocker/blob/f6db6561f89b8f3c29a9a181b6d81534208eab09/src/parsers/instructions.ts#L97 Would probably be a good idea to do the same check here, just in case: https://github.com/kheina-com/Blue-Blocker/blob/f6db6561f89b8f3c29a9a181b6d81534208eab09/src/parsers/instructions.ts#L103

@kheina seems to have gone inactive unfortunately, but I have made the necessary changes in #215

cooljeanius commented 8 months ago

ok so 4ddc965 ought to fix this (I haven't tested yet myself to confirm, though)