4

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

  • 1
    Yes, thank you! It is exactly what I am looking for! – tepn Dec 22 '17 at 21:05
  • @pnuts : add this as an answer. – serenesat Dec 22 '17 at 21:13
  • 1
    Ok I will start writing the answer... While I'm at it, how should I give you the credit of the answer? Tag you with @pnuts or something? – tepn Dec 22 '17 at 21:23
4

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"]

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.