This commit is contained in:
matiashik committed 2026-03-28 14:18:38 +00:00
commit 75312b5ee3
17 files changed
+2503

No files matched your search

+2
View File
@@ -0,0 +1,2 @@
venv
music
+99
View File
@@ -0,0 +1,99 @@
import json
import requests
import os
import subprocess
import typing
import threading
import time
class song:
def __init__(self, json_song) -> None:
self.__url = json_song["url"]
self.__artist = json_song["artist"]
self.__title = json_song["title"]
@property
def url(self) -> str:
return self.__url
@property
def artist(self) -> str:
return self.__artist
@property
def title(self) -> str:
return self.__title
def seg_finder(mlst: typing.List[str]):
for i in mlst:
if i[:3] == "seg":
yield i
def the_fetcher(m_subj: song, number):
global counter
global thread_count
start = time.time()
root_url = m_subj.url.split("index.m3u8")[0]
inc_name = root_url.split("/")[-2]
os.mkdir("music/" + inc_name)
f = open("music/" + inc_name + "/" + "index.m3u8", "wb")
m3u8 = requests.get(m_subj.url).content
f.write(m3u8)
f.close()
m3u8 = list(seg_finder(str(m3u8).split("\\n")[:-1]))
m3u8.sort()
for i in m3u8:
f = open("music/" + inc_name + "/" + i, "wb")
f.write(requests.get(root_url + i).content)
f.close()
prc = subprocess.Popen(
f'ffmpeg -protocol_whitelist file,http,https,tcp,tls,crypto -allowed_extensions ALL -i music/{inc_name}/index.m3u8 -metadata title="{m_subj.title}" -metadata artist="{m_subj.artist}" -metadata track={number} music/"{m_subj.title} - {m_subj.artist}".mp3 &> /dev/null && rm -r music/{inc_name}',
shell=True,
)
prc.wait()
print(
f"Process number {number} ({m_subj.title} - {m_subj.artist}) is done in {time.time() - start}s"
)
counter -= 1
locker.acquire()
thread_count -= 1
locker.release()
inp = open("music_info.json", "r+")
m_seq = [song(i) for i in json.load(inp)]
m_seq.reverse()
counter = len(m_seq)
endway = counter
locker = threading.Lock()
thread_count = 0
glb_start = time.time()
i = 0
while i < endway:
locker.acquire()
if thread_count >= 8:
locker.release()
else:
i += 1
thread_count += 1
locker.release()
thread = threading.Thread(target=the_fetcher, args=(m_seq.pop(), i))
thread.start()
while counter != 0:
pass
print(f"Program is done in {(time.time() - glb_start)}s")
+83
View File
@@ -0,0 +1,83 @@
{
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [],
"source": [
"import vk_api\n",
"from vk_api import audio\n",
"\n",
"my_id = '464426988'\n",
"login = '+89152561930'\n",
"\n",
"vk = vk_api.VkApi(\n",
" login=\"+89152561930\",\n",
" password=\"\",\n",
" token=\"vk1.a.skTRr1KCyj6tv1HchGCCYLSSlqaMJ0_4rBzfK0Ywzm1mTxFoQGL-5TPd9NaL8D1h3XbyKIs0Ir5ukMe2T4XFM81pvaMLH-1lNqaTvaiqmxlwQm4y0ZbQHfxhdfdaZZQDWvVyq2YeP4zx4zOwklbsd0Ohp3StDMV5P3eoL3ZCD6XYU7juLrH9unNJHkdMcmit\",\n",
" app_id=6121396,\n",
") # токен брать для vkadmin https://habr.com/ru/articles/519302/\n",
"vk.auth(token_only=True)\n",
"vk_audio = audio.VkAudio(vk)\n"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {},
"outputs": [],
"source": [
"audlist = vk_audio.get(owner_id=my_id)"
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {},
"outputs": [],
"source": [
"clrlist = [({\n",
" 'url': a['url'],\n",
" 'artist': a['artist'],\n",
" 'title': a['title']\n",
"}) for a in audlist]"
]
},
{
"cell_type": "code",
"execution_count": 5,
"metadata": {},
"outputs": [],
"source": [
"import json\n",
"\n",
"outp = open('music_info.json', 'w')\n",
"\n",
"json.dump(clrlist, outp)"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "venv",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.11.3"
},
"orig_nbformat": 4
},
"nbformat": 4,
"nbformat_minor": 2
}
File diff suppressed because it is too large. Load diff
+29
View File
@@ -0,0 +1,29 @@
/*
Ищется все анальной слежкой за файлом al_audio в разделе Network
*/
fetch("https://vk.com/al_audio.php?act=reload_audios", {
"headers": {
"accept": "*/*",
"accept-language": "ru,ru-RU;q=0.9,uk-UA;q=0.8,uk;q=0.7,en-US;q=0.6,en;q=0.5",
"cache-control": "no-cache",
"content-type": "application/x-www-form-urlencoded",
"pragma": "no-cache",
"sec-ch-ua": "\"Not/A)Brand\";v=\"99\", \"Google Chrome\";v=\"115\", \"Chromium\";v=\"115\"",
"sec-ch-ua-mobile": "?0",
"sec-ch-ua-platform": "\"Linux\"",
"sec-fetch-dest": "empty",
"sec-fetch-mode": "cors",
"sec-fetch-site": "same-origin",
"x-requested-with": "XMLHttpRequest",
"cookie": "remixnsid=vk1.a.qPPka0F3lhS8jVoHtQoB7gDFHcKtfkv7HnY6aNM-G-M_rVkCqDmAoE_ClYOyYfRjYyRZHBBiTWGmaqdoZ9ZRHO28bqKWNWeJAFBBwgpt_uW6bajeluUSmaY4tUdnvVhVEf58gcFryVfz-zA0toGqHskWmYbSNMuInFhNQnasrODwoUkLWy7VaTxGO-ci6rXw; remixsid=1_uASEY0w2iQTqXCxSGcam9V0CTmvDLfijvy6h9GNXmgwlJGMO5HYly-3YloQzBtqKoNzMvH1JBtu6wvflu_DXsg;",
"Referrer-Policy": "strict-origin-when-cross-origin"
},
"body": "al=1&audio_ids=464426988_456240014_",
"method": "POST"
}).then(e => {
e.json().then(j => {
console.log(j['payload'][1][0][0][2])
})
}
)
+93
View File
@@ -0,0 +1,93 @@
/*
Ищется все анальной слежкой за получением m3u8 файла через раздел Network
*/
const r = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMN0PQRSTUVWXYZO123456789+/=";
const i = {
v: function (e) {
return e.split("").reverse().join("")
},
r: function (e, t) {
let o;
e = e.split("");
const n = r + r;
let i = e.length;
for (; i--;)
o = n.indexOf(e[i]),
~o && (e[i] = n.substr(o - t, 1));
return e.join("")
},
s: function (e, t) {
let o = e.length;
if (o) {
const n = function (e, t) {
const o = e.length
, n = [];
if (o) {
let e = o;
for (t = Math.abs(t); e--;)
t = (o * (e + 1) ^ t + e) % o,
n[e] = t
}
return n
}(e, t);
let r = 0;
for (e = e.split(""); ++r < o;)
e[r] = e.splice(n[o - 1 - r], 1, e[r])[0];
e = e.join("")
}
return e
},
i: function (e, t) {
return i.s(e, t ^ vk.id)
},
x: function (e, t) {
const o = [];
return t = t.charCodeAt(0),
(0,
n.each)(e.split(""), (function (e, n) {
o.push(String.fromCharCode(n.charCodeAt(0) ^ t))
}
)),
o.join("")
}
};
const vk = {
id: 464426988
};
function a(e) {
if (!e || e.length % 4 == 1)
return !1;
let t, o, n = 0, i = 0, s = "";
for (; o = e.charAt(i++);)
o = r.indexOf(o),
~o && (t = n % 4 ? 64 * t + o : o,
n++ % 4) && (s += String.fromCharCode(255 & t >> (-2 * n & 6)));
return s
}
function s(e) {
let t, o, n = e.split("?extra=")[1].split("#"), r = "" === n[1] ? "" : a(n[1]);
if (n = a(n[0]),
"string" != typeof r || !n)
return e;
r = r ? r.split(String.fromCharCode(9)) : [];
let s = r.length;
for (; s--;) {
if (o = r[s].split(String.fromCharCode(11)),
t = o.splice(0, 1, n)[0],
!i[t])
return e;
n = i[t].apply(null, o)
}
if (n && "http" === n.substr(0, 4))
return n
return e
}
console.log(s("https://vk.com/mp3/audio_api_unavailable.mp3?extra=Af0VALnevxnknO9WmwvdsM9ICKf0lOfPp2v4AxvYEfHZlvP1ovPdlLn5AxnStMj4lZL2EKzgohGTwujsyvDPyuK4lwrsnNu4EejOovjMn1vFAhmTqJHkvweOCJfHDMnRl1CWwc5vofvlAM9gtef6nZHfz3zPDtq2tg5hq1zJBs90BvzbtJLvogeUyI9izMLJB2HKEenfqvv2C2fOt25PsueZu3rKyxPZtfL2vgKXrejXBNDoAxnXzxDgCh09t2fLBunuotq3mdHYm3nkBOuZDs1Avv0XmMPZCLPvBMTRDdP1vOnLAwjRzdmVna#AqSOmJi"
))
+175
View File
@@ -0,0 +1,175 @@
{
"+89152561930": {
"cookies": [
{
"comment": null,
"comment_url": null,
"discard": false,
"domain": ".vk.com",
"domain_initial_dot": true,
"domain_specified": true,
"expires": null,
"name": "remixlang",
"path": "/",
"path_specified": true,
"port": null,
"port_specified": false,
"rest": {},
"rfc2109": false,
"secure": true,
"value": "100",
"version": 0
},
{
"comment": null,
"comment_url": null,
"discard": false,
"domain": ".vk.com",
"domain_initial_dot": true,
"domain_specified": true,
"expires": null,
"name": "remixstlid",
"path": "/",
"path_specified": true,
"port": null,
"port_specified": false,
"rest": {},
"rfc2109": false,
"secure": true,
"value": "9093720130901750552_7s0XnrcJBjS8oqZC1d0vFfe7sxZVdrIaXdcZyzhmkgH",
"version": 0
},
{
"comment": null,
"comment_url": null,
"discard": false,
"domain": ".vk.com",
"domain_initial_dot": true,
"domain_specified": true,
"expires": null,
"name": "remixua",
"path": "/",
"path_specified": true,
"port": null,
"port_specified": false,
"rest": {},
"rfc2109": false,
"secure": true,
"value": "43%7C-1%7C320%7C3987579067",
"version": 0
},
{
"comment": null,
"comment_url": null,
"discard": false,
"domain": ".vk.com",
"domain_initial_dot": true,
"domain_specified": true,
"expires": null,
"name": "remixstid",
"path": "/",
"path_specified": true,
"port": null,
"port_specified": false,
"rest": {},
"rfc2109": false,
"secure": true,
"value": "1222537880_X7ZN3kf6fzbrHUwJLZv5uK4ZA8kVSlyzxZzhvYaHZao",
"version": 0
},
{
"comment": null,
"comment_url": null,
"discard": false,
"domain": ".vk.com",
"domain_initial_dot": true,
"domain_specified": true,
"expires": null,
"name": "remixsid",
"path": "/",
"path_specified": true,
"port": null,
"port_specified": false,
"rest": {
"HttpOnly": null
},
"rfc2109": false,
"secure": true,
"value": "1_JiEVPSo1HFJp7lWrWumdRLX3zymBaxxq1lvZmADkt7tW7qJAVaionvz5W0kTA-fH_BtQLEx7dk00fqD6cWuCiw",
"version": 0
},
{
"comment": null,
"comment_url": null,
"discard": false,
"domain": ".login.vk.com",
"domain_initial_dot": false,
"domain_specified": true,
"expires": null,
"name": "p",
"path": "/",
"path_specified": true,
"port": null,
"port_specified": false,
"rest": {
"HttpOnly": null
},
"rfc2109": false,
"secure": true,
"value": "vk1.a.zXqt4wtow7Uyj1tZaDO9ueO1L7LnZH52VfLVfPSJP2rG97N1l2u2-GQGvMZKPSB4NcC0Z2140XNsMjYUCThAwrXKeSZFp-1guZz-DlZFCelcpPmtWPHQCM0NqCyneXRGZRj7Xn_lC3sj3m5JTNDkd5YwWYgTaJ6CX76y4Z8Cjfs",
"version": 0
},
{
"comment": null,
"comment_url": null,
"discard": false,
"domain": "login.vk.com",
"domain_initial_dot": false,
"domain_specified": false,
"expires": null,
"name": "remixluas2",
"path": "/",
"path_specified": true,
"port": null,
"port_specified": false,
"rest": {
"HttpOnly": null
},
"rfc2109": false,
"secure": true,
"value": "OTBlZjYyOWQxMmRkY2NiMTExNTkwMDEz",
"version": 0
},
{
"comment": null,
"comment_url": null,
"discard": false,
"domain": "vk.com",
"domain_initial_dot": false,
"domain_specified": false,
"expires": null,
"name": "remixnsid",
"path": "/",
"path_specified": true,
"port": null,
"port_specified": false,
"rest": {
"HttpOnly": null
},
"rfc2109": false,
"secure": true,
"value": "vk1.a.O-8uzqiK1C-mpFWKX3FB4aM_tZjhvgCpKH__EPKEPuczNME_3RsapkWvXKtszZ8NfxhStf4y3qaEdMlQVfzYciVlkrTO9btwnhncYSWrgesRuOBdf8gpBn6DMOFn76PWeBjeovV5UwVfXCg4-o20ggrTP5pRLo2cf3Q7NP1Ov5mTcGp8HsOcf6yPg-2ySPxO",
"version": 0
}
],
"token": {
"app6121396": {
"scope_140492255": {
"access_token": "vk1.a.YXorSuhq53FCYlsjSJxfWqUEjDiiUmnLzO4gb4zv3IyEsDztPuPXbMbo8HdnZaLWSR-UeFH-yKO0XmSmSLbsykcCtT6tX269SzrSEqsJWvj06cJmHhXLKCO6EbC8Fr7ngnA3MlfEKxzbFPKMyLYxBW-SqEiqScyKE_PffaYUbsMsD-rHjtmWXwNJjPMijQAfZNgnXV6Zo0l11z5pLaL1DA",
"expires_in": "0",
"user_id": "464426988"
}
}
}
}
}