Skip to content

Open-source download manager & offline media toolbox for YouTube, music, social media, learning platforms & 1,800+ sites. Built with Tauri 2.0, Rust & Svelte.

feat: add Pinterest URL parsing support in parse_url function

Tonho5a39b3ad23a8
diff --git a/src-tauri/src/core/url_parser.rs b/src-tauri/src/core/url_parser.rs
index e3693904..283abe53 100644
--- a/src-tauri/src/core/url_parser.rs
+++ b/src-tauri/src/core/url_parser.rs
@@ -39,6 +39,7 @@ pub fn parse_url(url_str: &str) -> Option<ParsedUrl> {
Platform::Twitch => parse_twitch(&parsed, &segments),
Platform::Vimeo => parse_vimeo(&segments),
Platform::Hotmart => parse_hotmart(&segments),
+ Platform::Pinterest => parse_pinterest(&segments),
};
Some(ParsedUrl {
@@ -223,3 +224,23 @@ fn parse_hotmart(segments: &[&str]) -> (Option<String>, ParsedContentType) {
(None, ParsedContentType::Unknown)
}
+
+fn parse_pinterest(segments: &[&str]) -> (Option<String>, ParsedContentType) {
+ if segments.first() == Some(&"pin") {
+ let raw_id = segments.get(1).map(|s| {
+ if s.contains("--") {
+ s.split("--").last().unwrap_or(s).to_string()
+ } else {
+ s.to_string()
+ }
+ });
+ return (raw_id, ParsedContentType::Image);
+ }
+
+ if segments.first() == Some(&"url_shortener") {
+ let code = segments.get(1).map(|s| s.to_string());
+ return (code, ParsedContentType::Unknown);
+ }
+
+ (None, ParsedContentType::Unknown)
+}