kheina-com / Blue-Blocker

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

Errors spawned when trying to tag someone's handle in a DM (unexpected error occurred while parsing request body) #189

Closed cooljeanius closed 4 months ago

cooljeanius commented 1 year ago

Steps to reproduce:

  1. Start typing a DM to someone
  2. Type @ and start typing someone's handle
  3. Notice the error pop-ups (1 error occurs for each additional letter added, presumably because the handle auto-complete prompt changes with each additional letter added)

Log output:

21:13:13.468 [Blue Blocker] unexpected error occurred while parsing request body 
Object { error: TypeError, body_str: '{"num_results":10,"users":[{"id":1169092291929300992,"id_str":"1169092291929300992","verified":false,"ext_is_blue_verified":false,"is_dm_able":true,"is_secret_dm_able":false,"is_blocked":false,"can_media_tag":false,"name":"Elon Muskie","screen_name":"siebznet","profile_image_url":"http:\\/\\/pbs.twimg.com\\/profile_images\\/1589790858538233858\\/CtjHSTqo_normal.jpg","profile_image_url_https":"https:\\/\\/pbs.twimg.com\\/profile_images\\/1589790858538233858\\/CtjHSTqo_normal.jpg","location":"","is_protected":false,"rounded_score":0,"social_proof":0,"connecting_user_count":0,"connecting_user_ids":[],"social_proofs_ordered":[],"social_context":{"following":true,"followed_by":true},"tokens":[],"inline":false,"result_context":{"display_string":"You follow each other","types":[{"type":"follow_relationship"}]}},{"id":2497458150,"id_str":"2497458150","verified":false,"ext_is_blue_verified":true,"is_dm_able":true,"is_secret_dm_able":false,"is_blocked":false,"can_media_tag":true,"name":"fuck every word","screen_name":"fuckeveryword","profile_image_url":"http:\\/\\/pbs.twimg.com\\/profile_images\\/477304353460477954\\/22GX6xG6_normal.jpeg","profile_image_url_https":"https:\\/\\/pbs.twimg.com\\/profile_images\\/477304353460477954\\/22GX6xG6_normal.jpeg","location":"","is_protected":false,"rounded_score":0,"social_proof":0,"connecting_user_count":0,"connecting_user_ids":[],"social_proofs_ordered":[],"tokens":[],"inline":false},{"id":161163311,"id_str":"161163311","verified":false,"ext_is_blue_verified":false,"is_dm_able":true,"is_secret_dm_able":false,"is_blocked":false,"can_media_tag":false,"name":"Jeff Blehar is *BOX OFFICE POISON*","screen_name":"EsotericCD","profile_image_url":"http:\\/\\/pbs.twimg.com\\/profile_images\\/1627681254484152321\\/ntyc1TZ6_normal.jpg","profile_image_url_https":"https:\\/\\/pbs.twimg.com\\/profile_images\\/1627681254484152321\\/ntyc1TZ6_normal.jpg","location":"Chicago, IL","is_protected":false,"rounded_score":0,"social_proof":0,"connecting_user_count":0,"connecting_user_ids":[],"social_proofs_ordered":[],"social_context":{"following":true,"followed_by":false},"tokens":[],"inline":false,"result_context":{"display_string":"Following","types":[{"type":"follow_relationship"}]}},{"id":14733264,"id_str":"14733264","verified":false,"ext_is_blue_verified":false,"is_dm_able":true,"is_secret_dm_able":false,"is_blocked":false,"can_media_tag":true,"name":"Wool-Encased Tea Addict","screen_name":"Passeriform","profile_image_url":"http:\\/\\/pbs.twimg.com\\/profile_images\\/877879315609698304\\/LR1YH3TW_normal.jpg","profile_image_url_https":"https:\\/\\/pbs.twimg.com\\/profile_images\\/877879315609698304\\/LR1YH3TW_normal.jpg","location":"usually New England","is_protected":false,"rounded_score":0,"social_proof":0,"connecting_user_count":0,"connecting_user_ids":[],"social_proofs_ordered":[],"social_context":{"following":true,"followed_by":true},"tokens":[],"inline":false,"result_context":{"display_string":"You follow each other","types":[{"type":"follow_relationship"}]}},{"id":755504,"id_str":"755504","verified":false,"ext_is_blue_verified":false,"is_dm_able":false,"is_secret_dm_able":false,"is_blocked":false,"can_media_tag":false,"name":"Alexandra Erin | alexandraerin@peoplemaking.games","screen_name":"AlexandraErin","profile_image_url":"http:\\/\\/pbs.twimg.com\\/profile_images\\/1312106752868003840\\/QCqpmlJi_normal.jpg","profile_image_url_https":"https:\\/\\/pbs.twimg.com\\/profile_images\\/1312106752868003840\\/QCqpmlJi_normal.jpg","location":"Hagerstown","is_protected":false,"rounded_score":0,"social_proof":0,"connecting_user_count":0,"connecting_user_ids":[],"social_proofs_ordered":[],"social_context":{"following":true,"followed_by":false},"tokens":[],"inline":false,"result_context":{"display_string":"Following","types":[{"type":"follow_relationship"}]}},{"id":40353407,"id_str":"40353407","verified":false,"ext_is_blue_verified":false,"is_dm_able":false,"is_secret_dm_able":false,"is_blocked":false,"can_media_tag":true,"name":"Elie Mystal","screen_name":"ElieNYC","profile_image_url":"http:\\/\\/pbs.twimg.com\\/profile_images\\/1554595874071789571\\/d43D1SfX_normal.jpg","profile_image_url_https":"https:\\/\\/pbs.twimg.com\\/profile_images\\/1554595874071789571\\/d43D1SfX_normal.jpg","location":"NY","is_protected":false,"rounded_score":0,"social_proof":0,"connecting_user_count":0,"connecting_user_ids":[],"social_proofs_ordered":[],"social_context":{"following":true,"followed_by":false},"tokens":[],"inline":false,"result_context":{"display_string":"Following","types":[{"type":"follow_relationship"}]}},{"id":1291770157,"id_str":"1291770157","verified":false,"ext_is_blue_verified":false,"is_dm_able":true,"is_secret_dm_able":false,"is_blocked":false,"can_media_tag":false,"name":"Johnetta Elzie","screen_name":"Nettaaaaaaaa","profile_image_url":"http:\\/\\/pbs.twimg.com\\/profile_images\\/1584875299694600194\\/Kz7W2eEo_normal.jpg","profile_image_url_https":"https:\\/\\/pbs.twimg.com\\/profile_images\\/1584875299694600194\\/Kz7W2eEo_normal.jpg","location":"","is_protected":false,"rounded_score":0,"social_proof":0,"connecting_user_count":0,"connecting_user_ids":[],"social_proofs_ordered":[],"social_context":{"following":true,"followed_by":false},"tokens":[],"inline":false,"result_context":{"display_string":"Following","types":[{"type":"follow_relationship"}]}},{"id":590798034,"id_str":"590798034","verified":false,"ext_is_blue_verified":false,"is_dm_able":false,"is_secret_dm_able":false,"is_blocked":false,"can_media_tag":true,"name":"Zalman","screen_name":"enterzalman","profile_image_url":"http:\\/\\/pbs.twimg.com\\/profile_images\\/1195084119912398848\\/ICKuG-YN_normal.jpg","profile_image_url_https":"https:\\/\\/pbs.twimg.com\\/profile_images\\/1195084119912398848\\/ICKuG-YN_normal.jpg","location":"","is_protected":false,"rounded_score":0,"social_proof":0,"connecting_user_count":0,"connecting_user_ids":[],"social_proofs_ordered":[],"social_context":{"following":true,"followed_by":false},"tokens":[],"inline":false,"result_context":{"display_string":"Following","types":[{"type":"follow_relationship"}]}},{"id":1342600926,"id_str":"1342600926","verified":false,"ext_is_blue_verified":false,"is_dm_able":false,"is_secret_dm_able":false,"is_blocked":false,"can_media_tag":false,"name":"\\ud83c\\uddf5\\ud83c\\uddf7Geo (rare emotionless mushroom version)\\ud83d\\ude10","screen_name":"BombosMedallion","profile_image_url":"http:\\/\\/pbs.twimg.com\\/profile_images\\/1677709069514166273\\/YBGfdhZi_normal.jpg","profile_image_url_https":"https:\\/\\/pbs.twimg.com\\/profile_images\\/1677709069514166273\\/YBGfdhZi_normal.jpg","location":"ACAB","is_protected":true,"rounded_score":0,"social_proof":0,"connecting_user_count":0,"connecting_user_ids":[],"social_proofs_ordered":[],"social_context":{"following":true,"followed_by":false},"tokens":[],"inline":false,"result_context":{"display_string":"Following","types":[{"type":"follow_relationship"}]}},{"id":137395584,"id_str":"137395584","verified":false,"ext_is_blue_verified":false,"is_dm_able":false,"is_secret_dm_able":false,"is_blocked":false,"can_media_tag":true,"name":"Robert Evans (The Only Robert Evans)","screen_name":"IwriteOK","profile_image_url":"http:\\/\\/pbs.twimg.com\\/profile_images\\/598663964340301824\\/im3Wzn-o_normal.jpg","profile_image_url_https":"https:\\/\\/pbs.twimg.com\\/profile_images\\/598663964340301824\\/im3Wzn-o_normal.jpg","location":"","is_protected":false,"rounded_score":0,"social_proof":0,"connecting_user_count":0,"connecting_user_ids":[],"social_proofs_ordered":[],"social_context":{"following":true,"followed_by":false},"tokens":[],"inline":false,"result_context":{"display_string":"Following","types":[{"type":"follow_relationship"}]}}],"topics":[],"events":[],"lists":[],"ordered_sections":[],"oneclick":[],"hashtags":[],"completed_in":0.0,"query":"E"}', event: blue-blocker-event }
[chunk-af3d2282.js:1:16065](moz-extension://7969e46a-e5e2-48ac-8e73-92ba4bfad2ee/assets/chunk-af3d2282.js)

Let me know if you need anything expanded.

kheina commented 1 year ago

yeah, one thing that would help a lot, is if you could open your console and let us know the url that's returning this response? it's likely search/typeahead.json but if you could confirm that would be excellent, and we can fix this response type

kheina commented 1 year ago

related: #113

cooljeanius commented 1 year ago

yeah, one thing that would help a lot, is if you could open your console and let us know the url that's returning this response? it's likely search/typeahead.json but if you could confirm that would be excellent, and we can fix this response type

Is this the right part?

parsedUrl: Array [ "https://twitter.com/i/api/1.1/search/typeahead.json?", "search/typeahead.json" ]
​​​​
0: "https://twitter.com/i/api/1.1/search/typeahead.json?"
​​​​
1: "search/typeahead.json"
​​​​
groups: undefined
​​​​
index: 0
​​​​
input: "https://twitter.com/i/api/1.1/search/typeahead.json?include_ext_is_blue_verified=1&include_ext_verified_type=1&include_ext_profile_image_shape=1&q=E&src=compose_message&result_type=users&context_text=%40E"
​​​​
length: 2
kheina commented 1 year ago

yeah perfect, unfortunately I don't get that error locally, but your error body may be enough to fix it

kheina commented 1 year ago

ok, I was actually able to replicate the error, I didn't realize this was in DMs and not the search bar like #113 thanks for the report

cooljeanius commented 11 months ago

ok, I was actually able to replicate the error, I didn't realize this was in DMs and not the search bar like #113 thanks for the report

@kheina any progress on figuring out what's going wrong here? I'm still seeing this occasionally.

rougetimelord commented 5 months ago

Found it! Error is here: https://github.com/kheina-com/Blue-Blocker/blob/main/src/parsers/search.ts#L18-L19 The parser expects there to be a social_context property on the user object.

In my limited observations, if the twitter user is not following or being followed by the extension user then the social_context property is omitted.