Advertisement
AmourSpirit

Export DNS records from bluehost.com with jQuery

Aug 30th, 2019
805
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /*
  2.  * Export DNS records from bluehost.com with jQuery
  3.  * Original Script Here: https://coolaj86.com/articles/export-dns-records-from-bluehost-com-with-jquery/
  4.  * Changes: td fields are not converted to lower case
  5.  *          JSON key names have space replaced with _
  6.  *
  7.  * You sign in to BlueHost and go to your domain management page
  8.  * Then open the Chrome JavaScript Console
  9.  * Then paste the entirely of the script above and hit enter.
  10.  * Viola, your DNS records as JSON!
  11.  */
  12. var things = [];
  13.  
  14. $('.rec_body').each(function (i, table) {
  15.   var headers = [];
  16.   $(table).find('.brand-table.rec_table.gridtable tr').each(function (j, tr) {
  17.     if (0 === j) {
  18.       $(tr).find('th').each(function (k, th) {
  19.         headers[k] = ($(th).text()||'').toLowerCase().replace(' ', '_');
  20.       });
  21.       return;
  22.     }
  23.     var thing = {};
  24.  
  25.     $(tr).find('td').each(function (k, td) {
  26.       thing[headers[k]] = ($(td).text()||'');
  27.     });
  28.  
  29.     things.push(thing);
  30.   });
  31. });
  32.  
  33. console.log(JSON.stringify(things, null, '  '));
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement