A feature-rich command-line audio/video downloader
[utils] Add `__getitem__` for `PagedList`
pukkandan55575225b485
diff --git a/yt_dlp/utils.py b/yt_dlp/utils.pyindex 02a12307a7..40b9c4cf38 100644--- a/yt_dlp/utils.py+++ b/yt_dlp/utils.py@@ -4000,6 +4000,15 @@ class PagedList(object):# This is only useful for testsreturn len(self.getslice())+ def getslice(self, start, end):+ raise NotImplementedError('This method must be implemented by subclasses')++ def __getitem__(self, idx):+ if not isinstance(idx, int) or idx < 0:+ raise TypeError('indices must be non-negative integers')+ entries = self.getslice(idx, idx + 1)+ return entries[0] if entries else None+class OnDemandPagedList(PagedList):def __init__(self, pagefunc, pagesize, use_cache=True):