From 644149afec99b2db4c1cc1286eb5c753ac187c44 Mon Sep 17 00:00:00 2001
From: pukkandan <pukkandan.ytdlp@gmail.com>
Date: Tue, 5 Oct 2021 08:33:36 +0530
Subject: [PATCH] [soundcloud:playlist] Detect last page correctly Closes #1168

---
 yt_dlp/extractor/soundcloud.py | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/yt_dlp/extractor/soundcloud.py b/yt_dlp/extractor/soundcloud.py
index 1503ae586..ad3a32a02 100644
--- a/yt_dlp/extractor/soundcloud.py
+++ b/yt_dlp/extractor/soundcloud.py
@@ -707,6 +707,8 @@ class SoundcloudPagedPlaylistBaseIE(SoundcloudIE):
                 yield resolve_entry(e, e.get('track'), e.get('playlist'))
 
             url = response.get('next_href')
+            if not url:
+                break
             query.pop('offset', None)