ChiaSeNhac Helper

Download lossless music directly on ChiaSeNhac, bypass sharing dialog.

  1. // ==UserScript==
  2. // @name ChiaSeNhac Helper
  3. // @name:vi ChiaSeNhac Helper
  4. // @namespace https://lelinhtinh.github.io
  5. // @description Download lossless music directly on ChiaSeNhac, bypass sharing dialog.
  6. // @description:vi Tải nhạc lossless trực tiếp tại ChiaSeNhac, không cần đăng nhập hoặc chia sẻ lên MXH.
  7. // @version 1.3.0
  8. // @icon https://i.imgur.com/HLqWP3g.png
  9. // @author lelinhtinh
  10. // @oujs:author baivong
  11. // @license MIT; https://baivong.mit-license.org/license.txt
  12. // @match https://chiasenhac.vn/*
  13. // @match https://*.chiasenhac.vn/*
  14. // @match https://chiasenhac.com/*
  15. // @match https://*.chiasenhac.com/*
  16. // @noframes
  17. // @connect chiasenhac.vn
  18. // @connect chiasenhac.com
  19. // @supportURL https://github.com/lelinhtinh/Userscript/issues
  20. // @run-at document-idle
  21. // @grant none
  22. // ==/UserScript==
  23.  
  24. (function () {
  25. 'use strict';
  26.  
  27. const getFlacLink = (downloadLink) =>
  28. downloadLink
  29. .replace(/\/download(\d\/)/, '/stream$1')
  30. .replace(/\/(128|320|m4a|32)\//, '/flac/')
  31. .replace(/\.(mp3|m4a)$/, '.flac');
  32.  
  33. const $downloadItem = document.querySelector('a.download_item');
  34. const $downLossLess = document.querySelector('a#download_lossless');
  35.  
  36. if (!$downLossLess) return;
  37. if (!$downLossLess.href) $downLossLess.setAttribute('href', getFlacLink($downloadItem.href));
  38. $downLossLess.setAttribute('target', '_blank');
  39. $downLossLess.setAttribute('title', $downloadItem.title);
  40. $downLossLess.setAttribute('style', 'color: #6610f2;');
  41. $downLossLess.classList.add('music_downloaded');
  42. })();