Git Product home page Git Product logo

youtubechatbot's Introduction

Sample chat bot on App Engine

This is a sample YouTube chat bot that's designed to run on Google App Engine. It leverages Task Queues to simulate a long-running background process which polls the YouTube LiveChatMessages API for the specified video.

It'll respond in a personalized way to specific commands and depart the channel if asked to do so by a mod or the channel owner.

Deploying the sample code

These instructions are a quick overview of cloning this project to your local development environment and deploying to a new App Engine instance.

Ensure you have the following set up in your environment before you begin:

  • Python 2.7
  • Google Cloud SDK

To try the bot, you'll need to clone the repository to your local machine:

git clone https://github.com/youtube/youtubechatbot

Create a new project in the Google Cloud Console. Note your project ID, as we'll need it soon.

Create a set of OAuth credentials for your application, and set up your client_secrets.json.

  • In the Cloud Console, click the menu in the top left and switch to API Manager.
  • Click Credentials.
  • Click Create Credentials, then choose OAuth client ID.
  • Choose "Web application", then fill out the flow.
  • For "Authorized redirect URLs," add the following:
    • https://[your project id].appspot.com/oauth2callback
    • Note the use of your project ID -- replace this with the project ID you chose when setting up your Cloud project.
  • Save your credential.
  • From the list of OAuth 2.0 client IDs, choose the option to download your credentials.
  • Move the downloaded file into the root directory of the cloned repository (the directory that contains app.yaml) and rename it to client_secrets.json

Install the required vendor libraries.

  • In a Terminal or Command Prompt, switch to the directory that you cloned the repository into.

  • Use pip to install the required libraries. This is required for deployment to App Engine.

    pip install -t lib -r requirements.txt

Deploy the sample project to App Engine.

gcloud app deploy app.yaml worker.yaml

Trying the bot

Once deployment is finished, visit the App Engine URL to ensure the app is running.

Usage:

http://yourprojectid.appspot.com/?videoId=xxxxx

Set videoId to the ID of an upcoming or active live event on YouTube. If the bot joins successfully, you should see a success message in the browser and the bot should say hello in chat.

The first time you visit the URL, you'll be asked to authenticate. You should use the YouTube channel you want the bot to use when chatting.

Coming soon

A code lab that walks you through the details of how this bot is built.

Author information

Marc Chambers

Special thanks to Christopher Schmidt for review & testing support

Copyright 2017 Google, Inc.

youtubechatbot's People

Contributors

mchambers avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.