diff --git a/src/mixcloud.rs b/src/mixcloud.rs index b8deacb..0a073f9 100644 --- a/src/mixcloud.rs +++ b/src/mixcloud.rs @@ -163,20 +163,16 @@ pub(crate) async fn cloudcasts(username: &str, limit: Option) -> Result { + match (limit, cloudcasts_res.paging.next) { + (0, Some(_)) => break, + (_, Some(next_url)) => { url = Url::parse(&next_url)?; set_paging_query(&mut url, limit, offset); } - None => break, - } - - // We have reached the limit. - if limit == 0 { - break; + (_, None) => break, } }