- for pagenum in itertools.count(1):
- result_url = u'http://www.google.com/search?tbm=vid&q=%s&start=%s&hl=en' % (compat_urllib_parse.quote_plus(query), pagenum*10)
- webpage = self._download_webpage(result_url, u'gvsearch:' + query,
- note='Downloading result page ' + str(pagenum))
+ for pagenum in itertools.count():
+ result_url = (
+ 'http://www.google.com/search?tbm=vid&q=%s&start=%s&hl=en'
+ % (compat_urllib_parse.quote_plus(query), pagenum * 10))
+
+ webpage = self._download_webpage(
+ result_url, 'gvsearch:' + query,
+ note='Downloading result page ' + str(pagenum + 1))
+
+ for hit_idx, mobj in enumerate(re.finditer(
+ r'<h3 class="r"><a href="([^"]+)"', webpage)):
+
+ # Skip playlists
+ if not re.search(r'id="vidthumb%d"' % (hit_idx + 1), webpage):
+ continue