mirror of
https://github.com/FujiwaraChoki/hide-x-posts-from-country.git
synced 2026-04-26 23:05:51 +03:00
Chrome Extensions that hides the posts from certain countries on X.
| .gitignore | ||
| content.js | ||
| create-icons.html | ||
| demo.gif | ||
| demo.mp4 | ||
| icon16.png | ||
| icon48.png | ||
| icon128.png | ||
| manifest.json | ||
| pageScript.js | ||
| popup.html | ||
| popup.js | ||
| README.md | ||
| styles.css | ||
Hide X Posts from Country
A Chrome extension that automatically hides posts from specific countries on X (formerly Twitter). Select which countries to block through an easy-to-use popup interface, and the extension will hide posts from users in those locations.
Sponsor
Shiori, the best AI Chat App on the market.
Features
- 🌍 Hide posts from 50+ countries
- 🔍 Search and filter countries easily
- 💾 Automatic caching of user locations
- ⚡ Real-time post filtering
- 🎨 Clean, Twitter-like interface
Installation
Method 1: Load Unpacked Extension (Development)
- Clone or download this repository
- Open Chrome and navigate to
chrome://extensions/ - Enable "Developer mode" (toggle in top-right corner)
- Click "Load unpacked"
- Select the extension directory
- The extension icon should appear in your Chrome toolbar
Usage
- Click the extension icon in your Chrome toolbar
- Search for countries you want to block
- Check the boxes next to countries to block their posts
- Visit X/Twitter - posts from blocked countries will be automatically hidden
- To unblock a country, simply uncheck it in the popup
How It Works
The extension:
- Monitors the X/Twitter timeline for new posts
- Extracts the username from each post
- Fetches the user's location from Twitter's API (with caching)
- Matches the location against selected countries
- Hides posts from users in blocked countries
Location data is cached for 30 days to minimize API requests and improve performance.
Technical Details
Files
manifest.json- Extension configurationcontent.js- Main script that runs on X/Twitter pagespopup.html- Settings interface HTMLpopup.js- Settings interface logicstyles.css- Styles for hidden postscreate-icons.html- Icon generator utility
Permissions
storage- Save blocked countries and location cacheactiveTab- Access X/Twitter pages- Host permissions for
twitter.comandx.com
Browser Compatibility
- Chrome/Chromium-based browsers (Manifest V3)
- Edge, Brave, Opera (untested but should work)
Privacy
- All data is stored locally in your browser
- No data is sent to external servers
- Location information is fetched directly from Twitter's API
- The extension only processes data on X/Twitter pages
Limitations
- Country detection relies on user-entered location text
- Not all users have location information in their profiles
- Location text matching uses common patterns (may not catch all variations)
- For better accuracy, consider integrating a geocoding service
Future Enhancements
- Support for more countries and location patterns
- Integration with geocoding APIs for better accuracy
- Statistics dashboard
- Export/import blocked country lists
- Whitelist specific accounts
Troubleshooting
Posts not being hidden
- Make sure you've selected countries in the popup
- Check that the extension is enabled
- Refresh the X/Twitter page
- Some users may not have location information in their profiles
Performance issues
- The extension caches location data to minimize API calls
- Clear the cache by removing and reinstalling the extension if needed
Contributing
Contributions are welcome! Please feel free to submit issues or pull requests.

