Skip to content
This repository has been archived by the owner on Aug 14, 2022. It is now read-only.

Commit

Permalink
POST Data Cleaned & Config Expanded.
Browse files Browse the repository at this point in the history
- 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.
  • Loading branch information
Slyyxp committed Jul 22, 2020
1 parent d1a22a4 commit bf83354
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 38 deletions.
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@

Tested on **[Python 3.8.0](https://www.python.org/downloads/release/python-380/)**


## Prerequisites

- Python 3.6+
Expand All @@ -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:**

Expand All @@ -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
Expand Down
34 changes: 2 additions & 32 deletions modules/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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']
}
Expand All @@ -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
}
Expand All @@ -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
Expand Down
4 changes: 3 additions & 1 deletion modules/config.py.example
Original file line number Diff line number Diff line change
@@ -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={
Expand Down

1 comment on commit bf83354

@Slyyxp
Copy link
Owner Author

@Slyyxp Slyyxp commented on bf83354 Jul 22, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A lot of this post data was unnecessary although accepted.
I removed all unnecessary post arguments.

Please sign in to comment.