Fully automated Chegg Discord bot for "homework help"

Overview

cheggbog

Fully automated Chegg Discord bot for "homework help". Working Sept 15, 2021

Overview

Recently, Chegg has made it extremely difficult to automate retrieval of content from their website. They started using a service called PerimeterX that detects the usage of automation tools like Selenium when accessing the website.

I still wanted to automate the process, so I took it to the extreme with this project. It uses a virtual machine and fake keystrokes to simulate a real user on the website.

Requirements

  • Paid Chegg account (will need to sign in)
  • A decent computer to run the VM
  • Basic Python skills
  • A Discord bot

Step 0: Obtaining the bot and creating the VM

Look up how to create a Discord bot, then add it to any server. It needs the permissions to read messages and add reactions.

For the virtual machine, I am using VMware Workstation 16 Player. It's free and works well. Once it is installed, grab the Media Creation Tool from Microsoft's website, and use it to create a .iso of Windows. Create a new virtual machine using that .iso file, and go through the setup process.

For the VM, click on "I don't have a product key". When it asks you to sign in with a Microsoft account, you can disconnect from the internet, which allows for the creation of a local account and having an empty password. Then, you'll want to install VMware Tools, Chrome, and Python (tested on version 3.9.7). Make sure to check the box to add Python to PATH when installing.

Step 1: Setting up Chrome

The way the bot works is that it opens the URL in Chrome, takes a screenshot of it using the GoFullPage extension by pressing a shortcut for it, then sends that image in the channel where the Chegg link was sent. The tab is also closed and the image is deleted once it is done.

Go to the Chegg website and sign in. Make sure that the device is registered to your account by going to any homework-help link.

Install the GoFullPage extension from the Chrome web store. Right click the icon, go to settings:

  • Set Image format to jpg
  • Set directory to screenshots
  • Check Auto-download files
  • If it asks for permissions, make sure to allow it

Optional (but recommended) tools to improve image output

See below

Install uBlock Origin and add the following as a filter to trim useless page information

! 2021-09-10 https://www.chegg.com
www.chegg.com##.loggedIn.subtype-.type-study.kit-kat-search.force-desktop.chgg-hdr
www.chegg.com##.header-nav.no-subnav.no-nav.chg-body > div > oc-component
www.chegg.com##.sidebar-container
www.chegg.com##.right-sidebar
www.chegg.com##.csrec-cards.csrec-qna

! 2021-09-15 https://www.chegg.com
www.chegg.com###playerpages-right-content
www.chegg.com##.playerpages-right-content.col-3

! 2021-09-23 https://www.chegg.com
www.chegg.com###\35 451367596
www.chegg.com##.csp-content
www.chegg.com##.app-promotion.text-me-app-container

Install Tampermonkey and add the following as a script to improve formatting

// ==UserScript==
// @name         Clean Chegg Website
// @namespace    http://tampermonkey.net/
// @version      1.0
// @description  try to take over the world!
// @author       You
// @match        https://www.chegg.com/homework-help/questions-and-answers/*
// @icon         https://www.google.com/s2/favicons?domain=chegg.com
// @grant        none
// ==/UserScript==

(function() {
    'use strict';

    document.querySelector("div.chg-container.center-content").style.maxWidth = "calc(100% - 13px)";
    document.querySelector("div.chg-container.center-content").style.padding = "0";
    document.querySelector("div.chg-container.center-content").style.margin = "0";
    document.querySelector("div.main-content.question-page").style.width = "calc(100% - 13px)";
    document.getElementById("popup-4").style.paddingBottom = "0";
    document.querySelector("div.chg-footer").style.display = "none";
    document.querySelector('div.txt-2-small.global-breadcrumb').style.display = "none";
    document.querySelector('div.parent-container.question-headline').style.paddingTop = "0";
    document.querySelector('div.parent-container.question-headline').style.paddingBottom = "0";
    document.querySelector('div.main-content.question-page').style.width = "100%";
    document.querySelector('div.chg-content.HomeworkhelpQuestion').style.padding = "0";
    document.querySelector('div.chg-content.HomeworkhelpQuestion').style.minWidth = "unset";
})();

Change the VM resolution to something like 1600x1200 in Display Settings in Windows

In Chrome, set a default resolution by right clicking on the empty space next to the tabs and clicking Size (unsure if this works).

Step 2: Setting up the Discord bot

Download this repository as a zip and extract it to anywhere. Add your bot's private key to key.txt. Open cheggbog.py and edit the variable called "path" with your username.

Open a command prompt in the folder and install the required libraries using the following

python -m pip install -r requirements.txt

Then you can run the bot by typing the following command

python cheggbog.py

Make sure to have at least 1 tab open while the bot is running to improve loading times

Step 3: Testing and final parts

When the bot is running, it is looking for both DMs and messages sent in any channel it can see. Send any Chegg homework help link and make sure not to touch the virtual machine. The intended behavior is the following:

  • Link sent, bot reacts with an emoji to show processing
  • Bot opens link in Chrome, waits for a bit, then triggers the full page screenshot tool
  • After a set amount of time, the bot sends the image in the same channel as the link, closes the Chegg window, and deletes the image file
  • Finally, reacts to the original message to show that it is complete

(Optional) Adding the bot to startup

In the cheggbog folder, create a new file called run.bat with the following contents

python cheggbog.py

Press Win+R and type shell:startup to access the startup programs folder. Create a shortcut to the run.bat file and drop it in this folder, along with a shortcut to Chrome.

(Optional) Adding the VM to startup

On the host computer, go to the location of the VM (default C:\Users[User]\Documents\Virtual Machines[Your VM]). Create a .bat file with the following contents (substitute things in brackets)

"C:\Program Files (x86)\VMware\VMware Player\vmrun" -T player start "C:\Users\[User]\Documents\Virtual Machines\[Your VM]\[Your VM].vmx"

Create a shortcut to this file and place it in the shell:startup folder of the host

Thanks for reading, please leave a star if you found this tool useful, or send me a message if it was useless.

Owner
Bryce Hackel
work
Bryce Hackel
DonLee Robot

๐Ÿค– ๐ƒ๐Ž๐ ๐‹๐„๐„ ๐‘๐Ž๐๐Ž๐“ ๐•๐Ÿ ๐Ÿค– ๐Ÿ‘‹ Hey Muhammed, Iam DonLee RoBoT Make me an admin for your group and channel then connect me.... ๐ŸŽ‰ ๐Ÿ™‚ To build a

Muhammed 27 Dec 01, 2022
Sielzz Music adalah proyek bot musik telegram, memungkinkan Anda memutar musik di telegram grup obrolan suara.

Hi, I am: Requirements ๐Ÿ“ FFmpeg NodeJS nodesource.com Python 3.8 or higher PyTgCalls MongoDB Get STRING_SESSION from below: ๐ŸŽ– History Features ๐Ÿ”ฎ Th

1 Nov 04, 2021
The bot I used to win a 3d printing filament giveaway.

Instagram-CommentBot-For-Giveaways This is the bot I used to win a 3d printer filament giveaway on Instagram. Usually giveaways require you to tag oth

Esad Yusuf Atik 1 Aug 01, 2022
BiliBili-live-barrage-transceiver - A simple python program for sending and receiving barrage in bilibili live room

BiliBili-live-barrage-transceiver - A simple python program for sending and receiving barrage in bilibili live room

zeroy 2 Jan 18, 2022
โ€œ Hey there ๐Ÿ‘‹ I'm Sophia โ€ž TG Group management bot with Some Extra features..

โค๏ธ Sophia โค๏ธ Avaiilable on Telegram as SophiaBot ๐Ÿƒโ€โ™‚๏ธ Easy Deploy Mandatory Vars [+] Make Sure You Add All These Mandatory Vars. [-] APP_ID: You ca

THEEKSHANA 5 Dec 09, 2021
Shuffle and add items from jellyfin to mpd (use in tandem with jellyfin-mopidy and mpd-mopidy). Similar to ncmpcpp's "Add random" feature..

jellyshuf Essentially implements ncmpcpp's add random feature (default hotkey: `) through a script which grabs info from jellyfin api itself. jellyfin

Ethan Djeric 2 Dec 14, 2021
Tools for use in DeFi. Impermanent Loss calculations, staking and farming strategies, coingecko and pancakeswap API queries, liquidity pools and more

DeFi open source tools Get Started Instalation General Tools Impermanent Loss, simple calculation Compare Buy & Hold with Staking and Farming Complete

Juan Pablo Pisano 467 Jan 08, 2023
checks anilist for available usernames (200rq/s)

Anilist checker Running the program Set a path to the extracted files Install the packages with pip install -r req.txt Run the script by typing python

gxzs 1 Oct 13, 2021
An example of a chatbot with a number-based menu that can be used as a starting point for a project.

NumMenu Bot NumMenu Bot is an example chatbot showing a way to design a number-based menu assistant with Rasa. This type of bot is very useful on plat

Derguene 19 Nov 14, 2022
A Superfast SMS & Call bomber for Linux And Termux

PSKR_BOMBER ๐Ÿ’ฃ ๐Ÿ“ฑ ๐Ÿ’€ A Superfast SMS & Call bomber for Linux And Termux ! Disclaimer This tool is for educational purposes only ! Don't use this to ta

1 Dec 20, 2021
A Tool to scrape URLs for a given domain from wayback machine, Commoncrawl and OTX Alienvault

Mr_URL Mr.URL fetches known URLs for a given domain from Wayback Machine, Commoncrawl and OTX Alienvault. It also finds old versions of any given URL

Stinger 9 Sep 05, 2022
Project developed as part of a selection process for the company Denox

๐Ÿ“ Tabela de conteรบdos Sobre Requisitos para rodar o projeto Instalaรงรฃo Rotas da API Observaรงรตes ๐Ÿง Sobre Projeto desenvolvido como parte de um proces

รcaro Sant'Ana 1 Mar 01, 2022
Install and manage Proton-GE and Luxtorpeda for Steam and Wine-GE for Lutris with this graphical user interface. Based on AUNaseef's ProtonUp, made with Python 3 and Qt 6.

ProtonUp-Qt Qt-based graphical user interface to install and manage Proton-GE installations for Steam and Wine-GE installations for Lutris. Based on A

638 Jan 02, 2023
A Python 2.7/3.x module for Amcrest Cameras using the SDK HTTP API.

A Python 2.7/3.x module for Amcrest Cameras using the SDK HTTP API. Amcrest and Dahua devices share similar firmwares. Dahua Cameras and NVRs also work with this module.

Marcelo Moreira de Mello 176 Dec 21, 2022
Facebook open graph api implementation using the Django web framework in python

Django Facebook by Thierry Schellenbach (mellowmorning.com) Status Django and Facebook are both rapidly changing at the moment. Meanwhile, I'm caught

Thierry Schellenbach 1.4k Dec 29, 2022
One of Best renamer bot with python

๐ŸŒ€ One of Best renamer bot repo Please Give a โ˜† if You like This Open Source and Don't Forget to Follow Me On Github For More Repos And Codes. Scrappe

1 Dec 14, 2021
A simple discord tool that translates english to either spanish, german or french and sends it. Free to rework but please give me credit.

discord-translator A simple discord tool that translates english to either spanish, german or french and sends it. Free to rework but please give me c

TrolledTooHard 2 Oct 04, 2021
A secure and customizable bot for controlling cross-server announcements and interactions within Discord

DiscordBot A secure and customizable bot for controlling cross-server announcements and interactions within Discord. Within the code of the bot, you c

Jacob Dorfmeister 1 Jan 22, 2022
A Dm Bot, also knows as Mass DM bot which can send one message to All of the Users in a Specific Server!

Discord DM Bot discord.py 1.7.2 python 3.9.5 asyncio 3.4.3 Installation Cloud Host Tutorial uploaded in YouTube, watch it by clicking here. Local Host

hpriyam8 7 Mar 24, 2022
Python script to backup/convert your Spotify playlists into the XSPF format.

Python script to backup/convert your Spotify playlists into the XSPF format.

Chris Ovenden 4 Jun 09, 2022