|
|
|
@ -298,13 +298,13 @@ class GoogleDriveFolderIE(InfoExtractor):
|
|
|
|
|
},
|
|
|
|
|
'playlist_count': 3,
|
|
|
|
|
}, {
|
|
|
|
|
# Contains various formats
|
|
|
|
|
# Contains various formats and a subfolder
|
|
|
|
|
'url': 'https://drive.google.com/drive/folders/1CkqRsNlzZ0o3IL083j17s6sH5Q83DcGo',
|
|
|
|
|
'info_dict': {
|
|
|
|
|
'id': '1CkqRsNlzZ0o3IL083j17s6sH5Q83DcGo',
|
|
|
|
|
'title': r'], sideChannel: {}});',
|
|
|
|
|
},
|
|
|
|
|
'playlist_count': 4,
|
|
|
|
|
'playlist_count': 5,
|
|
|
|
|
}]
|
|
|
|
|
_JSON_DS_RE = r'key\s*?:\s*?([\'"])ds:\s*?%d\1,[^}]*data:'
|
|
|
|
|
_JSON_HASH_RE = r'hash\s*?:\s*?([\'"])%d\1,[^}]*data:'
|
|
|
|
@ -335,17 +335,24 @@ class GoogleDriveFolderIE(InfoExtractor):
|
|
|
|
|
contains_pattern=self._ARRAY_RE, **kwargs)
|
|
|
|
|
|
|
|
|
|
def _real_extract(self, url):
|
|
|
|
|
def item_url_getter(item):
|
|
|
|
|
url_from_0 = f'https://drive.google.com/file/d/{item[0]}'
|
|
|
|
|
if GoogleDriveIE.suitable(url_from_0):
|
|
|
|
|
return url_from_0
|
|
|
|
|
else:
|
|
|
|
|
for attr in item:
|
|
|
|
|
if isinstance(attr, str) and GoogleDriveIE.suitable(attr):
|
|
|
|
|
return attr
|
|
|
|
|
self.write_debug('Failed to extract url!')
|
|
|
|
|
def item_url_getter(item, video_id):
|
|
|
|
|
available_IEs = [GoogleDriveFolderIE, GoogleDriveIE]
|
|
|
|
|
for attr in item:
|
|
|
|
|
if isinstance(attr, str):
|
|
|
|
|
for available_IE in available_IEs:
|
|
|
|
|
if available_IE.suitable(attr):
|
|
|
|
|
return self.url_result(attr, available_IE, video_id, item[2])
|
|
|
|
|
self.to_screen(f'Failed to find a suitable extractor for {item[2]}.')
|
|
|
|
|
return None
|
|
|
|
|
|
|
|
|
|
def make_playlist(items, playlist_id):
|
|
|
|
|
entries = []
|
|
|
|
|
for item in items:
|
|
|
|
|
entry = item_url_getter(item, playlist_id)
|
|
|
|
|
if entry:
|
|
|
|
|
entries.append(entry)
|
|
|
|
|
return self.playlist_result(entries, playlist_id, title)
|
|
|
|
|
|
|
|
|
|
folder_id = self._match_id(url)
|
|
|
|
|
headers = self.geo_verification_headers()
|
|
|
|
|
|
|
|
|
@ -361,5 +368,4 @@ class GoogleDriveFolderIE(InfoExtractor):
|
|
|
|
|
title = json_folder_info[1][2]
|
|
|
|
|
items = json_items[-1]
|
|
|
|
|
|
|
|
|
|
return self.playlist_from_matches((item for item in items), folder_id, title,
|
|
|
|
|
ie=GoogleDriveIE, getter=item_url_getter)
|
|
|
|
|
return make_playlist(items, folder_id)
|
|
|
|
|