Twitter Filter Chrome Extension is a project that allows users to filter toxic text content on the Twitter website using the Cohere AI API for text classification. The extension injects a content script into the active tab on Twitter, which monitors tweets and applies a blur effect to those that are classified as toxic.
- Automatic text classification of tweets using the Cohere AI API.
- Blur effect applied to toxic tweets to filter them from view.
- Toggle the filtering behavior using a checkbox in the extension's popup UI.
- Chrome extension architecture for easy installation and usage.
- The Chrome extension injects a content script into the active tab on the Twitter website.
- The content script uses a MutationObserver to detect newly added tweets on the Twitter feed.
- When a new tweet is detected, the text content of the tweet is extracted for classification.
- The content script sends the extracted text to the Cohere AI API for text classification.
- The API returns the classification result, indicating whether the tweet is toxic or not.
- If the tweet is classified as toxic, the content script applies a blur effect to the tweet element to hide it from view.
- Clone this repository to your local machine.
- Open Google Chrome and go to
chrome://extensions
. - Enable "Developer mode" in the top right corner.
- Click on "Load unpacked" and select the folder where you cloned the repository.
- The extension should now appear in your Chrome extensions list.
Before using the extension, make sure to set up your Cohere AI API credentials:
- Sign up for an account at https://cohere.ai/ and obtain your API key.
- Replace
'Bearer YOUR_API_KEY'
in theclassifyArr
function with your actual API key.
- Open Twitter in a new tab or navigate to an existing Twitter tab.
- Click on the extension icon to open the popup UI.
- Check the checkbox in the popup UI to enable the filtering of toxic tweets.
- Uncheck the checkbox to disable the filtering and reveal all tweets.
Contributions are welcome! If you find any bugs or have suggestions for improvement, please open an issue or submit a pull request.
- The Cohere AI API for text classification.
- Google Chrome Extension Documentation.