From 496ca6a8fdac8e66d25f2547b649ee0094b74e92 Mon Sep 17 00:00:00 2001 From: Thanos Apollo Date: Sat, 8 Jul 2023 11:32:11 +0300 Subject: yeetube-search: make yeetube-results limit only be a limiting factor Previously the while loop would run until there are enough video-ids to satisfy yeetube-results-limit(which was a stupid design by me). Change to run loop while video-ids < limit & if search-forward VIDEO-ID succeeds. This also makes the previous error messages unnecessary. --- yeetube.el | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/yeetube.el b/yeetube.el index 410680a..7db8f60 100644 --- a/yeetube.el +++ b/yeetube.el @@ -192,16 +192,10 @@ PREFIX [[URL/watch?v=VIDEOID][VIDEOTITLE ]]" t t) (goto-char (point-min)) (toggle-enable-multibyte-characters) - (while (< (length video-ids) yeetube-results-limit) - (condition-case err - (if is-youtube? - (search-forward "videoId") - (search-forward "watch?v")) - (error - (display-warning 'yeetube - (format - "Unable to find enough results, reduce yeetube-results-limit (%s)" - (error-message-string err))))) + (while (and (< (length video-ids) yeetube-results-limit) + (if is-youtube? + (search-forward "videoId" nil t) + (search-forward "watch?v" nil t))) (let* ((start (point)) (end (if is-youtube? (search-forward ",") -- cgit v1.2.3