read shortcuts url

This commit is contained in:
grqx_wsl 2024-07-28 03:18:17 +12:00
parent 9962859595
commit 017997068b

View file

@ -12,6 +12,7 @@
get_element_html_by_id, get_element_html_by_id,
int_or_none, int_or_none,
lowercase_escape, lowercase_escape,
traverse_obj,
try_get, try_get,
update_url_query, update_url_query,
) )
@ -304,7 +305,7 @@ class GoogleDriveFolderIE(InfoExtractor):
'id': '1CkqRsNlzZ0o3IL083j17s6sH5Q83DcGo', 'id': '1CkqRsNlzZ0o3IL083j17s6sH5Q83DcGo',
'title': r'], sideChannel: {}});', 'title': r'], sideChannel: {}});',
}, },
'playlist_count': 5, 'playlist_count': 6,
}] }]
_JSON_DS_RE = r'key\s*?:\s*?([\'"])ds:\s*?%d\1,[^}]*data:' _JSON_DS_RE = r'key\s*?:\s*?([\'"])ds:\s*?%d\1,[^}]*data:'
_JSON_HASH_RE = r'hash\s*?:\s*?([\'"])%d\1,[^}]*data:' _JSON_HASH_RE = r'hash\s*?:\s*?([\'"])%d\1,[^}]*data:'
@ -337,13 +338,17 @@ def _extract_json_hash(self, hashval, webpage, video_id, **kwargs):
def _real_extract(self, url): def _real_extract(self, url):
def item_url_getter(item, video_id): def item_url_getter(item, video_id):
available_IEs = [GoogleDriveFolderIE, GoogleDriveIE] available_IEs = [GoogleDriveFolderIE, GoogleDriveIE]
for attr in item: if 'application/vnd.google-apps.shortcut' in item:
if isinstance(attr, str): entry_url = traverse_obj(
for available_IE in available_IEs: item, (..., ..., lambda _, v: any(ie.suitable(v) for ie in available_IEs),
if available_IE.suitable(attr): {str}, any))
return self.url_result(attr, available_IE, video_id, item[2]) else:
self.to_screen(f'Failed to find a suitable extractor for {item[2]}.') entry_url = traverse_obj(
return None item, (lambda _, v: any(ie.suitable(v) for ie in available_IEs),
{str}, any))
if not entry_url:
return None
return self.url_result(entry_url, video_id=video_id, video_title=item[2])
folder_id = self._match_id(url) folder_id = self._match_id(url)
headers = self.geo_verification_headers() headers = self.geo_verification_headers()