AyrA

keygenmusic.net list

Mar 4th, 2019
351
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. //#REF:https://www.reddit.com/r/ProgrammerHumor/comments/ax6dcu/computing_in_the_90s_vs_computing_in_2018/ehrwej6/
  2. //keygenmusic.net file list.
  3. //Go to http://keygenmusic.net/?page=allteams and run the script below for latest list
  4. //CSV Result will be placed in your clipboard and JSON result displayed in the console
  5.  
  6. //script
  7. (function () {
  8.     var getTeam = function (container) {
  9.         var team = container.querySelector(".menutitle").textContent.trim();
  10.         var ret = {
  11.             name: team,
  12.             files: []
  13.         };
  14.         var list = container.querySelectorAll(".teamtable td > a");
  15.         for (var i = 0; i < list.length; i += 2) {
  16.             var url = list[i].href.match(/([^/]+)\.[^.]+$/)[1];
  17.             try {
  18.                 url = decodeURIComponent(url);
  19.             } catch {
  20.                 console.warn("Will take Invalid URL as-is:", url);
  21.             }
  22.             var obj = {
  23.                 title: list[i].textContent.trim(),
  24.                 file: url,
  25.                 id: +list[i + 1].href.match(/fileid=(\d+)/)[1]
  26.             };
  27.             ret.files.push(obj);
  28.         }
  29.         return ret;
  30.     };
  31.     var ret = [];
  32.     document.querySelectorAll(".teamcontainer").forEach(function (v) {
  33.         ret.push(getTeam(v));
  34.     });
  35.     console.log(ret);
  36.  
  37.     //make CSV output too to copy into spreadsheet application
  38.     var csv = ["id\tTeam\tName\tFile"];
  39.     Object.keys(ret).forEach(function (v) {
  40.         var files = ret[v].files;
  41.         files.forEach(function (f) {
  42.             csv.push([f.id, ret[v].name, f.title, f.file].join('\t'));
  43.         });
  44.     });
  45.     copy(csv.join('\r\n'));
  46. })();
Add Comment
Please, Sign In to add comment