https://github.com/tylertemp/uadetect
A simple User-Agent detect for Chinese UA
https://github.com/tylertemp/uadetect
Last synced: 3 months ago
JSON representation
A simple User-Agent detect for Chinese UA
- Host: GitHub
- URL: https://github.com/tylertemp/uadetect
- Owner: TylerTemp
- License: mit
- Created: 2017-04-01T00:51:00.000Z (about 9 years ago)
- Default Branch: master
- Last Pushed: 2017-04-01T02:26:37.000Z (about 9 years ago)
- Last Synced: 2024-12-31T03:26:05.546Z (over 1 year ago)
- Language: Python
- Size: 4.88 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.rst
- License: LICENSE
Awesome Lists containing this project
README
UaDetect
========
A simple User-Agent detect for Chinese UA.
Ref: https://gist.github.com/tjefferson/807106972c71b30ea9c2
Install
-------
.. code:: bash
pip install git+https://github.com/TylerTemp/uadetect.git
OR
.. code:: bash
git clone https://github.com/TylerTemp/uadetect.git
cd uadetect
python setup.py install
Usage
-----
.. code:: python
import uadetect
uastring = 'Mozilla/5.0 (Windows; U; Windows NT 6.1; zh_CN) AppleWebKit/534.7 (KHTML, like Gecko) Chrome/18.0 BIDUBrowser/2.6 Safari/534.7'
print(uadetect.browser(uastring)) # baidu
print(uadetect.guess_browser(ua)) # ['baidu', 'uc', 'chrome']
print(uadetect.supported_browsers)
# ['sogou', 'explorer2345', 'liebao', 'wechat', 'qqbrowser', 'baidu', 'uc', 'miuibrowser', 'mobileqq', 'shoujibaidu', 'samsungbrowser', 'firefox', 'maxthon', 'se360', 'ee360', 'theworld', 'weibo', 'nokiabrowser', 'opera', 'edge', 'qqlive', 'letv', 'youku', 'androidbrowser', 'ie', 'toutiao', 'chrome', 'safari']
Test
----
.. code:: bash
git clone https://github.com/TylerTemp/uadetect.git
cd uadetect
python setup.py test