https://github.com/1developpeur/useragent-generator
Powerful Python3 library that generates realistic User-Agent strings for different browsers and operating systems.
https://github.com/1developpeur/useragent-generator
generator generators python python3 scraper scrapers scraping useragent useragent-generator useragent-scraper useragents
Last synced: 7 months ago
JSON representation
Powerful Python3 library that generates realistic User-Agent strings for different browsers and operating systems.
- Host: GitHub
- URL: https://github.com/1developpeur/useragent-generator
- Owner: 1Developpeur
- License: mit
- Created: 2025-03-21T19:13:10.000Z (7 months ago)
- Default Branch: main
- Last Pushed: 2025-03-21T19:26:22.000Z (7 months ago)
- Last Synced: 2025-03-21T20:24:19.255Z (7 months ago)
- Topics: generator, generators, python, python3, scraper, scrapers, scraping, useragent, useragent-generator, useragent-scraper, useragents
- Language: Python
- Homepage:
- Size: 15.6 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
- Security: SECURITY.md
Awesome Lists containing this project
README
# 🎭 User Agent Generator
A powerful Python library that generates realistic User-Agent strings for different browsers and operating systems. This tool helps you simulate various browser environments for testing and development purposes.
## 🌟 Features
- 🔄 Generates realistic User-Agent strings for multiple browsers:
- Chrome
- Firefox
- Edge
- 💻 Supports multiple operating systems:
- Windows
- macOS
- Linux
- 📦 Automatic version detection for latest browser releases
- 💾 Caching system to store browser versions
- 🎲 Random User-Agent generation
- ⚡ Fast and efficient## 🚀 Installation
```bash
pip install -r requirements.txt
```## 📋 Requirements
- Python 3.x
## 💡 Usage
```python
from ua import UserAgent# Initialize the UserAgent generator
ua_generator = UserAgent()# Generate a single random User-Agent
ua = ua_generator.genUA(amount=1)
print(ua)# Generate multiple User-Agents
uas = ua_generator.genUA(amount=5)
for ua in uas:
print(ua)# Generate User-Agent for specific browser and OS
ua = ua_generator.genUA(amount=1, os='win', browser='chrome')
print(ua)
```## 🛠️ API Reference
### `genUA(amount=1, os='random', browser='random', version='0')`
Generates User-Agent strings with the following parameters:
- `amount`: Number of User-Agents to generate (default: 1)
- `os`: Operating system ('win', 'mac', 'linux', or 'random')
- `browser`: Browser type ('chrome', 'firefox', 'edge', or 'random')
- `version`: Specific browser version (default: '0' for random)## 🔄 Browser Version Updates
The library automatically fetches and caches the latest browser versions every 24 hours. The cached versions are stored in `ua_versions.json`.
## ⚠️ Limitations
- Edge browser is not supported on Linux
- Version history for Edge is limited to the latest version
- Requires internet connection for initial setup and version updates## 🤝 Contributing
Contributions are welcome!
## 📄 License
This project is licensed under the MIT License.
## 🙏 Acknowledgments
- Browser version data from:
- Chrome: Google Version History API
- Firefox: Mozilla Product Details API
- Edge: Microsoft Edge Updates API---
Made with ❤️ by [1Developpeur](https://github.com/1Developpeur)