diff --git a/src/media/anime/impl.rs b/src/media/anime/impl.rs index 9ad4d1f..ec2ae87 100644 --- a/src/media/anime/impl.rs +++ b/src/media/anime/impl.rs @@ -354,14 +354,14 @@ macro_rules! impl_media_video { /// All streams are drm encrypted, decryption is not handled in this crate, so you /// must do this yourself. pub async fn stream(&self) -> Result<$crate::media::Stream> { - $crate::media::Stream::drm_from_id(&$crate::Crunchyroll { executor: self.executor.clone() }, &self.id, None).await + $crate::media::Stream::from_id_drm(&$crate::Crunchyroll { executor: self.executor.clone() }, &self.id, None).await } /// Streams for this episode / movie. /// Unlike [`Self::stream`] the streams may not be DRM encrypted (at least at the /// time of writing they aren't but this might change at any time). pub async fn stream_maybe_without_drm(&self) -> Result<$crate::media::Stream> { - $crate::media::Stream::maybe_without_drm_from_id(&$crate::Crunchyroll { executor: self.executor.clone() }, &self.id, None).await + $crate::media::Stream::from_id_maybe_without_drm(&$crate::Crunchyroll { executor: self.executor.clone() }, &self.id, None).await } /// Check if the episode / movie can be watched. diff --git a/src/media/music/impl.rs b/src/media/music/impl.rs index a755793..b20a42f 100644 --- a/src/media/music/impl.rs +++ b/src/media/music/impl.rs @@ -28,14 +28,14 @@ macro_rules! impl_media_music { /// All streams are drm encrypted, decryption is not handled in this crate, so you /// must do this yourself. pub async fn stream(&self) -> Result<$crate::media::Stream> { - $crate::media::Stream::drm_from_id(&$crate::Crunchyroll { executor: self.executor.clone() }, &self.id, Some("music".to_string())).await + $crate::media::Stream::from_id_drm(&$crate::Crunchyroll { executor: self.executor.clone() }, &self.id, Some("music".to_string())).await } /// Streams for this episode / movie. /// Unlike [`Self::stream`] the streams may not be DRM encrypted (at least at the /// time of writing they aren't but this might change at any time). pub async fn stream_maybe_without_drm(&self) -> Result<$crate::media::Stream> { - $crate::media::Stream::maybe_without_drm_from_id(&$crate::Crunchyroll { executor: self.executor.clone() }, &self.id, None).await + $crate::media::Stream::from_id_maybe_without_drm(&$crate::Crunchyroll { executor: self.executor.clone() }, &self.id, None).await } /// Check if the music video / concert can be watched. diff --git a/src/media/stream.rs b/src/media/stream.rs index 5aa3ef8..76eeecc 100644 --- a/src/media/stream.rs +++ b/src/media/stream.rs @@ -81,9 +81,8 @@ pub struct StreamSession { } impl Stream { - /// Uses the endpoint which is also used in the Chrome browser to receive streams. This endpoint - /// always returns DRM encrypted streams. - pub async fn drm_from_id( + /// Requests a stream from an id with is always DRM encrypted. + pub async fn from_id_drm( crunchyroll: &Crunchyroll, id: impl AsRef, optional_media_type: Option, @@ -91,10 +90,10 @@ impl Stream { Self::from_id(crunchyroll, id, "web", "chrome", optional_media_type).await } - /// Uses the endpoint which is also used in the Nintendo Switch to receive streams. At the time - /// of writing, this is the only known endpoint that still delivers streams without DRM, but - /// this might change at any time (hence the "mabye" in the function name). - pub async fn maybe_without_drm_from_id( + /// Requests a stream from an id with is maybe DRM free. Check + /// [`Stream::session::uses_stream_limits`], if its `true`, the stream is DRM encrypted, if + /// `false` not. + pub async fn from_id_maybe_without_drm( crunchyroll: &Crunchyroll, id: impl AsRef, optional_media_type: Option, @@ -133,10 +132,11 @@ impl Stream { /// Requests all available video and audio streams. Returns [`None`] if the requested hardsub /// isn't available. The first [`Vec`] contains only video streams, the second only /// audio streams. - /// You will run into an error when requesting this function too often without invalidating the - /// data. Crunchyroll only allows a certain amount of stream data to be requested at the same - /// time, typically the exact amount depends on the type of (premium) subscription you have. You - /// can use [`Stream::invalidate`] to invalidate all stream data for this stream. + /// If the stream is DRM encrypted ([`Stream::session::uses_stream_limit`] is `true` if the + /// streams are encrypted) you will run into an error when requesting this function too often + /// without invalidating the data. Crunchyroll only allows a certain amount of stream data to be + /// requested at the same time, typically the exact amount depends on the type of (premium) + /// subscription you have. You can use [`Stream::invalidate`] to invalidate all stream data for this stream. pub async fn stream_data( &self, hardsub: Option, @@ -213,7 +213,7 @@ impl Stream { for id in version_ids { if self.session.uses_stream_limits { result.push( - Self::drm_from_id( + Self::from_id_drm( &Crunchyroll { executor: self.executor.clone(), }, @@ -224,7 +224,7 @@ impl Stream { ) } else { result.push( - Self::maybe_without_drm_from_id( + Self::from_id_maybe_without_drm( &Crunchyroll { executor: self.executor.clone(), }, @@ -251,7 +251,7 @@ impl Stream { for id in version_ids { if self.session.uses_stream_limits { result.push( - Self::drm_from_id( + Self::from_id_drm( &Crunchyroll { executor: self.executor.clone(), }, @@ -262,7 +262,7 @@ impl Stream { ) } else { result.push( - Self::maybe_without_drm_from_id( + Self::from_id_maybe_without_drm( &Crunchyroll { executor: self.executor.clone(), },