X-Git-Url: http://git.cielonegro.org/gitweb.cgi?a=blobdiff_plain;f=youtube_dl%2Fextractor%2Fgooglesearch.py;h=498304cb2bd9b605d44e67291a2f38bf4481a6f8;hb=e9bd0f772b28176e86cfe8c641b6281a96be2ee4;hp=5c25642702993f1ec344ce9a0d4967fffedc760a;hpb=ccf9114e84ded8dd90b01c6c2d4d3ff3b111d7cd;p=youtube-dl.git diff --git a/youtube_dl/extractor/googlesearch.py b/youtube_dl/extractor/googlesearch.py index 5c2564270..498304cb2 100644 --- a/youtube_dl/extractor/googlesearch.py +++ b/youtube_dl/extractor/googlesearch.py @@ -4,7 +4,7 @@ import itertools import re from .common import SearchInfoExtractor -from ..utils import ( +from ..compat import ( compat_urllib_parse, ) @@ -14,6 +14,14 @@ class GoogleSearchIE(SearchInfoExtractor): _MAX_RESULTS = 1000 IE_NAME = 'video.google:search' _SEARCH_KEY = 'gvsearch' + _TEST = { + 'url': 'gvsearch15:python language', + 'info_dict': { + 'id': 'python language', + 'title': 'python language', + }, + 'playlist_count': 15, + } def _get_n_results(self, query, n): """Get a specified number of results for a query""" @@ -46,6 +54,6 @@ class GoogleSearchIE(SearchInfoExtractor): 'url': mobj.group(1) }) - if (len(entries) >= n) or not re.search(r'class="pn" id="pnnext"', webpage): + if (len(entries) >= n) or not re.search(r'id="pnnext"', webpage): res['entries'] = entries[:n] return res