From bf83354c70286000e7da8aa32090f1c7c97cf963 Mon Sep 17 00:00:00 2001 From: Slyyxp <11709831+Slyyxp@users.noreply.github.com> Date: Wed, 22 Jul 2020 12:14:29 +0100 Subject: [PATCH] POST Data Cleaned & Config Expanded. - Removed unnecessary POST arguments. - Configuration now has the option to add your own hardware identifier. - Configuration now has the option to add your own user agent. --- README.md | 10 +++++----- modules/client.py | 34 ++-------------------------------- modules/config.py.example | 4 +++- 3 files changed, 10 insertions(+), 38 deletions(-) diff --git a/README.md b/README.md index d24400b..2343683 100644 --- a/README.md +++ b/README.md @@ -12,7 +12,6 @@ Tested on **[Python 3.8.0](https://www.python.org/downloads/release/python-380/)** - ## Prerequisites - Python 3.6+ @@ -39,15 +38,16 @@ Command | Description | Example -u | Genie album url (Required) | `https://www.genie.co.kr/detail/albumInfo?axnm=81510805` -f | Format. 1: MP3, 2: 16-bit FLAC, 3: 24-bit FLAC (Optional) | `2` - ## config.py **credentials:** Config | Description | Example ------------- | ------------- | ------------- -Username | Genie Username | `Slyyxp` -Password | Genie Password | `ReallyBadPassword123` +username | Genie Username | `Slyyxp` +password | Genie Password | `ReallyBadPassword123` +device_id | Android Device ID | `eb9d53a3c424f961` +user_agent | User Agent | `genie/ANDROID/5.1.1/WIFI/SM-G930L/dreamqltecaneb9d53a3c424f961/500200714/40807` **directories:** @@ -59,7 +59,7 @@ default_format | Default download format (1: MP3, 2: 16-bit FLAC, 3: 24-bit FLAC artist_folders | Whether or not to nest downloads into artist folders | `True/False` # To Do -- [ ] Figure out hardware identifiers +- [x] Figure out hardware identifiers - [ ] Refactor & Cleanup rip() - [ ] Playlist support - [ ] Artist support diff --git a/modules/client.py b/modules/client.py index d2176f3..83f04b5 100644 --- a/modules/client.py +++ b/modules/client.py @@ -14,13 +14,8 @@ class Client: def __init__(self): self.session = requests.Session() self.credentials = cfg.credentials - self.android_ver = "5.1.1" - self.app_ver = 40807 - self.dev_id = "eb9d53a3c424f961" - self.dev_model = "SM-G930L" - self.ims_num = "72c4b5a6d16f65482ccd2657d833b9817329be12a586a7e37e1f602c56bde4c3" - self.upnm = "MTU4MTEzOTgxNTg=" - self.usr_agent = "genie/ANDROID/5.1.1/WIFI/SM-G930L/dreamqltecaneb9d53a3c424f961/500200714/40807" + self.dev_id = self.credentials['device_id'] + self.usr_agent = self.credentials['user_agent'] self.session.headers.update({ "User-Agent": self.usr_agent, @@ -49,17 +44,6 @@ def auth(self): Authenticate our session appearing as an Android device """ data = { - "apvn": self.app_ver, - "dcd": self.dev_id, - "dvm": self.dev_model, - "imsnm": self.ims_num, - "mts": "Y", - "ovn": self.android_ver, - "sign": "Y", - "svc": "IV", - "tct": "Android", - "uip": "172.17.100.15", - "upnm": self.upnm, "uxd": self.credentials['username'], "uxx": self.credentials['password'] } @@ -79,19 +63,12 @@ def get_meta(self, id): :return: API Response containing album metadata. """ data = { - "apvn": self.app_ver, "axnm": id, "dcd": self.dev_id, - "dvm": self.dev_model, "mts": "Y", - "ovn": self.android_ver, - "pg": 1, - "pgsize": 100, - "sign": "Y", "stk": self.stm_token, "svc": "IV", "tct": "Android", - "uip": "172.17.100.15", "unm": self.usr_num, "uxtk": self.usr_token } @@ -114,17 +91,10 @@ def get_stream_meta(self, id, q): 3 - 24bit FLAC """ data = { - "apvn": self.app_ver, "bitrate": q, "dcd": self.dev_id, - "dvm": self.dev_model, - "mts": "Y", - "ovn": self.android_ver, - "sign": "Y", "stk": self.stm_token, "svc": "IV", - "tct": "Android", - "uip": "172.17.100.15", "unm": self.usr_num, "uxtk": self.usr_token, "xgnm": id diff --git a/modules/config.py.example b/modules/config.py.example index 3d4d565..a969975 100644 --- a/modules/config.py.example +++ b/modules/config.py.example @@ -1,6 +1,8 @@ credentials={ "username": "", - "password": "" + "password": "", + "device_id": "eb9d53a3c424f961", + "user_agent": "genie/ANDROID/5.1.1/WIFI/SM-G930L/dreamqltecaneb9d53a3c424f961/500200714/40807", } prefs={