Skip to content

Commit

Permalink
feat: recognize lazy-loaded inline frame source URLs
Browse files Browse the repository at this point in the history
  • Loading branch information
LeoniePhiline committed Jan 19, 2024
1 parent 40baf90 commit cd693da
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 4 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased] <!-- release-date -->

### Added

- Recognize lazy-loaded inline frame source URLs.

### Changed

- Tighten code style to pedantic level.
Expand Down
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "showcase-dl"
version = "0.11.1"
version = "0.11.2"
edition = "2021"
publish = false

Expand Down
6 changes: 4 additions & 2 deletions src/extract/embeds.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,10 @@ use tracing::{debug, info, trace};
use crate::state::State;

static REGEX_VIDEO_IFRAME: Lazy<Regex> = Lazy::new(|| {
Regex::new(r#"<iframe[^>]* src="(?P<embed_url>https://player\.vimeo\.com/video/[^"]+)""#)
.unwrap()
Regex::new(
r#"<iframe[^>]* (?:data-)?src="(?P<embed_url>https://player\.vimeo\.com/video/[^"]+)""#,
)
.unwrap()
});

pub(crate) async fn extract_and_download_embeds(url: Url, state: Arc<State>) -> Result<()> {
Expand Down
3 changes: 2 additions & 1 deletion src/process/showcase.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ use crate::{
};

static REGEX_SHOWCASE_IFRAME: Lazy<Regex> = Lazy::new(|| {
Regex::new(r#"<iframe[^>]* src="(?P<embed_url>https://vimeo\.com/showcase/[^"]+)""#).unwrap()
Regex::new(r#"<iframe[^>]* (?:data-)?src="(?P<embed_url>https://vimeo\.com/showcase/[^"]+)""#)
.unwrap()
});

static REGEX_EMBED_URL: Lazy<Regex> =
Expand Down

0 comments on commit cd693da

Please sign in to comment.