diff --git a/src/apkpure.rs b/src/apkpure.rs index d7676bd..9705174 100644 --- a/src/apkpure.rs +++ b/src/apkpure.rs @@ -30,6 +30,7 @@ pub async fn download_apps( parallel: usize, sleep_duration: u64, outpath: &Path, + xapk_bundle: bool ) { let mp = Rc::new(MultiProgress::new()); let http_client = Rc::new(reqwest::Client::new()); @@ -64,7 +65,11 @@ pub async fn download_apps( .headers(headers) .send().await.unwrap(); if let Some(app_version) = app_version { - let regex_string = format!("[[:^digit:]]{}:(?s:.)+?{}", regex::escape(&app_version), crate::consts::APKPURE_DOWNLOAD_URL_REGEX); + let download_url_regex = match xapk_bundle { + true => format!("(XAPKJ)..{}", crate::consts::APKPURE_DOWNLOAD_URL_REGEX), + false => format!("[^X](APKJ)..{}", crate::consts::APKPURE_DOWNLOAD_URL_REGEX) + }; + let regex_string = format!("[[:^digit:]]{}:(?s:.)+?{}", regex::escape(&app_version), download_url_regex); let re = Regex::new(®ex_string).unwrap(); download_from_response(versions_response, Box::new(Box::new(re)), app_string, outpath, mp).await; } else { diff --git a/src/consts.rs b/src/consts.rs index 0c39a13..bd0c7bd 100644 --- a/src/consts.rs +++ b/src/consts.rs @@ -1,5 +1,5 @@ pub const APKPURE_VERSIONS_URL_FORMAT: &str = "https://api.pureapk.com/m/v3/cms/app_version?hl=en-US&package_name="; -pub const APKPURE_DOWNLOAD_URL_REGEX: &str = r"(X?APKJ)..(https?://(www\.)?[-a-zA-Z0-9@:%._\+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()@:%_\+.~#?&//=]*))"; +pub const APKPURE_DOWNLOAD_URL_REGEX: &str = r"(https?://(www\.)?[-a-zA-Z0-9@:%._\+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()@:%_\+.~#?&//=]*))"; pub const FDROID_REPO: &str = "https://f-droid.org/repo"; pub const FDROID_INDEX_FINGERPRINT: &[u8] = &[67, 35, 141, 81, 44, 30, 94, 178, 214, 86, 159, 74, 58, 251, 245, 82, 52, 24, 184, 46, 10, 62, 209, 85, 39, 112, 171, 185, 169, 201, 204, 171]; pub const FDROID_SIGNATURE_BLOCK_FILE_REGEX: &str = r"^META-INF/.*\.(DSA|EC|RSA)$"; diff --git a/src/lib.rs b/src/lib.rs new file mode 100644 index 0000000..93a3472 --- /dev/null +++ b/src/lib.rs @@ -0,0 +1,8 @@ +pub mod apkpure; +pub mod fdroid; +pub mod google_play; +pub mod huawei_app_gallery; + +mod progress_bar; +mod consts; +mod config; \ No newline at end of file diff --git a/src/main.rs b/src/main.rs index 90110e8..6909444 100644 --- a/src/main.rs +++ b/src/main.rs @@ -284,7 +284,7 @@ async fn main() { match download_source { DownloadSource::APKPure => { - apkpure::download_apps(list, parallel, sleep_duration, &outpath).await; + apkpure::download_apps(list, parallel, sleep_duration, &outpath, true).await; } DownloadSource::GooglePlay => { let mut username = matches.get_one::("google_username").map(|v| v.to_string());