From 96b9b01295d34e6489298fd0a6b3f1dd951e0599 Mon Sep 17 00:00:00 2001 From: Wlerin Date: Fri, 13 Mar 2020 13:08:52 -0700 Subject: [PATCH] Update required libraries - Add websocket-client - Re-enable fake-useragent - Update fallback user-agent --- README.md | 23 ++++++----------------- requirements.txt | 1 + showroom/api.py | 0 showroom/api/session.py | 18 +++++++++--------- 4 files changed, 16 insertions(+), 26 deletions(-) delete mode 100644 showroom/api.py diff --git a/README.md b/README.md index 5011c4a..39b8721 100644 --- a/README.md +++ b/README.md @@ -31,6 +31,7 @@ To download only specific members' rooms, use: To set a different data directory, use: python showroom.py --data-dir [--all or "Member Name"] + For additional options, type: python showroom.py --help @@ -39,7 +40,8 @@ Or take a gander at the start.sh script. ## Installation -Requires FFmpeg, Python 3.5+, and Requests +Requires FFmpeg, Python 3.5+, and the Python libraries requests, +websocket-client, and pyyaml ##### 1. Install ffmpeg @@ -104,26 +106,13 @@ Or use the Download as ZIP button above. ##### 5. Install Required Python Packages -- [Requests](http://docs.python-requests.org/en/master/) - -Both of these packages can be installed by running: +All required packages can be installed by running: pip install -r requirements.txt -in the showroom-dev directory. - -##### 6. (Optional) Install PyYAML - -- [PyYAML](http://pyyaml.org/wiki/PyYAMLDocumentation) - -Required if you want to format your config files using YAML instead -of JSON. In the future this may also be an option for output. You -may wish to install libyaml as well (see the -[libYAML](http://pyyaml.org/wiki/LibYAML) docs) for faster parsing. - - pip install pyyaml +in the showroom directory. -##### 7. (Optional) Install index_maker Dependencies +##### 6. (Optional) Install index_maker Dependencies - [BeautifulSoup](https://www.crummy.com/software/BeautifulSoup/) diff --git a/requirements.txt b/requirements.txt index 7dad2a6..3ad660b 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,3 +1,4 @@ requests fake-useragent pyyaml +websocket-client diff --git a/showroom/api.py b/showroom/api.py deleted file mode 100644 index e69de29..0000000 diff --git a/showroom/api/session.py b/showroom/api/session.py index 48f42f6..5ec593a 100644 --- a/showroom/api/session.py +++ b/showroom/api/session.py @@ -5,15 +5,15 @@ import time from .cookiejar import ClientCookieJar -#try: -# from fake_useragent import UserAgent -#except ImportError: -# UserAgent = None -# ua = None -ua_str = 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/77.0.3865.90 Safari/537.36' -#else: -# ua = UserAgent(fallback='Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/65.0.3325.181 Safari/537.36') -# ua_str = ua.chrome +try: + from fake_useragent import UserAgent +except ImportError: + UserAgent = None + ua = None + ua_str = 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.116 Safari/537.36' +else: + ua = UserAgent(fallback='Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.116 Safari/537.36') + ua_str = ua.chrome session_logger = logging.getLogger('showroom.session')