diff --git a/src/pixiv_link.rs b/src/pixiv_link.rs index 87cf3d0..5f8f592 100644 --- a/src/pixiv_link.rs +++ b/src/pixiv_link.rs @@ -9,6 +9,8 @@ lazy_static! { static ref RE: Regex = Regex::new("^(https?://)?(www\\.)?pixiv\\.net/artworks/(?P\\d+)").unwrap(); #[doc(hidden)] static ref RE2: Regex = Regex::new("^(https?://)?(www\\.)?fanbox\\.cc/@(?P[^/]+)/posts/(?P\\d+)").unwrap(); + #[doc(hidden)] + static ref RE3: Regex = Regex::new("^(https?://)?(?P[^./]+)\\.fanbox\\.cc/posts/(?P\\d+)").unwrap(); } #[derive(Clone, Debug)] @@ -77,6 +79,21 @@ impl PixivID { }, None => {} } + match RE3.captures(s) { + Some(re) => match re.name("creator") { + Some(creator) => match re.name("id") { + Some(id) => match id.as_str().parse::() { + Ok(id) => { + return Some(Self::FanboxPost(FanboxPostID::new(creator.as_str(), id))); + } + Err(_) => {} + }, + None => {} + }, + None => {} + }, + None => {} + } None }