├── LICENSE ├── dep.js ├── index.js └── README.md /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2023 Ak | 0vm 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /dep.js: -------------------------------------------------------------------------------- 1 | const axios = require('axios'); 2 | 3 | function* generateUsernames() { 4 | const alphabet = 'abcdefghijklmnopqrstuvwxyz'; 5 | for (let i = 0; i < alphabet.length; i++) { 6 | for (let j = 0; j < alphabet.length; j++) { 7 | for (let k = 0; k < alphabet.length; k++) { 8 | for (let l = 0; l < alphabet.length; l++) { 9 | yield alphabet[i] + alphabet[j] + alphabet[k] + alphabet[l]; 10 | } 11 | } 12 | } 13 | } 14 | } 15 | 16 | const usernames = Array.from(generateUsernames()); 17 | 18 | async function checkUsername(username) { 19 | try { 20 | const response = await axios.head(`https://passport.twitch.tv/usernames/${username}`); 21 | const statusCode = response.status; 22 | console.log(`${username}: ${statusCode}`); 23 | } catch (error) { 24 | console.error(`An error occurred while checking user ${username}:`, error); 25 | } 26 | } 27 | 28 | async function checkUsernames() { 29 | const parallelRequestsCount = 20; 30 | 31 | for (let i = 0; i < usernames.length; i += parallelRequestsCount) { 32 | const promises = usernames 33 | .slice(i, i + parallelRequestsCount) 34 | .map(username => checkUsername(username)); 35 | 36 | await Promise.all(promises); 37 | } 38 | } 39 | 40 | checkUsernames(); 41 | -------------------------------------------------------------------------------- /index.js: -------------------------------------------------------------------------------- 1 | const puppeteer = require('puppeteer'); 2 | const fs = require('fs'); 3 | 4 | function* generateUsernames() { 5 | const alphabet = 'abcdefghijklmnopqrstuvwxyz'; 6 | for (let i = 0; i < alphabet.length; i++) { 7 | for (let j = 0; j < alphabet.length; j++) { 8 | for (let k = 0; k < alphabet.length; k++) { 9 | for (let l = 0; l < alphabet.length; l++) { 10 | yield alphabet[i] + alphabet[j] + alphabet[k] + alphabet[l]; 11 | } 12 | } 13 | } 14 | } 15 | } 16 | 17 | const usernames = Array.from(generateUsernames()); 18 | 19 | async function checkUsername(browser, username) { 20 | const page = await browser.newPage(); 21 | // Set user agent 22 | await page.setUserAgent( 23 | 'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:89.0) Gecko/20100101 Firefox/89.0' 24 | ); 25 | 26 | // disable images, CSS and fonts from loading 27 | await page.setRequestInterception(true); 28 | page.on('request', (request) => { 29 | if (['image', 'stylesheet', 'font'].includes(request.resourceType())) { 30 | request.abort(); 31 | } else { 32 | request.continue(); 33 | } 34 | }); 35 | 36 | try { 37 | await page.goto(`https://www.twitch.tv/${username}`); 38 | await page.waitForTimeout(4000); // wait for 4s 39 | const bodyHTML = await page.evaluate(() => document.body.innerHTML); 40 | if (bodyHTML.includes('Sorry. Unless you’ve got a time machine, that content is unavailable.')) { 41 | fs.appendFileSync('availableUsernames.txt', `${username} \n`); 42 | } 43 | } catch (error) { 44 | console.error(`An error occurred while checking user ${username}:`, error); 45 | } finally { 46 | await page.setContent(''); 47 | await page.close(); 48 | } 49 | } 50 | 51 | async function checkUsernames() { 52 | const browser = await puppeteer.launch({ 53 | headless: true, 54 | args: ['--no-sandbox', '--disable-setuid-sandbox'], 55 | }); 56 | const parallelBrowsingCount = 10; 57 | 58 | let startIndex = 0; 59 | try { 60 | const availableUsernames = fs.readFileSync('available.txt', 'utf8').split('\n').filter(Boolean); 61 | startIndex = usernames.findIndex(username => !availableUsernames.includes(username)); 62 | } catch (error) { 63 | console.error('An error occurred while reading available usernames:', error); 64 | return; // Stop execution if an error occurs 65 | } 66 | 67 | for (let i = startIndex; i < usernames.length; i += parallelBrowsingCount) { 68 | let promises = []; 69 | for (let j = 0; j < parallelBrowsingCount; j++) { 70 | if (usernames[i + j]) { 71 | promises.push(checkUsername(browser, usernames[i + j])); 72 | } 73 | } 74 | try { 75 | await Promise.all(promises); 76 | } catch (error) { 77 | console.error('An error occurred while checking usernames:', error); 78 | } 79 | } 80 | 81 | await browser.close(); 82 | } 83 | 84 | checkUsernames(); 85 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Twitch Username Checker 2 | dep.js and index.js are two distinct files with different functionalities. 3 | 4 | dep.js focuses on request-based operations and relies on the powerful axios library. It excels in making HTTP requests and handling responses effectively. With dep.js, you can easily leverage its capabilities to perform a wide range of tasks. It can be rate limited easily. 5 | 6 | On the other hand, index.js is built on the puppeteer framework. Unlike dep.js, it utilizes a headless browser to interact with web pages. This provides flexibility in scraping and automating web-related actions. Furthermore, index.js operates independently and is not subject to rate limitations. 7 | 8 | The Twitch Username Checker is a Node.js application that allows you to check the availability of Twitch usernames. It utilises the Puppeteer library to automate the process of visiting Twitch profiles and checking for the "Sorry. Unless you’ve got a time machine, that content is unavailable." message. 9 | 10 | ## Prerequisites 11 | 12 | Before running the application, make sure you have the following installed on your machine: 13 | 14 | - Node.js 15 | - npm (Node Package Manager) 16 | 17 | ## Installation 18 | 19 | 1. Clone the repository: 20 | ```ruby 21 | git clone https://github.com/0vm/twitch-username-checker.git 22 | ``` 23 | 24 | 3. Navigate to the project directory: 25 | ```ruby 26 | cd twitch-username-checker 27 | ``` 28 | 29 | 4. Install the dependencies: 30 | ```ruby 31 | npm install Puppeteer 32 | ``` 33 | 34 | 5. Request Based Version Dependencies 35 | ```ruby 36 | npm install axios 37 | ``` 38 | 39 | ## Usage 40 | 41 | 1. Open the `index.js` file and modify the desired range of usernames to generate. By default, it generates all combinations of four-letter usernames from 'aaaa' to 'zzzz'. You can adjust this range according to your needs. 42 | 43 | 2. Run the application: 44 | ```ruby 45 | node index.js 46 | ``` 47 | or 48 | ```ruby 49 | node dep.js 50 | ``` 51 | 52 | 3. The application will start checking the availability of Twitch usernames. It will create a file named `availableUsernames.txt` and append any available usernames to it. 53 | 54 | ## Error Handling 55 | 56 | The application includes error handling mechanisms to prevent crashes when encountering errors during the checking process. Any errors that occur will be logged to the console, allowing the application to continue checking the remaining usernames. 57 | 58 | ## Customisation 59 | 60 | You can customise the application by modifying the following parameters: 61 | 62 | - `parallelBrowsingCount`: Specifies the number of parallel browser instances to run. Adjust this value based on your machine's capabilities and performance requirements. 63 | 64 | - User Agent: The application sets a custom User Agent string to mimic Firefox. If needed, you can modify the User Agent in the `checkUsername` function. 65 | 66 | ## ⚠️ Warning ⚠️ 67 | 68 | **This application utilises significant CPU and RAM resources due to the nature of the operations it performs. Please consider the following before running the application:** 69 | 70 | - Running this application may cause high CPU and RAM usage on your machine, especially when scanning multiple URLs concurrently. 71 | - It is recommended to run this application on a device with sufficient resources or allocate dedicated resources to avoid impacting the performance of other applications running concurrently. 72 | - We advise running this application on a remote desktop or an unused device to minimise disruptions and ensure optimal performance. 73 | - Adjust the `parallelBrowsingCount` variable in the `checkUsernames` function to control the number of concurrent browser tabs opened by Puppeteer. Higher values may increase resource usage. 74 | 75 | **Please proceed with caution and ensure that your system can handle the resource demands of this application before running it.** 76 | 77 | ## Contributing 78 | 79 | Contributions are welcome! If you encounter any issues or have suggestions for improvements, please feel free to open an issue or submit a pull request. 80 | 81 | ## License 82 | 83 | [MIT License](LICENSE) 84 | 85 | --- 86 | ## Tags 87 | 88 | Twitch, username, availability, checker, scanner, automation, Selenium, Python, web scraping, web automation, web browser, Twitch usernames, 4-letter usernames, Twitch account, Twitch botting, Twitch OG account, Twitch account creation, Twitch account registration, Twitch domain, domain availability, domain checker, domain scanner, Twitch domain scanner, Twitch username availability, Twitch username availability checker, Twitch username availability scanner, Twitch username bot, Twitch username tool, Twitch username availability tool, Twitch username automation, Twitch username finder, Twitch username search, Twitch username generator, Twitch username availability status, Twitch username validation, Twitch account management, Twitch account utilities, Twitch username list, Twitch username batch check, Twitch username bulk checker, Twitch username verification, Twitch username suggestions, Twitch account security, Twitch account setup, Twitch account management, Twitch account automation, Twitch username policy, Twitch username restrictions, Twitch username guidelines, Twitch username rules, Twitch username filtering, Twitch username format, Twitch username randomizer 89 | 90 | 91 | *Note: Please be mindful of Twitch's terms of service when using this application. Respect Twitch's policies and guidelines regarding username availability and usage.* 92 | --------------------------------------------------------------------------------