Skip to content
This repository has been archived by the owner on Oct 16, 2024. It is now read-only.

Commit

Permalink
feat: add support for Streamable (closes #27)
Browse files Browse the repository at this point in the history
  • Loading branch information
insertish committed Jan 27, 2023
1 parent a1bc99a commit 3aa7989
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 3 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "january"
version = "0.3.4"
version = "0.3.5"
edition = "2021"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
Expand Down
8 changes: 7 additions & 1 deletion src/structs/metadata.rs
Original file line number Diff line number Diff line change
Expand Up @@ -194,10 +194,16 @@ impl Metadata {
static ref RE_SOUNDCLOUD: Regex = Regex::new("^(?:https?://)?soundcloud.com/([a-zA-Z0-9-]+)/([A-z0-9-]+)").unwrap();
static ref RE_BANDCAMP: Regex = Regex::new("^(?:https?://)?(?:[A-z0-9_-]+).bandcamp.com/(track|album)/([A-z0-9_-]+)").unwrap();

static ref RE_STREAMABLE: Regex = Regex::new("^(?:https?://)?(?:www\\.)?streamable\\.com/([\\w\\d-]+)").unwrap();

static ref RE_GIF: Regex = Regex::new("^(?:https?://)?(www\\.)?(gifbox\\.me/view|yiffbox\\.me/view|tenor\\.com/view|giphy\\.com/gifs|gfycat\\.com|redgifs\\.com/watch)/[\\w\\d-]+").unwrap();
}

if let Some(captures) = RE_YOUTUBE.captures_iter(&self.url).next() {
if let Some(captures) = RE_STREAMABLE.captures_iter(&self.url).next() {
return Ok(Special::Streamable {
id: captures[1].to_string(),
});
} else if let Some(captures) = RE_YOUTUBE.captures_iter(&self.url).next() {
lazy_static! {
static ref RE_TIMESTAMP: Regex =
Regex::new("(?:\\?|&)(?:t|start)=([\\w]+)").unwrap();
Expand Down
3 changes: 3 additions & 0 deletions src/structs/special.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,4 +46,7 @@ pub enum Special {
content_type: BandcampType,
id: String,
},
Streamable {
id: String,
},
}

0 comments on commit 3aa7989

Please sign in to comment.