- 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 mobj in re.finditer(r'<h3 class="r"><a href="([^"]+)"', webpage):
- e = {
+ for pagenum in itertools.count():
+ webpage = self._download_webpage(
+ 'http://www.google.com/search',
+ 'gvsearch:' + query,
+ note='Downloading result page %s' % (pagenum + 1),
+ query={
+ 'tbm': 'vid',
+ 'q': query,
+ 'start': pagenum * 10,
+ 'hl': 'en',
+ })
+
+ 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
+
+ entries.append({