fix: only use auth-enabled clients for fetching player with auth option enabled

This commit is contained in:
ThetaDev 2025-01-06 02:09:15 +01:00
parent addeb82110
commit 2b2b4af0b2
No known key found for this signature in database
GPG key ID: E319D3C5148D65B6
2 changed files with 24 additions and 11 deletions

View file

@ -79,8 +79,14 @@ impl RustyPipeQuery {
let video_id = video_id.as_ref();
let mut last_e = Error::Other("no clients".into());
for client in clients {
let res = self.player_from_client(video_id, *client).await;
let clients_iter: Box<dyn Iterator<Item = ClientType>> = if self.opts.auth == Some(true) {
Box::new(self.auth_enabled_clients(clients))
} else {
Box::new(clients.iter().cloned())
};
for client in clients_iter {
let res = self.player_from_client(video_id, client).await;
match res {
Ok(res) => return Ok(res),
Err(Error::Extraction(e)) => {