Skip to content

Commit 71a8bb3

Browse files
authored
Update search.py
1 parent 8f366a2 commit 71a8bb3

1 file changed

Lines changed: 12 additions & 6 deletions

File tree

youtubesearchpython/__future__/search.py

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ class Search(SearchCore):
1313
limit (int, optional): Sets limit to the number of results. Defaults to 20.
1414
language (str, optional): Sets the result language. Defaults to 'en'.
1515
region (str, optional): Sets the result region. Defaults to 'US'.
16+
timeout (int, optional): Sets the request timeout in seconds. Defaults to 10 seconds. Pass None to use default.
1617
1718
Examples:
1819
Calling `result` method gives the search result.
@@ -76,7 +77,7 @@ def __init__(self, query: str, limit: int = 20, language: str = 'en', region: st
7677
super().__init__(query, limit, language, region, None, timeout) # type: ignore
7778

7879
async def next(self) -> Dict[str, Any]:
79-
return await self._nextAsync()
80+
return await self._nextAsync() # type: ignore
8081

8182

8283
class VideosSearch(SearchCore):
@@ -87,6 +88,7 @@ class VideosSearch(SearchCore):
8788
limit (int, optional): Sets limit to the number of results. Defaults to 20.
8889
language (str, optional): Sets the result language. Defaults to 'en'.
8990
region (str, optional): Sets the result region. Defaults to 'US'.
91+
timeout (int, optional): Sets the request timeout in seconds. Defaults to 10 seconds. Pass None to use default.
9092
9193
Examples:
9294
Calling `result` method gives the search result.
@@ -150,7 +152,7 @@ def __init__(self, query: str, limit: int = 20, language: str = 'en', region: st
150152
super().__init__(query, limit, language, region, SearchMode.videos, timeout) # type: ignore
151153

152154
async def next(self) -> Dict[str, Any]:
153-
return await self._nextAsync()
155+
return await self._nextAsync() # type: ignore
154156

155157

156158
class ChannelsSearch(SearchCore):
@@ -161,6 +163,7 @@ class ChannelsSearch(SearchCore):
161163
limit (int, optional): Sets limit to the number of results. Defaults to 20.
162164
language (str, optional): Sets the result language. Defaults to 'en'.
163165
region (str, optional): Sets the result region. Defaults to 'US'.
166+
timeout (int, optional): Sets the request timeout in seconds. Defaults to 10 seconds. Pass None to use default.
164167
165168
Examples:
166169
Calling `result` method gives the search result.
@@ -199,7 +202,7 @@ def __init__(self, query: str, limit: int = 20, language: str = 'en', region: st
199202
super().__init__(query, limit, language, region, SearchMode.channels, timeout) # type: ignore
200203

201204
async def next(self) -> Dict[str, Any]:
202-
return await self._nextAsync()
205+
return await self._nextAsync() # type: ignore
203206

204207

205208
class PlaylistsSearch(SearchCore):
@@ -210,6 +213,7 @@ class PlaylistsSearch(SearchCore):
210213
limit (int, optional): Sets limit to the number of results. Defaults to 20.
211214
language (str, optional): Sets the result language. Defaults to 'en'.
212215
region (str, optional): Sets the result region. Defaults to 'US'.
216+
timeout (int, optional): Sets the request timeout in seconds. Defaults to 10 seconds. Pass None to use default.
213217
214218
Examples:
215219
Calling `result` method gives the search result.
@@ -261,7 +265,7 @@ def __init__(self, query: str, limit: int = 20, language: str = 'en', region: st
261265
super().__init__(query, limit, language, region, SearchMode.playlists, timeout) # type: ignore
262266

263267
async def next(self) -> Dict[str, Any]:
264-
return await self._nextAsync()
268+
return await self._nextAsync() # type: ignore
265269

266270
class CustomSearch(SearchCore):
267271
'''Performs custom search in YouTube with search filters or sorting orders.
@@ -282,6 +286,7 @@ class CustomSearch(SearchCore):
282286
limit (int, optional): Sets limit to the number of results. Defaults to 20.
283287
language (str, optional): Sets the result language. Defaults to 'en'.
284288
region (str, optional): Sets the result region. Defaults to 'US'.
289+
timeout (int, optional): Sets the request timeout in seconds. Defaults to 10 seconds. Pass None to use default.
285290
286291
Examples:
287292
Calling `result` method gives the search result.
@@ -345,7 +350,7 @@ def __init__(self, query: str, searchPreferences: str, limit: int = 20, language
345350
super().__init__(query, limit, language, region, searchPreferences, timeout) # type: ignore
346351

347352
async def next(self) -> Dict[str, Any]:
348-
return await self._nextAsync()
353+
return await self._nextAsync() # type: ignore
349354

350355
class ChannelSearch(ChannelSearchCore):
351356
'''Searches for videos in specific channel in YouTube.
@@ -355,6 +360,7 @@ class ChannelSearch(ChannelSearchCore):
355360
browseId (str): Channel ID
356361
language (str, optional): Sets the result language. Defaults to 'en'.
357362
region (str, optional): Sets the result region. Defaults to 'US'.
363+
timeout (int, optional): Sets the request timeout in seconds. Defaults to 10 seconds. Pass None to use default.
358364
359365
Examples:
360366
Calling `result` method gives the search result.
@@ -406,7 +412,7 @@ class ChannelSearch(ChannelSearchCore):
406412
"published": "10 months ago",
407413
"channel": {
408414
"name": "Harry Styles",
409-
"thumbnails": [
415+
"thumbnails": [
410416
{
411417
"url": "https://yt3.ggpht.com/ytc/AAUvwnhR81ocC_KalYEk5ItnJcfMBqaiIpuM1B0lJyg4Rw=s88-c-k-c0x00ffffff-no-rj",
412418
"width": 68,

0 commit comments

Comments
 (0)