diff --git a/youtube_dl/extractor/xhamster.py b/youtube_dl/extractor/xhamster.py
index 2c3fa93b9..9ce24172f 100644
--- a/youtube_dl/extractor/xhamster.py
+++ b/youtube_dl/extractor/xhamster.py
@@ -352,20 +352,20 @@ class XHamsterUserIE(InfoExtractor):
for page in itertools.count(1):
address = 'https://xhamster.com/users/%s/videos/%d' % (user_id, page)
webpage = self._download_webpage(address, user_id, note="Downloading page %d" % page)
- video_url_matches = re.finditer(r']+class="[^"]*thumb-image-container[^"]*"[^>]+href="(https://xhamster.com/videos/[^"/]+)"', webpage)
for video_url_match in video_url_matches:
video_url = video_url_match.group(1)
videos += [self.url_result(video_url, 'XHamster', '-'.split(video_url)[-1])]
- if re.search(r'', webpage):
+ if re.search(r'', webpage):
# The pager is empty; there is only a single page of results.
break
- next_page_matcher = re.search(r'', webpage)
+ next_page_matcher = re.search(r']+data-page="next"[^>]+href="([^"]+)"[^>]*>', webpage)
if next_page_matcher:
# There is a next page.
address = next_page_matcher.group(1)
continue
# Check we can find the previous page button as a sanity check.
- prev_page_matcher = re.search(r'', webpage)
+ prev_page_matcher = re.search(r']+data-page="prev"[^>]+href="([^"]+)"[^>]*>', webpage)
if prev_page_matcher:
# No more pages.
break