MCPcopy Create free account
hub / github.com/Useful-Scripts-Extension/useful-script / backup

Function backup

scripts/zingmp3_downloadMusic.js:275–321  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

273};
274
275function backup() {
276 // https://mp3.zing.vn/xhr/media/get-url-download?type=audio&panel=.fn-tab-panel-service&type=audio&sig=7a6af5a44e7d0209a6f852c03dbcc317&code=ZHJmtLLdNSsNdssyHyDHZmyLXCJsmNuNN&aliastitle=&title=&count=&id=Z6WZD78I&group=.fn-tab-panel
277 const MP3 = {
278 XHR_URL: "//mp3.zing.vn/xhr",
279 IMG_URL: "https://photo-zmp3.zmdcdn.me",
280 API_VIP_URL: "//vip-api.zingmp3.vn/",
281 API_COMMENT_URL: "//comment.api.mp3.zing.vn",
282 DOWNLOAD_API: "https://download.mp3.zing.vn/api",
283 };
284
285 if (location.hostname === "mp3.zing.vn") {
286 let a = document.querySelector("#tabService");
287 let params = {};
288
289 Object.entries(a.attributes).forEach(([index, attribute]) => {
290 if (attribute?.name?.startsWith("data-")) {
291 let key = attribute.name.replace("data-", "");
292 let value = attribute.value;
293 params[key] = value;
294 }
295 });
296
297 fetch(
298 MP3.XHR_URL +
299 "/media/get-url-download?" +
300 new URLSearchParams(params).toString()
301 )
302 .then((res) => {
303 console.log(res);
304 return res.json();
305 })
306 .then((json) => {
307 if (json && !json.err && json.data) {
308 console.log(json.data);
309 let { artist, thumb, title, sources } = json.data;
310 const { 128: song128, 320: song320, lossless } = sources;
311
312 window.open("https://mp3.zing.vn" + song128.link);
313 }
314 })
315 .catch((e) => {
316 alert("Error: " + e.message);
317 });
318 // window.open(MP3.XHR_URL + window.xmlLink);
319 return;
320 }
321}

Callers

nothing calls this directly

Calls 1

replaceMethod · 0.80

Tested by

no test coverage detected