YoutubeArchiver is a Ruby gem that downloads YouTube Video metadata and media. It works in conjunction with Zenodotus and Hypatia to archive fact-checked image/video posts. YoutubeArchiver exists alongside a collection of other media scrapers created by the Duke Reporters' Lab, including Birdsong (a Twitter scraper), Zorki (an Instagram scraper), and Forki (a Facebook scraper).
Like the other scrapers, YoutubeArchiver follows a standard architecture created by @cguess. The scraper is engaged by one of two methods: Video.lookup
or Channel.lookup
, which respectively return YoutubeArchiver::Video
and YoutubeArchiver::Channel
objects. These psuedo JSON object store video/channel metadata and media.
YoutubeArchiver
differs from the other scrapers in how it acquires media and metadata for a video or channel lookup. YoutubeArchiver
uses yt-dlp to download video media files and the YouTube Data API V3 to download channel and video metadata. For now, the project pecifically uses the Youtube API's Videos: list and Channels: list endpoints.
Add this line to your application's Gemfile:
gem 'youtubearchiver'
And then execute:
$ bundle install
YoutubeArchiver
uses yt-dlp to download Youtube Videos. Installation instructions for the project can be found here.
- Create or select a Google Cloud Project
- Find the Youtube Data API v3 in the Google API marketplace. Enable the API for the selected project.
- After enabling the API, click on the credentials tab link in the API page sidebar.
- Create an "API Key" credential.
Set the YOUTUBE_API_KEY
environment variable equal to the API key generated above. Make sure not to commit the API key to git!