AmourSpirit icon

Export DNS records from bluehost.com with jQuery

AmourSpirit | PRO | 08/30/19 11:17:15 AM UTC | 0 ⭐ | 1690 👁️ | Never ⏰ | []
JavaScript |

1.02 KB

|

None

|

0 👍

/

0 👎

/*
 * Export DNS records from bluehost.com with jQuery
 * Original Script Here: https://coolaj86.com/articles/export-dns-records-from-bluehost-com-with-jquery/
 * Changes: td fields are not converted to lower case
 *          JSON key names have space replaced with _
 *
 * You sign in to BlueHost and go to your domain management page
 * Then open the Chrome JavaScript Console
 * Then paste the entirely of the script above and hit enter.
 * Viola, your DNS records as JSON!
 */
var things = [];
 
$('.rec_body').each(function (i, table) {
  var headers = [];
  $(table).find('.brand-table.rec_table.gridtable tr').each(function (j, tr) {
    if (0 === j) {
      $(tr).find('th').each(function (k, th) {
        headers[k] = ($(th).text()||'').toLowerCase().replace(' ', '_');
      });
      return;
    }
    var thing = {};
 
    $(tr).find('td').each(function (k, td) {
      thing[headers[k]] = ($(td).text()||'');
    });
 
    things.push(thing);
  });
});
 
console.log(JSON.stringify(things, null, '  '));

Comments

  •  icon
    01/01/70 12:00:00 AM UTC
    Plain Text |

    0 B

    |

    👍

    /

    👎