switched to different method of getting stream urls cause of retarded quota

This commit is contained in:
uh wot 2021-09-01 21:40:01 +02:00
parent e28ad54c6b
commit 695fd9ebc2
Signed by: uhwot
GPG key ID: CB2454984587B781
5 changed files with 166 additions and 89 deletions

View file

@ -1,14 +1,13 @@
use wasm_bindgen::prelude::*;
use blowfish::Blowfish;
use aes::{Aes128, Aes256};
use aes::Aes128;
use block_modes::{BlockMode, Cbc, Ecb};
use block_modes::block_padding::{NoPadding, ZeroPadding};
use md5::{Md5, Digest};
type BfCbc = Cbc<Blowfish, NoPadding>;
type Aes128Ecb = Ecb<Aes128, ZeroPadding>;
type Aes256Ecb = Ecb<Aes256, ZeroPadding>;
const TRACK_CDN_KEY: [u8; 16] = [106, 111, 54, 97, 101, 121, 54, 104, 97, 105, 100, 50, 84, 101, 105, 104];
const BF_SECRET: [u8; 16] = [103, 52, 101, 108, 53, 56, 119, 99, 48, 122, 118, 102, 57, 110, 97, 49];
@ -63,12 +62,4 @@ pub fn legacy_stream_url(md5_origin: &str, format: &str, id: &str, media_version
let ciphertext = cipher.encrypt_vec(&metadata_hash);
format!("https://cdns-proxy-{}.dzcdn.net/mobile/1/{}", md5_origin.chars().next().unwrap(), hex::encode(ciphertext))
}
#[wasm_bindgen]
pub fn decrypt_stream_url(url: &str) -> String {
let url = hex::decode(url).unwrap();
let cipher = Aes256Ecb::new_from_slices("2f5b4c9785ddc367975b83d90dc46f5c".as_bytes(), Default::default()).unwrap();
let url = cipher.decrypt_vec(&url).unwrap();
String::from_utf8_lossy(&url).into_owned()
}