Skip to content

ucdavis-noyce/YouTube-Slant-Estimation

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

YouTube-Slant-Estimation

Simple web-server for collecting tweets, metadata, and comments for YouTube videos and estimating their slant based on the approach used in our audit of YouTube's recommendations. Read more about it here. The server caches responses inside data/database.db so as to avoid rate limits on the used APIs.

Getting Started

  1. Clone the repository.
  2. Generate your Twitter v2 and YouTube API tokens.
  3. Copy the Twitter tokens to data/twitter-tokens.txt and the YouTube tokens to data/youtube-tokens.txt respectively, one per line.
  4. Download youtube-dl to a location in your PATH.
  5. For slant estimation, download the landmark-counts.tar.xz by filling out this form and extracting its contents to the data directory.
  6. Install the requirements using pip install -r requirements.txt inside the repository.
  7. Start the server using flask run --port 5000.

Usage

Consider the following URL: https://www.youtube.com/watch?v=XpeOIww_l4A. The part of the URL after the watch?v= is the video ID. The various endpoints of the server take this video ID and return the corresponding data. For example, to get the metadata for this video, you can use cURL as follows: curl http://localhost:5000/getMetadata/XpeOIww_l4A

API Endpoints

In all these endpoints, replace <video-id> with the ID of the video, which can be extracted from the URL as in the example above.

  • /getMetadata/<video-id>: Get video metadata using youtube-dl.
  • /getTweets/<video-id>: Get tweets mentioning the video using the Twitter API.
  • /getComments/<video-id>: Get comments on the video using the YouTube API.
  • /getSlant/<video-id>: Get the estimated slant for the video using our approach.

Acknowledgements

This tool was developed as part of an effort by researchers at UC Davis to audit the recommendations on YouTube. Read more about it here.

The primary maintainer is Muhammad Haroon.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages