Search code examples
pythonweb-scrapingyoutube

Can I access my personal Youtube playlists with an API or do I need a WebDriver?


I want to get video information (ex: titles) from my YouTube account's playlists (ex: Liked Videos).

Is there some official YouTube/Google API I can use to access my YouTube account and directly get the information, or do I need to use a WebDriver like Selenium to login and then scrape?


Solution

  • You can access your own, private playlists over YouTube Data API v3:

    https://developers.google.com/youtube/v3/docs/playlists/list

    Playlists: list
    Returns a collection of playlists that match the API request parameters. For example, you can retrieve all playlists that the authenticated user owns, or you can retrieve one or more playlists by their unique IDs.
    (...)
    This example retrieves playlists created in the authorized user's YouTube channel. It uses the mine request parameter to indicate that the API should only return playlists owned by the user authorizing the request.

    According to this post on StackOverflow the API also returns your private playlists.

    For information on how to use YouTube's API system, visit the introduction page as well as the Python Quickstart.