How to Retrieve Names of Liked Videos from YouTube Account

youtubeyoutube-playlist

I would like to have a list of the names of all the videos I "liked" on YouTube.

So far, I opened in my web browser the page with all my "liked" videos in the playlist section. I loaded all the page and then went to get the source code. With a Python script I retrieve the names from the JSON file I extracted from the source code but I only got the 100 first videos.

Python script :

#!/usr/bin/python
# -*- coding: utf-8 -*-

import json

# Reading data back
with open('./utubelikes.json', 'r') as f:
    data = json.load(f)


videos = data["contents"]["twoColumnBrowseResultsRenderer"]["tabs"][0]["tabRenderer"]["content"]["sectionListRenderer"]["contents"][0]["itemSectionRenderer"]["contents"][0]["playlistVideoListRenderer"]["contents"]

for i in videos:
    if (i["playlistVideoRenderer"]["title"].get("simpleText")):
        print i["playlistVideoRenderer"]["title"]["simpleText"]

print len(videos)

Any idea on how to get the whole list of names?

I could go copy the content of the page and edit by hand but it would take too much time (1000+ videos).

Best Answer

Takeout allows to download an archive of your Google's data.

  • Select YouTube
  • Precise playlists
  • Choose the JSON format
  • Click 'Next'

Once your archive created, download and extract it. You can find a JSON file Takeout/YouTube/playlists/_J_aime_.json that lists all the names of the videos 'liked'.

With a simple Python script :

#!/usr/bin/python
# -*- coding: utf-8 -*-

import json

# Reading data back
with open('Takeout/YouTube/playlists/_J_aime_.json', 'r') as f:
    data = json.load(f)


for video in data:
        print video["snippet"]["title"]