mirror of
https://github.com/yt-dlp/yt-dlp
synced 2025-12-17 14:45:42 +07:00
[extractor] Simplify search extractors
This commit is contained in:
@@ -4,6 +4,7 @@
|
||||
import base64
|
||||
import datetime
|
||||
import hashlib
|
||||
import itertools
|
||||
import json
|
||||
import netrc
|
||||
import os
|
||||
@@ -3617,7 +3618,14 @@ def _real_extract(self, query):
|
||||
return self._get_n_results(query, n)
|
||||
|
||||
def _get_n_results(self, query, n):
|
||||
"""Get a specified number of results for a query"""
|
||||
"""Get a specified number of results for a query.
|
||||
Either this function or _search_results must be overridden by subclasses """
|
||||
return self.playlist_result(
|
||||
itertools.islice(self._search_results(query), 0, None if n == float('inf') else n),
|
||||
query, query)
|
||||
|
||||
def _search_results(self, query):
|
||||
"""Returns an iterator of search results"""
|
||||
raise NotImplementedError('This method must be implemented by subclasses')
|
||||
|
||||
@property
|
||||
|
||||
Reference in New Issue
Block a user