welp, flac's ded lol

This commit is contained in:
uh wot 2021-07-19 20:24:32 +02:00
parent b6933e5faa
commit ece381d2ca
Signed by: uhwot
GPG Key ID: CB2454984587B781
2 changed files with 6 additions and 34 deletions

View File

@ -1,6 +1,6 @@
# dzunlock
enables deezer hifi features lol
enables deezer premium features lol
# how 2 install

View File

@ -3,7 +3,7 @@
// @namespace io.github.uhwot.dzunlock
// @description enables deezer hifi features lol
// @author uh wot
// @version 1.2.3
// @version 1.2.4
// @license GPL-3.0-only
// @homepageURL https://git.freezer.life/uhwot/dzunlock
// @downloadURL https://git.freezer.life/uhwot/dzunlock/raw/branch/master/dzunlock.user.js
@ -87,11 +87,6 @@ fetchIntercept = {
const clientId = '119915'
const clientSecret = '2f5b4c9785ddc367975b83d90dc46f5c'
const formats = [
{ api: '320', gw: 'MP3_320' },
{ api: 'flac', gw: 'FLAC' }
]
async function renewAccessToken() {
let url = `https://connect.deezer.com/oauth/access_token.php?grant_type=client_credentials&client_id=${clientId}&client_secret=${clientSecret}&output=json`
let resp = await fetch(url)
@ -155,9 +150,7 @@ window.addEventListener('DOMContentLoaded', (_) => {
userUppedSoFar++
continue
}
for (let j = 0; j < formats.length; j++) {
data.data[i]['FILESIZE_' + formats[j].gw] = json.batch_result[i - userUppedSoFar]['filesize_' + formats[j].api]
}
data.data[i].FILESIZE_MP3_320 = json.batch_result[i - userUppedSoFar].filesize_320
// for streaming while unlogged
data.data[i].MD5_ORIGIN = json.batch_result[i - userUppedSoFar].md5_origin
}
@ -213,38 +206,17 @@ fetchIntercept.register({
}
});
worker_input = function(e) {
worker_input = function (e) {
let json = e.data
if (typeof json !== 'object') {
json = JSON.parse(json)
}
//console.log("input", json)
input = json
if (json.message.md5) {
// track url gen
// decrypted track endpoint
json.message.cdn = 'https://cdns-proxy-{0}.dzcdn.net/api/1/'
worker.postMessage(JSON.stringify(json))
return
}
if (json.message.buffer) {
// track buffer decryption
// this code skips decryption entirely, since the track from the CDN is already unencrypted
let out = { message: { error: undefined } }
out['Symbol(PromisingWorker.id)'] = json['Symbol(PromisingWorker.id)']
out.message.result = json.message.buffer
//console.log("track buffer output", out)
postMessage(out)
return
}
worker.postMessage(e.data)
}
worker_output = function(e) {
worker_output = function (e) {
let json = e.data
if (typeof json !== 'object') {
json = JSON.parse(json)
@ -255,7 +227,7 @@ worker_output = function(e) {
// player token decryption
// enables 320/flac quality selection
json.message.result.audio_qualities.wifi_streaming = ['low', 'standard', 'high', 'lossless']
json.message.result.audio_qualities.wifi_streaming = ['low', 'standard', 'high']
// disables previews
json.message.result.streaming = true
json.message.result.limited = false