Skip to content

Commit

Permalink
re-introduce drdk
Browse files Browse the repository at this point in the history
  • Loading branch information
cycle-five committed Jul 9, 2024
1 parent cebefa6 commit 7a37a4c
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 7 deletions.
2 changes: 2 additions & 0 deletions rsget_lib/src/plugins/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,12 @@ mod afreeca;
mod bilibili;
mod dlive;
mod twitch;
mod drdk;
mod vlive;

pub use afreeca::Afreeca;
pub use bilibili::Bilibili;
pub use dlive::DLive;
pub use drdk::Drdk;
pub use twitch::Twitch;
pub use vlive::Vlive;
4 changes: 2 additions & 2 deletions rsget_lib/src/plugins/twitch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ impl Streamable for Twitch {
e
})?;

match payload.data.get(0) {
match payload.data.first() {
Some(data) => Ok(data.title.clone()),
None => Err(StreamError::Rsget(RsgetError::new(
"[Twitch] User is offline",
Expand Down Expand Up @@ -177,7 +177,7 @@ impl Streamable for Twitch {
.text()
.await?;
let playlist = MasterPlaylist::try_from(playlist_res.as_str())?;
let qu_name = playlist.media.get(0).unwrap().name();
let qu_name = playlist.media.first().unwrap().name();

Ok(stream_lib::download_hls_named(
self.client.clone(),
Expand Down
2 changes: 1 addition & 1 deletion rsget_lib/src/plugins/vlive.rs
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ impl Streamable for Vlive {
let info = page_req.json::<VideoInfo>().await?;
let stream_url = info
.streams
.get(0)
.first()
.map(|stream| format!("{}?{}={}", stream.source, stream.key.name, stream.key.value));

let mut videos = info.videos.list;
Expand Down
8 changes: 4 additions & 4 deletions rsget_lib/src/utils/sites.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ use crate::plugins::{
mixer::Mixer, tiktok::TikTok, twitch::Twitch, vlive::Vlive,
};
*/
use crate::plugins::{Afreeca, Bilibili, DLive, Twitch, Vlive};
//use crate::plugins::{Afreeca, Bilibili, DLive, Drdk, Twitch, Vlive};
//use crate::plugins::{Afreeca, Bilibili, DLive, Twitch, Vlive};
use crate::plugins::{Afreeca, Bilibili, DLive, Drdk, Twitch, Vlive};
use crate::utils::error::RsgetError;
use crate::utils::error::StreamError;
use crate::utils::error::StreamResult;
Expand All @@ -25,7 +25,7 @@ pub async fn get_site(input: &str) -> StreamResult<Box<dyn Streamable + Send>> {
}

async fn _get_site(input: &str) -> StreamResult<Box<dyn Streamable + Send>> {
//let re_drdk: Regex = Regex::new(r"^(?:https?://)?(?:www\.)?dr\.dk/drtv/kanal/[a-zA-Z0-9-_]+")?;
let re_drdk: Regex = Regex::new(r"^(?:https?://)?(?:www\.)?dr\.dk/drtv/kanal/[a-zA-Z0-9-_]+")?;
let re_afreeca: Regex = Regex::new(
r"^(?:https?://)?(?:www\.)?(?:play\.)?afreecatv.com/[a-zA-Z0-9]+/?(?:/[0-9]+)?",
)?;
Expand All @@ -45,7 +45,7 @@ async fn _get_site(input: &str) -> StreamResult<Box<dyn Streamable + Send>> {
url if re_afreeca.is_match(url) => Ok(Afreeca::new(String::from(url)).await?),
url if re_bilibili.is_match(url) => Ok(Bilibili::new(String::from(url)).await?),
url if re_dlive.is_match(url) => Ok(DLive::new(String::from(url)).await?),
//url if re_drdk.is_match(url) => Ok(Drdk::new(String::from(url)).await?),
url if re_drdk.is_match(url) => Ok(Drdk::new(String::from(url)).await?),
url if re_twitch.is_match(url) => Ok(Twitch::new(String::from(url)).await?),
url if re_vlive.is_match(url) => Ok(Vlive::new(String::from(url)).await?),
/*
Expand Down

0 comments on commit 7a37a4c

Please sign in to comment.