Skip to content

Blocks YouTube comments that contains special character that are likely to be spam using Google Apps Script

License

Notifications You must be signed in to change notification settings

explor4268/yt-spam-comment-buster

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

YouTube Spam Comment Buster

Language

English Indonesian

Blocks YouTube comments that contains special character that are likely to be spam using Google Apps Script.

Note

This guide is for content creators, and also moderators. You can refer to this guide if you want to stop spam comments from appearing in YouTube comments section.

TODO:

  • Scan for replies (more API quota usage)
  • Save deleted comments to a spreadsheet
  • User-friendly way to restore deleted comments
  • Maybe make a friendly user-interface for this

Setup

  1. Open Google Apps Script.

  2. Create a new project.

New project

  1. Rename it into whatever your like.

Rename

Choosing a name

  1. On the services section, click "Add" (+), scroll down and choose YouTube Data API v3.

Adding Services

  1. Name the Identifier YouTube and press "Add"

Adding Services

  1. Delete every line of predefined code in the code editor. Then, copy the code from this file and paste that into the code editor. You could take a look at the source code to make sure it is not doing anything bad.

Clearing the text box

Pasting the code

  1. Press "Save" to save the code.

Saving the project

Tip

Be sure to check for code updates for spam detection improvements and new features.

Usage

  1. Open Google Apps Script and click the relevant project that you created previously.

  2. Press "Run". You might get a prompt to authorize this script. Click on "Review permissions". Select your Google Account that corresponds to your channel. If it shows the "Google hasn't verified this app" warning, just click on "Advanced" on the bottom-left corner, and click "Go to [your project name] (unsafe)". It will asks you to manage your YouTube account. Click "Allow". This is only required once after setting it up.

Running

Note

If you cannot authorize the app, make sure to allow third-party cookies, or use a different browser or browser profile.

  1. Check on your channel's videos comment section if the spam comments are successfully deleted.

  2. To rerun the scan, repeat step 1 and 2 again (but this time you don't have to authorize the script again)

Tip

You can always take a look of the history of what this script is deleting in the last 7 days by opening the "Executions" tab just below the alarm icon on the left side, then lookup the date of the execution and expand the logs by pressing the down arrow on the right side of the highlighted run.

Pressing the executions tab

Expand logs

Viewing logs

Also, you can set this script to only scan comments without taking any actions by setting the ENABLE_TAKING_ACTIONS variable to false

Enable taking actions variable

Automation

You can run this script automatically to scan and take action of comments periodically.

  1. Click the Timer icon on the left side.

Clicking Triggers

  1. Press "Add Trigger" button at the bottom-right side of your browser window.

Adding Triggers

  1. Change which function to run to main.

Change to main

  1. Change the hour interval into Every 12 hours (recommended).

Change interval to 12 hours

  1. Press "Save"

Saving

To stop this script from automatically running, delete the trigger that you created by highlighting the trigger that you previously created, then click on "More" (with vertical three dots icon), and click "Delete trigger"

Customization

You can customize the behavior of the script by changing variables that are in all uppercase. Beware that changing the maximum amount of comments to be scanned may exceed your daily quota limit, which is 10,000. Currently, you can read additional documentation inside the script file itself.

See also

About

Blocks YouTube comments that contains special character that are likely to be spam using Google Apps Script

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published