Advertisement
AyrA

key.js

Mar 8th, 2018
222
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. //Uses PhantomJS to get the Key for MakeMKV
  2.  
  3. var wp = require("webpage");
  4. var fs = require("fs");
  5. var page = wp.create();
  6.  
  7. //error codes
  8. var ERR = {
  9.     SUCCESS: 0,
  10.     FAILED_TO_LOAD_PAGE: 1
  11. };
  12.  
  13. page.open("https://www.makemkv.com/forum2/viewtopic.php?f=5&t=1053", function (status) {
  14.     if (status !== "success") {
  15.         phantom.exit(ERR.FAILED_TO_LOAD_PAGE);
  16.     } else {
  17.         var key = page.evaluate(function () {
  18.                 return (document.querySelector(".codecontent") || {}).textContent;
  19.             });
  20.         console.log(key);
  21.         if(key){
  22.             fs.write("makemkv-key.txt", key, "w");
  23.         }
  24.         phantom.exit(ERR.SUCCESS);
  25.     }
  26. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement