Getting the Configuration Files - hsj51/SearchX GitHub Wiki

Getting the credentials.json file

  • Visit the Google Cloud Platform
  • Go to the OAuth consent screen tab, fill the form and save it
  • Then go to the Credentials tab and click on Create Credentials -> OAuth client ID
  • Choose Desktop from the list and click on the Create button
  • Now click on the Download JSON button to download the credential file
  • Move that file to the root of the repo and rename it to credentials.json
  • Then run the below script
pip3 install google-api-python-client google-auth-httplib2 google-auth-oauthlib

Getting the drive_list file

  • Run the below script and follow the screen to get the drive_list file
python3 dlist.py

Getting the Service Account files

Warning: Abuse of this feature is not the aim and not recommended to make a lot of projects, just one project and 100 SAs will allow a plenty of use. It's also possible that over abuse might get the projects banned by Google.

NOTE: If you have created SAs in the past from this script, you can also just re-download the keys by running the below script

python3 gen_sa.py --download-keys PROJECTID

There are two methods available for creating Service Accounts

Creating SAs in existing project (Recommended)
  • List projects ids
python3 gen_sa.py --list-projects
  • Enable services
python3 gen_sa.py --enable-services PROJECTID
  • Create Sevice Accounts
python3 gen_sa.py --create-sas PROJECTID
  • Download Sevice Accounts
python3 gen_sa.py --download-keys PROJECTID

Note: Remember to replace PROJECTID with your project id.

Creating SAs in new project
  • Run the below script to generate Service Accounts and download automatically
python3 gen_sa_accounts.py --quick-setup 1 --new-only

Getting the GDToT cookies

  • Login / Register to GDToT
  • Copy the below script and paste it on the address bar
javascript:(function () {
  const input = document.createElement('input');
  input.value = JSON.stringify({url : window.location.href, cookie : document.cookie});
  document.body.appendChild(input);
  input.focus();
  input.select();
  var result = document.execCommand('copy');
  document.body.removeChild(input);
  if(result)
    alert('Copied cookies to clipboard');
  else
    prompt('Copy the below cookies\n', input.value);
})();
  • Hit enter and the browser will prompt an alert
  • Now check the clipboard, there will be a data like this, that's the GDToT cookies
{"url":"https://new.gdtot.eu/","cookie":"crypt=NGxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxWdSVT0%3D; PHPSESSID=k2xxxxxxxxxxxxxxxxxxxxj63o"}
  • Then focus on the cookies, there will be the value of PHPSESSID and CRYPT

Setting up the config.env file

Rename config_sample.env to config.env

Required config

  • BOT_TOKEN: Get this token by creating a bot in @BotFather
  • OWNER_ID: Fill the user ID of bot owner
  • DRIVE_TOKEN: Run the below script to generate this token
python3 dtoken.py
  • DRIVE_FOLDER_ID: Fill the folder ID of drive where the data will be cloned to

Optional config

  • AUTHORIZED_CHATS: Fill the user_id and/or chat_id you want to authorize, separate them with space.
    Example: 1234567890 -1122334455 921229569
  • DATABASE_URL: Create a cluster on MongoDB to get this value
  • IS_TEAM_DRIVE: Set to True if the DRIVE_FOLDER_ID is from a Shared Drive
  • USE_SERVICE_ACCOUNTS: Set to True if the data will be cloned using Service Accounts. Refer to Getting the Service Account files for this to work.
  • PHPSESSID: Refer to Getting the GDToT cookies to get this value
  • CRYPT: Refer to Getting the GDToT cookies to get this value
  • DRIVE_INDEX_URL: Refer to maple's GDIndex or Bhadoo's Google Drive Index
    Note: The Index URL should not have any trailing '/'
  • ACCOUNTS_ZIP_URL: Archive the accounts folder to a zip file. Then fill the direct download link of that file.
  • DRIVE_LIST_URL: Upload the drive_list file on GitHub Gist. Now open the raw link of that gist and remove commit id from the link. Then fill the var with that link.
    Note: This var is required for Deploying with Workflow to Heroku.
  • MAX_THREADS: Number to threads to use while searching gdrive. Recomended value is 4*core count (4 for heroku). But result time may vary dependending upon machine, so test with different values and see which gives results in least time.
    Note: Setting it too high or too low may take more time to display results than expected.
⚠️ **GitHub.com Fallback** ⚠️