A WhatsApp Bot that scrapes the YouTube links sent by a contact and adds them to your watch later playlist.
🌠 Developed Using Puppeteer
Checkout the legailty of web scraping here before diving into the code
- Clone this repo,
cd watch-later
- Go to Google Developers Console
- Create a new project, enable the YouTube API and create an OAuth 2.0 Client ID
- Download the client_secret.json file and add it to your current directory
- Login to WhatsApp web on chrome or chromium browser
- Make a copy of the User Data Directory of the browser on your current directory or provide a relative path at L116
- Install all the required dependencies by running
npm install
- Serve the bot and authorize the app
npm start
🚀 And there you have it.. The bot is up and scraping
- You're too lazy to do a task that takes less than a second to do
- If you're friends with someone like @fillerInk who likes to spam the chat with YouTube videos
- Because WhatsApp sucks 🦎
- Remember when YouTube chat existed.. yes i miss it too ⚰️
- The browser is launched headless by default. See the browser in action by changing
headless: false
at L115 - Puppeteer downloads chromium by default. Using puppeteer-core you can connect to an existing browser installation
Does WhatsApp allow bots? Nope. Use their official API instead for long-term use cases!