Skip to content
Snippets Groups Projects
Commit 4fb28395 authored by Robert Goldmann's avatar Robert Goldmann
Browse files

members should be accessible by debugger

parent 8c669ece
No related branches found
No related tags found
No related merge requests found
......@@ -42,10 +42,10 @@ class SaveMyPlaylist:
def __init__(self, apiKey, playlistId):
print('### SaveMyPlaylist v{} ###'.format('.'.join(str(i) for i in VERSION)))
print('=============================\n')
self.__apiKey = apiKey
self.__playlistId = playlistId
self.__youtubeApi = googleapiclient.discovery.build(self.API_NAME, self.API_VERSION, developerKey=self.__apiKey)
self.__items = self.__fetch_all_playlist_items()
self._apiKey = apiKey
self._playlistId = playlistId
self._youtubeApi = googleapiclient.discovery.build(self.API_NAME, self.API_VERSION, developerKey=self._apiKey)
self._items = self.__fetch_all_playlist_items()
def __fetch_all_playlist_items(self):
items = []
......@@ -60,15 +60,15 @@ class SaveMyPlaylist:
def __fetch_playlist_items(self, nextPageToken=None):
if nextPageToken is None or nextPageToken == 0:
request = self.__youtubeApi.playlistItems().list(
request = self._youtubeApi.playlistItems().list(
part='snippet',
playlistId=self.__playlistId,
playlistId=self._playlistId,
maxResults=50,
)
else:
request = self.__youtubeApi.playlistItems().list(
request = self._youtubeApi.playlistItems().list(
part='snippet',
playlistId=self.__playlistId,
playlistId=self._playlistId,
maxResults=50,
pageToken=nextPageToken
)
......@@ -100,14 +100,14 @@ class SaveMyPlaylist:
print('\n>>> Started Downloading...')
newVideos = []
for idx, item in enumerate(self.__items):
for idx, item in enumerate(self._items):
fileName = '{} - {}.mp4'.format(item[self.TITLE], item[self.CHANNEL])
fileName = self.__escape_file_name(fileName)
if fileName in downloadedVideos:
print('Skipping {}/{}: "{}" as it already exists'.format(idx + 1, len(self.__items), fileName))
print('Skipping {}/{}: "{}" as it already exists'.format(idx + 1, len(self._items), fileName))
continue
print('Downloading {}/{}: "{}"'.format(idx + 1, len(self.__items), fileName))
print('Downloading {}/{}: "{}"'.format(idx + 1, len(self._items), fileName))
newVideos.append(item)
ydl_opts = {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment