Chirbit.com Chirb.it Downloader

This is a simple script that shows you a direct link to audio file that you want to download.

  1. // ==UserScript==
  2. // @name Chirbit.com Chirb.it Downloader
  3. // @description This is a simple script that shows you a direct link to audio file that you want to download.
  4. // @license Creative Commons Zero v1.0 Universal
  5. // @supportURL https://github.com/q2p/Chirbit-Link-Exporter
  6. // @author q2p
  7. // @namespace q2p
  8. // @version 0.4
  9. // @include http://chirb.it/*
  10. // @include https://chirb.it/*
  11. // @include http://chirbit.com/*
  12. // @include https://chirbit.com/*
  13. // @include http://www.chirbit.com/*
  14. // @include https://www.chirbit.com/*
  15. // @grant none
  16. // @run-at document-end
  17. // ==/UserScript==
  18.  
  19. (function() {
  20. 'use strict';
  21. function make_link(name, title, fd) {
  22. const file = "https://" + atob(fd.split("").reverse().join("")).replace("http://","").replace("https://","");
  23. const link_container = document.createElement("div");
  24. const link = document.createElement("a");
  25. link.href = file;
  26. link.download = name+" - "+title+".mp3";
  27. link.target = "_blank";
  28. link.textContent = "Download Link";
  29. link_container.appendChild(link);
  30. return link_container;
  31. }
  32. const full_name = document.getElementsByClassName("profile-fullname");
  33. const chirbit_username = document.getElementById("chirbit-username");
  34. if (full_name.length === 0 && chirbit_username !== null) {
  35. const name = chirbit_username.textContent;
  36. const title = document.getElementsByClassName("chirbit-title")[0].textContent;
  37. const wavholder = document.getElementsByClassName("wavholder")[0];
  38. const player_buttons = wavholder.getElementsByClassName("player-buttons")[0];
  39. for(let e of player_buttons.getElementsByTagName("i")) {
  40. if (e.id.startsWith("cplayer_") && e.dataset.fd) {
  41. let link = make_link(name, title, e.dataset.fd);
  42. link.classList.add("container");
  43. wavholder.parentElement.insertBefore(link, wavholder.nextSibling);
  44. break;
  45. }
  46. }
  47. } else if (full_name.length === 1 && chirbit_username === null) {
  48. const name = full_name[0];
  49. const cards = document.getElementsByClassName("media");
  50. for(let e of cards) {
  51. let media_body = e.getElementsByClassName("media-body")[0];
  52. let title = e.getElementsByClassName("truncate")[0].textContent;
  53. for(let i of e.getElementsByTagName("i")) {
  54. if (i.id.startsWith("cplayer_") && i.dataset.fd) {
  55. let link = make_link(name, title, i.dataset.fd);
  56. link.classList.add("media_row");
  57. let rows = media_body.getElementsByClassName("media-row");
  58. media_body.insertBefore(link, rows[rows.length-1]);
  59. break;
  60. }
  61. }
  62. }
  63. }
  64. })();