ceceradio / twitter-block-chain

Chrome extension to block all users on a followers/following page.
MIT License
247 stars 50 forks source link

[Suggestion] Use block_all API for block user #10

Closed gaeulbyul closed 5 years ago

gaeulbyul commented 6 years ago

Twitter has another API for block user: https://twitter.com/i/users/block_all. (Currently it is using for CSV blocklist import feature)

This API can block many (up to 800)¹ user in single request. It would be great for Twitter-block-chain extension.

Example Usage:

POST /i/users/block_all

authenticity_token=0000000000000
user_ids[]=884033788858085377
user_ids[]=871952445361889280
user_ids[]=1000704020636360706
user_ids[]=831075168193695744

Response(JSON):

{
  "result": {
    "blocked": [
      "884033788858085377",
      "871952445361889280",
      "1000704020636360706",
      "831075168193695744"
    ],
    "failed": []
  }
}

¹ from twitter's code (https://abs.twimg.com/k/ko/2.pages_settings.ko.a848670d33a48950e987.js):

// ...
this.defaultAttrs({
  blockAllEndpoint: "/i/user/block_all",
  chunkSize: 800
}),
this.blockAllUsers = function(t, e) { ... }
// ...
ceceradio commented 6 years ago

very cool! sounds like it would work well for reducing network usage.

ceceradio commented 5 years ago

I think this API is not going to be available in the new PWA UI but hopefully they'll re-implement it soon.