from Google import Create_Service import pandas as pd CLIENT_SECRET_FILE = '<Your client secret file (JSON)>' API_NAME = 'youtube' API_VERSION = 'v3' SCOPES = ['https://www.googleapis.com/auth/youtube'] service = Create_Service(CLIENT_SECRET_FILE, API_NAME, API_VERSION, SCOPES) playlistId_Source = '<Source YouTube Playlist>' playlistId_Target = '<Your YouTube Playlist>' response = service.playlistItems().list( part='contentDetails', playlistId=playlistId_Source, maxResults=50 ).execute() playlistItems = response['items'] nextPageToken = response.get('nextPageToken') while nextPageToken: response = service.playlistItems().list( part='contentDetails', playlistId=playlistId_Source, maxResults=50, pageToken=nextPageToken ).execute() playlistItems.extend(response['items']) nextPageToken = response.get('nextPageToken') for video in playlistItems: request_body = { 'snippet': { 'playlistId': playlistId_Target, 'resourceId': { 'kind': 'youtube#video', 'videoId': video['contentDetails']['videoId'] } } } service.playlistItems().insert( part='snippet', body=request_body ).execute()
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter