Autodetect zippyshare links
- Removed `-z` zippyshare resolver - Automatically detect zippyshare urls and resolve them
This commit is contained in:
parent
59de02d34d
commit
2cf9594fa9
@ -47,14 +47,6 @@ pub struct CLIArgs {
|
||||
)]
|
||||
pub conn_count: NonZeroU32,
|
||||
|
||||
#[clap(
|
||||
short = 'z',
|
||||
long = "zippy",
|
||||
help = "The provided URLs are zippyshare URLs and need to be \
|
||||
resolved to direct download urls",
|
||||
)]
|
||||
pub zippy: bool,
|
||||
|
||||
#[clap(
|
||||
short = 'l',
|
||||
long = "listfile",
|
||||
|
||||
@ -16,6 +16,7 @@ use tokio::{
|
||||
Mutex,
|
||||
},
|
||||
};
|
||||
use zippy::is_zippyshare_url;
|
||||
|
||||
use crate::{
|
||||
args::CLIArgs,
|
||||
@ -123,12 +124,12 @@ async fn download_job(urls: SyncQueue, reporter: UnboundedSender<DlReport>, cli_
|
||||
let reporter = DlReporter::new(dlreq.id as u32, reporter.clone());
|
||||
|
||||
// Resolve the zippy url to the direct download url if necessary
|
||||
let url = if cli_args.zippy {
|
||||
let url = if is_zippyshare_url(&dlreq.url) {
|
||||
match zippy::resolve_link(&dlreq.url).await {
|
||||
Ok(url) => url,
|
||||
Err(_e) => {
|
||||
reporter.send(DlStatus::Message(format!(
|
||||
"Zippyshare link could not be resolved: {}",
|
||||
"Zippyshare link could not be resolved, skipping: {}",
|
||||
dlreq.url
|
||||
)));
|
||||
continue;
|
||||
|
||||
@ -3,6 +3,12 @@ use std::io::{Error, ErrorKind};
|
||||
|
||||
use crate::errors::ResBE;
|
||||
|
||||
pub fn is_zippyshare_url(url: &str) -> bool {
|
||||
Regex::new(r"^https?://(?:www\d*\.)?zippyshare\.com/v/[0-9a-zA-Z]+/file\.html$")
|
||||
.unwrap()
|
||||
.is_match(url)
|
||||
}
|
||||
|
||||
/*
|
||||
Updated: 07.03.2022
|
||||
Link generation code:
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user