diff options
author | Benedikt Peetz <benedikt.peetz@b-peetz.de> | 2024-08-22 14:26:15 +0200 |
---|---|---|
committer | Benedikt Peetz <benedikt.peetz@b-peetz.de> | 2024-08-22 14:26:15 +0200 |
commit | a2015b82eeb1dde1aded82435b3f3700232b9d83 (patch) | |
tree | 8b151c6dd36deb99d0553a4dcf4879e50d539fec /src/subscribe/mod.rs | |
parent | fix(storage/get_videos): Also order by `publish_date` (diff) | |
download | yt-a2015b82eeb1dde1aded82435b3f3700232b9d83.tar.gz yt-a2015b82eeb1dde1aded82435b3f3700232b9d83.zip |
fix(subscriptions/add): Ignore the trailing slash on URLs
Diffstat (limited to 'src/subscribe/mod.rs')
-rw-r--r-- | src/subscribe/mod.rs | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/src/subscribe/mod.rs b/src/subscribe/mod.rs index 1796fb4..1cb3092 100644 --- a/src/subscribe/mod.rs +++ b/src/subscribe/mod.rs @@ -70,7 +70,10 @@ pub async fn import<W: AsyncBufRead + AsyncBufReadExt + Unpin>( pub async fn subscribe(app: &App, name: Option<String>, url: Url) -> Result<()> { if !(url.as_str().ends_with("videos") || url.as_str().ends_with("streams") - || url.as_str().ends_with("shorts")) + || url.as_str().ends_with("shorts") + || url.as_str().ends_with("videos/") + || url.as_str().ends_with("streams/") + || url.as_str().ends_with("shorts/")) && url.as_str().contains("youtube.com") { warn!("Your youtbe url does not seem like it actually tracks a channels playlist (videos, streams, shorts). Adding subscriptions for each of them..."); @@ -135,11 +138,11 @@ pub async fn subscribe(app: &App, name: Option<String>, url: Url) -> Result<()> } async fn actual_subscribe(app: &App, name: Option<String>, url: Url) -> Result<()> { - let name = if let Some(name) = name { - if !check_url(&url).await? { - bail!("The url ('{}') does not represent a playlist!", &url) - }; + if !check_url(&url).await? { + bail!("The url ('{}') does not represent a playlist!", &url) + }; + let name = if let Some(name) = name { name } else { let yt_opts = match json!( { |