use regex::Regex in pixiv link parse

This commit is contained in:
2022-06-21 15:23:42 +00:00
committed by GitHub
parent dc12324c9b
commit 2d617f1464
3 changed files with 3 additions and 5 deletions

1
Cargo.lock generated
View File

@@ -1279,6 +1279,7 @@ dependencies = [
"modular-bitfield",
"parse-size",
"proc_macros",
"regex",
"reqwest",
"tokio",
"url",

View File

@@ -27,6 +27,7 @@ lazy_static = "1.4"
modular-bitfield = "0.11"
parse-size = "1"
proc_macros = { path = "proc_macros" }
regex = "1"
reqwest = { version = "0.11", features = ["brotli", "deflate", "gzip", "rustls-tls", "socks", "stream"] }
RustyXML = "0.3"
tokio = { version = "1.19", features = ["rt", "macros", "rt-multi-thread", "time"] }

View File

@@ -1,5 +1,5 @@
use crate::ext::json::ToJson;
use fancy_regex::Regex;
use regex::Regex;
use json::JsonValue;
use reqwest::IntoUrl;
use std::convert::TryInto;
@@ -28,10 +28,6 @@ impl PixivID {
return Some(PixivID::Artwork(num.unwrap()));
}
let re = RE.captures(s);
if re.is_err() {
return None;
}
let re = re.unwrap();
if re.is_some() {
let r = re.unwrap().name("id");
if r.is_some() {