[ie/twitter:spaces] Support video spaces (#10789)
[yt-dlp3.git] / yt_dlp / extractor / googlesearch.py
blob67ca0e5e0fcf02a6b6947c28f5d3b02c61fd22fa
1 import itertools
2 import re
4 from .common import SearchInfoExtractor
7 class GoogleSearchIE(SearchInfoExtractor):
8 IE_DESC = 'Google Video search'
9 IE_NAME = 'video.google:search'
10 _SEARCH_KEY = 'gvsearch'
11 _TESTS = [{
12 'url': 'gvsearch15:python language',
13 'info_dict': {
14 'id': 'python language',
15 'title': 'python language',
17 'playlist_count': 15,
19 _PAGE_SIZE = 100
21 def _search_results(self, query):
22 for pagenum in itertools.count():
23 webpage = self._download_webpage(
24 'http://www.google.com/search', f'gvsearch:{query}',
25 note=f'Downloading result page {pagenum + 1}',
26 query={
27 'tbm': 'vid',
28 'q': query,
29 'start': pagenum * self._PAGE_SIZE,
30 'num': self._PAGE_SIZE,
31 'hl': 'en',
34 for url in re.findall(r'<div[^>]* class="dXiKIc"[^>]*><a href="([^"]+)"', webpage):
35 yield self.url_result(url)
37 if not re.search(r'id="pnnext"', webpage):
38 return