Skip to content

Instantly share code, notes, and snippets.

@byigitt
Last active February 2, 2024 09:31
Show Gist options
  • Select an option

  • Save byigitt/f5cdcc01e7a91058c65463bd704bc025 to your computer and use it in GitHub Desktop.

Select an option

Save byigitt/f5cdcc01e7a91058c65463bd704bc025 to your computer and use it in GitHub Desktop.
checks all keywords from a json file (which includes an array of keywords) and check if it is valid as username on last.fm
// In last.fm website, if a user creates the account and disables it, other people cannot get the old username
// so, this is not %100 valid for username checking purposes. I would use the API while creating your account
// but it has CSRF stuff and I dont know how to bypass it to be honest and I didnt care that much.. soo.. here ya go!
import fs from "fs";
import got from "got";
function read(file) {
return JSON.parse(fs.readFileSync(file, "utf8"));
}
(async () => {
let keywords = read("./keywords.json"),
invalid = read("./invalid-words.json"),
valid = read("./valid-words.json");
const headers = {
"User-Agent":
"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 Safari/537.36",
"Accept-Language": "en-US,en;q=0.9",
"Accept-Encoding": "gzip, deflate, br",
Referer: "https://www.google.com/",
Connection: "keep-alive",
"Cache-Control": "max-age=0",
};
const delay = 3500; // Delay between each request in milliseconds
for (const keyword of keywords) {
if (invalid.includes(keyword) || valid.includes(keyword)) continue;
try {
const response = await got(`https://last.fm/user/${keyword}`, {
headers,
throwHttpErrors: false,
});
if (response.statusCode === 404) {
valid.push(keyword);
fs.writeFileSync("./valid-words.json", JSON.stringify(valid, null, 2));
} else if (response.statusCode === 200) {
invalid.push(keyword);
fs.writeFileSync("./invalid-words.json", JSON.stringify(invalid, null, 2));
} else if (response.statusCode === 406) {
console.log("Ratelimitted, waiting 5 minute...");
await new Promise((resolve) => setTimeout(resolve, 1000 * 60 * 5));
continue;
}
console.log(`${keyword} - ${response.statusCode}`);
await new Promise((resolve) => setTimeout(resolve, delay));
} catch (error) {
console.log(error);
}
}
console.log("Done!");
process.exit();
})();
["the","of","to","and","a","in","is","it","you","that","he","was","for","on","are","with","as","I","his","they","be","at","one","have","this","from","or","had","by","not","word","but","what","some","we","can","out","other","were","all","there","when","up","use","your","how","said","an","each","she","which","do","their","time","if","will","way","about","many","then","them","write","would","like","so","these","her","long","make","thing","see","him","two","has","look","more","day","could","go","come","did","number","sound","no","most","people","my","over","know","water","than","call","first","who","may","down","side","been","now","find","any","new","work","part","take","get","place","made","live","where","after","back","little","only","round","man","year","came","show","every","good","me","give","our","under","name","very","through","just","form","sentence","great","think","say","help","low","line","differ","turn","cause","much","mean","before","move","right","boy","old","too","same","tell","does","set","three","want","air","well","also","play","small","end","put","home","read","hand","port","large","spell","add","even","land","here","must","big","high","such","follow","act","why","ask","men","change","went","light","kind","off","need","house","picture","try","us","again","animal","point","mother","world","near","build","self","earth","father","head","stand","own","page","should","country","found","answer","school","grow","study","still","learn","plant","cover","food","sun","four","between","state","keep","eye","never","last","let","thought","city","tree","cross","farm","hard","start","might","story","saw","far","sea","draw","left","late","run","dont","while","press","close","night","real","life","few","north","open","seem","together","next","white","children","begin","got","walk","example","ease","paper","group","always","music","those","both","mark","often","letter","until","mile","river","car","feet","care","second","book","carry","took","science","eat","room","friend","began","idea","fish","mountain","stop","once","base","hear","horse","cut","sure","watch","color","face","wood","main","enough","plain","girl","usual","young","ready","above","ever","red","list","though","feel","talk","bird","soon","body","dog","family","direct","pose","leave","song","measure","door","product","black","short","numeral","class","wind","question","happen","complete","ship","area","half","rock","order","fire","south","problem","piece","told","knew","pass","since","top","whole","king","space","heard","best","hour","better","true","during","hundred","five","remember","step","early","hold","west","ground","interest","reach","fast","verb","sing","listen","six","table","travel","less","morning","ten","simple","several","vowel","toward","war","lay","against","pattern","slow","center","love","person","money","serve","appear","road","map","rain","rule","govern","pull","cold","notice","voice","unit","power","town","fine","certain","fly","fall","lead","cry","dark","machine","note","wait","plan","figure","star","box","noun","field","rest","correct","able","pound","done","beauty","drive","stood","contain","front","teach","week","final","gave","green","oh","quick","develop","ocean","warm","free","minute","strong","special","mind","behind","clear","tail","produce","fact","street","inch","multiply","nothing","course","stay","wheel","full","force","blue","object","decide","surface","deep","moon","island","foot","system","busy","test","record","boat","common","gold","possible","plane","stead","dry","wonder","laugh","thousand","ago","ran","check","game","shape","equate","hot","miss","brought","heat","snow","tire","bring","yes","distant","fill","east","paint","language","among","grand","ball","yet","wave","drop","heart","am","present","heavy","dance","engine","position","arm","wide","sail","material","size","vary","settle","speak","weight","general","ice","matter","circle","pair","include","divide","syllable","felt","perhaps","pick","sudden","count","square","reason","length","represent","art","subject","region","energy","hunt","probable","bed","brother","egg","ride","cell","believe","fraction","forest","sit","race","window","store","summer","train","sleep","prove","lone","leg","exercise","wall","catch","mount","wish","sky","board","joy","winter","sat","written","wild","instrument","kept","glass","grass","cow","job","edge","sign","visit","past","soft","fun","bright","gas","weather","month","million","bear","finish","happy","hope","flower","clothe","strange","gone","jump","baby","eight","village","meet","root","buy","raise","solve","metal","whether","push","seven","paragraph","third","shall","held","hair","describe","cook","floor","either","result","burn","hill","safe","cat","century","consider","type","law","bit","coast","copy","phrase","silent","tall","sand","soil","roll","temperature","finger","industry","value","fight","lie","beat","excite","natural","view","sense","ear","else","quite","broke","case","middle","kill","son","lake","moment","scale","loud","spring","observe","child","straight","consonant","nation","dictionary","milk","speed","method","organ","pay","age","section","dress","cloud","surprise","quiet","stone","tiny","climb","cool","design","poor","lot","experiment","bottom","key","iron","single","stick","flat","twenty","skin","smile","crease","hole","trade","melody","trip","office","receive","row","mouth","exact","symbol","die","least","trouble","shout","except","wrote","seed","tone","join","suggest","clean","break","lady","yard","rise","bad","blow","oil","blood","touch","grew","cent","mix","team","wire","cost","lost","brown","wear","garden","equal","sent","choose","fell","fit","flow","fair","bank","collect","save","control","decimal","gentle","woman","captain","practice","separate","difficult","doctor","please","protect","noon","whose","locate","ring","character","insect","caught","period","indicate","radio","spoke","atom","human","history","effect","electric","expect","crop","modern","element","hit","student","corner","party","supply","bone","rail","imagine","provide","agree","thus","capital","wont","chair","danger","fruit","rich","thick","soldier","process","operate","guess","necessary","sharp","wing","create","neighbor","wash","bat","rather","crowd","corn","compare","poem","string","bell","depend","meat","rub","tube","famous","dollar","stream","fear","sight","thin","triangle","planet","hurry","chief","colony","clock","mine","tie","enter","major","fresh","search","send","yellow","gun","allow","print","dead","spot","desert","suit","current","lift","rose","continue","block","chart","hat","sell","success","company","subtract","event","particular","deal","swim","term","opposite","wife","shoe","shoulder","spread","arrange","camp","invent","cotton","born","determine","quart","nine","truck","noise","level","chance","gather","shop","stretch","throw","shine","property","column","molecule","select","wrong","gray","repeat","require","broad","prepare","salt","nose","plural","anger","claim","continent","oxygen","sugar","death","pretty","skill","women","season","solution","magnet","silver","thank","branch","match","suffix","especially","fig","afraid","huge","sister","steel","discuss","forward","similar","guide","experience","score","apple","bought","led","pitch","coat","mass","card","band","rope","slip","win","dream","evening","condition","feed","tool","total","basic","smell","valley","nor","double","seat","arrive","master","track","parent","shore","division","sheet","substance","favor","connect","post","spend","chord","fat","glad","original","share","station","dad","bread","charge","proper","bar","offer","segment","slave","duck","instant","market","degree","populate","chick","dear","enemy","reply","drink","occur","support","speech","nature","range","steam","motion","path","liquid","log","meant","quotient","teeth","shell","neck"]
["the","of","to","and","a","is","it","you","that","he","was","for","on","with","as","I","his","they","be","at","one","have","this","from","or","had","by","not","word","but","what","some","we","can","other","were","there","when","up","use","your","how","said","an","each","she","which","do","their","time","if","will","way","about","many","then","them","write","would","like","so","these","her","long","make","thing","two","has","look","more","could","go","come","did","number","sound","most","people","my","water","over","know","than","call","first","may","down","side","been","now","find","any","work","part","take","place","made","live","where","after","back","little","only","round","man","came","show","good","me","give","our","under","very","through","just","form","sentence","great","think","say","help","low","line","differ","turn","cause","much","mean","before","move","right","still","learn","plant","cover","sun","four","between","state","keep","eye","never","last","let","thought","city","cross","farm","hard","start","might","story","far","sea","draw","run","dont","while","press","close","night","real","life","few","open","seem","together","next","white","children","begin","got","walk","example","ease","paper","group","always","music","those","both","mark","often","letter","until","mile","river","car","feet","care","book","carry","took","science","room","began","idea","fish","mountain","stop","once","horse","cut","sure","watch","color","wood","main","enough","plain","girl","usual","young","ready","above","ever","red","list","though","feel","talk","bird","soon","dog","family","direct","pose","leave","song","measure","door","product","black","numeral","class","wind","question","happen","complete","ship","area","half","rock","order","fire","south","problem","piece","told","knew","pass","top","whole","space","heard","best","hour","better","true","during","hundred","five","remember","step","early","hold","west","ground","interest","reach","fast","verb","sing","listen","six","table","travel","less","morning","ten","simple","several","vowel","toward","war","against","pattern","slow","center","person","money","serve","appear","road","map","rain","rule","govern","pull","cold","notice","voice","unit","power","town","fine","certain","fly","fall","lead","dark","machine","note","wait","plan","figure","star","box","noun","rest","correct","able","pound","done","beauty","drive","stood","contain","front","teach","week","final","gave","green","oh","quick","develop","ocean","warm","free","minute","strong","special","mind","behind","clear","tail","produce","street","inch","multiply","nothing","course","stay","wheel","full","force","blue","object","decide","surface","deep","moon","island","foot","busy","test","record","common","gold","possible","plane","stead","dry","wonder","laugh","thousand","ago","ran","check","game","shape","equate","hot","miss","brought","heat","tire","bring","yes","distant","fill","east","paint","language","among","grand","ball","yet","wave","drop","heart","am","present","heavy","dance","engine","position","arm","wide","sail","material","size","vary","settle","speak","weight","general","ice","matter","circle","pair","include","divide","syllable","felt","perhaps","pick","sudden","count","square","length","represent","art","subject","region","energy","hunt","probable","bed","egg","ride","cell","believe","fraction","forest","race","store","summer","train","sleep","prove","lone","leg","exercise","wall","catch","mount","wish","sky","board","joy","winter","sat","written","wild","instrument","kept","glass","grass","cow","job","edge","sign","visit","past","soft","fun","bright","gas","weather","month","million","bear","finish","happy","hope","flower","clothe","strange","gone","jump","baby","eight","village","meet","root","buy","raise","solve","metal","whether","seven","paragraph","third","shall","held","hair","describe","cook","floor","either","result","burn","hill","cat","century","consider","type","law","bit","coast","copy","phrase","silent","tall","sand","soil","roll","temperature","finger","industry","value","excite","view","sense","ear","else","quite","broke","case","middle","lake","moment","scale","loud","spring","observe","child","straight","nation","dictionary","milk","speed","method","organ","pay","age","section","dress","cloud","surprise","quiet","tiny","climb","cool","design","poor","lot","experiment","bottom","key","iron","single","stick","flat","twenty","skin","smile","crease","hole","trade","trip","office","row","mouth","symbol","least","trouble","shout","except","wrote","seed","tone","join","suggest","clean","break","lady","rise","bad","oil","blood","touch","grew","cent","mix","wire","cost","lost","brown","wear","garden","equal","sent","choose","fell","fit","flow","fair","bank","collect","control","decimal","gentle","woman","practice","separate","difficult","doctor","please","protect","noon","whose","locate","ring","character","insect","caught","period","indicate","radio","spoke","atom","human","history","effect","electric","expect","crop","modern","element","hit","student","corner","party","supply","bone","rail","imagine","provide","agree","thus","capital","wont","chair","danger","fruit","rich","thick","soldier","process","operate","guess","necessary","sharp","wing","create","neighbor","wash","rather","crowd","corn","compare","poem","string","bell","depend","rub","tube","famous","dollar","stream","sight","thin","triangle","planet","hurry","chief","colony","clock","mine","tie","enter","major","fresh","search","send","yellow","gun","allow","print","dead","spot","desert","suit","current","lift","rose","continue","block","chart","sell","success","company","subtract","event","particular","deal","swim","term","wife","shoe","shoulder","spread","arrange","camp","invent","cotton","born","determine","quart","nine","truck","noise","level","chance","gather","shop","stretch","throw","shine","property","column","molecule","select","wrong","repeat","require","broad","prepare","salt","plural","anger","continent","oxygen","sugar","death","skill","women","season","solution","magnet","silver","thank","branch","match","suffix","especially","fig","afraid","huge","steel","discuss","forward","similar","guide","experience","score","apple","bought","led","pitch","coat","mass","card","band","rope","slip","win","dream","evening","condition","feed","tool","total","basic","smell","valley","nor","double","seat","arrive","master","track","parent","shore","division","sheet","substance","favor","connect","post","spend","chord","fat","glad","original","share","station","dad","bread","charge","proper","offer","segment","slave","duck","instant","market","degree","populate","chick","dear","enemy","reply","occur","support","speech","nature","range","steam","motion","path","liquid","log","meant","quotient","teeth","shell","neck","old","too","same","does","set","three","want","air","play","small","end","read","hand","port","large","spell","add","even","land","here","must","big","high","such","follow","why","change","went","light","kind","off","need","house","try","us","again","animal","point","mother","world","near","build","self","father","head","stand","own","page","should","country","found","answer","school","grow","study"]
["in","are","out","all","see","him","day","no","who","new","get","year","every","name","boy","food","tree","saw","left","late","north","second","eat","friend","base","hear","face","body","short","since","king","lay","love","cry","field","fact","system","boat","snow","reason","brother","sit","window","push","safe","fight","lie","beat","natural","kill","son","consonant","stone","melody","receive","exact","die","yard","blow","team","save","captain","bat","meat","fear","hat","opposite","gray","nose","claim","pretty","sister","bar","drink","tell","well","also","put","home","act","ask","men","picture","earth"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment