Advertisement
Guest User

Get all domains owned on namebase

a guest
Feb 3rd, 2021
309
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. (async function () {
  2.   let domains = [];
  3.   let done = false;
  4.   while (!done) {
  5.     const resp = await fetch(
  6.       'https://www.namebase.io/api/user/domains/not-listed/' +
  7.         domains.length +
  8.         '?sortKey=acquiredAt&sortDirection=desc&limit=100',
  9.       {
  10.         credentials: 'include',
  11.         headers: {
  12.           'User-Agent':
  13.             'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:85.0) Gecko/20100101 Firefox/85.0',
  14.           Accept: 'application/json',
  15.           'Accept-Language': 'fr,fr-FR;q=0.8,en-US;q=0.5,en;q=0.3',
  16.           'Content-Type': 'application/json',
  17.           signal: '[object AbortSignal]',
  18.           'If-None-Match': 'W/"27bd-2XZcSJ4+2o39iz9jHa5CWVN0uf4"',
  19.           'Cache-Control': 'max-age=0'
  20.         },
  21.         referrer: 'https://www.namebase.io/manage/owned?page=1',
  22.         method: 'GET',
  23.         mode: 'cors'
  24.       }
  25.     );
  26.     const json = await resp.json();
  27.     const newDomains = json.domains.map(a => a.name);
  28.     domains = domains.concat(newDomains);
  29.     if (newDomains.length === 0) {
  30.       done = true;
  31.     }
  32.   }
  33.  
  34.   const listedResp = await fetch(
  35.     'https://www.namebase.io/api/user/domains/listed',
  36.     {
  37.       credentials: 'include',
  38.       headers: {
  39.         'User-Agent':
  40.           'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:85.0) Gecko/20100101 Firefox/85.0',
  41.         Accept: 'application/json',
  42.         'Accept-Language': 'fr,fr-FR;q=0.8,en-US;q=0.5,en;q=0.3',
  43.         'Content-Type': 'application/json',
  44.         signal: '[object AbortSignal]'
  45.       },
  46.       referrer: 'https://www.namebase.io/manage/listed',
  47.       method: 'GET',
  48.       mode: 'cors'
  49.     }
  50.   );
  51.   const listedJson = await listedResp.json();
  52.   const listedDomains = listedJson.domains.map(a => a.name);
  53.   domains = domains.concat(listedDomains);
  54.  
  55.   console.log(domains);
  56.   console.log(domains.join('\n'));
  57. })();
  58.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement