Giter Club home page Giter Club logo

gbti-labs / py-youtube-to-subreddit Goto Github PK

View Code? Open in Web Editor NEW
4.0 2.0 0.0 18 KB

Py YouTube to Reddit is a command line driven experience that will walk through the publishing of YouTube videos directly to a sub-reddit from a YouTube channel or a YouTube playlist. We developed this asset to import a channel's video's into a subreddit.

Python 100.00%
data migration migration-tool python python-script reddit youtube-api youtube-data-api-v3 redit-api

py-youtube-to-subreddit's Introduction

Py YouTube to (sub)Reddit

We developed this python script to accept either a Youtube channel or a YouTube playlist to import their videos into a subreddit.

Setup

YouTube API Key

  1. Visit the Google Developers Console.
  2. Create a project and enable the YouTube Data API v3 for it.
  3. In the "Credentials" section, create an API key.

Reddit Script Credentials

  1. Log in to Reddit.
  2. Go to the Reddit Apps page (found under "User Settings" -> "Safety & Privacy" -> "Developer").
  3. Click "Create App" or "Create Another App".
  4. Fill out the form:
    • Name: Give your app a name.
    • App type: Choose "script".
    • Description: (Optional) Describe your app.
    • About URL: (Optional)
    • Permissions: (Optional)
    • Redirect URI: Use http://localhost:8080.
  5. Click "Create app".
  6. Note your client_id (listed just under the app name) and client_secret (labeled as "secret").

Configuration File

Create a config.json file with the following content:

{
   "youtube_api_key": "YOUR_YOUTUBE_API_KEY",
   "reddit": {
      "client_id": "YOUR_REDDIT_CLIENT_ID",
      "client_secret": "YOUR_REDDIT_CLIENT_SECRET",
      "username": "YOUR_REDDIT_USERNAME",
      "password": "YOUR_REDDIT_PASSWORD"
   },
   "debug_mode": true,
   "comment_template" : "This comment is is sourced from the video description:\r\n\r\n\"{youtube.description}\"",
   "comment_removal" : [
      "Remove some string A",
      "Remove some string B"
   ]
}

Replace placeholders with your actual credentials.

Installation

Dependencies

The script requires certain Python packages. Install them using the following steps:

  1. Run the command pip install -r requirements.txt to install the dependencies.

This may require you to run as administrator.

Usage

In a terminal inside the application directory run:

py run.py

And follow the prompts as they will ask which subreddit to publish to, which channel or playlist should be sourced from.

Once you've setup your import condition the script will itterate through each video and confirm that you would like to publish the video or skip it.

The script will also ask you if you would like to post the video description as the first comment.

Youtube-to-subreddit

Features

  • Process videos one at a time
  • Can skip videos
  • Can sort by date asc, date desc, view count, and likes
  • Comments are optional
  • Comment is powered by template in config.json
  • Checks the subreddit to make sure that the post does not already exist

Follow GBTI for more

Thanks for reading! If you like our content, please consider following us!

Twitter/X | GitHub | YouTube | Dev.to | Daily.dev | Hashnode | Blog / Discord

py-youtube-to-subreddit's People

Contributors

atwellpub avatar gbtilabs avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  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.