Crates.io | parser4curls |
lib.rs | parser4curls |
version | 0.1.1 |
source | src |
created_at | 2021-07-25 03:52:11.608703 |
updated_at | 2021-07-25 04:33:40.350856 |
description | a parser for the cURL commands string that copied from the developer tools in the browser, or a string that is compatible with pattern `curl |
homepage | |
repository | https://github.com/kookyleo/parser4curls |
max_upload_size | |
id | 426967 |
size | 394,789 |
a parser for the cURL commands string that copied from the developer tools in the browser,
or a string that is compatible with pattern curl <url> [options...]
curl <url> [options...]
cp from Chrome/Edge, Safari, Firefox, and similar more.
use parser4curls::parse;
fn main() {
let input = r#"curl 'https://www.google.com/search?q=Tokyo&rlz=1C5CHFA_enJP651JP651&oq=Tokyo&aqs=chrome..69i57j69i65.262j0j1&sourceid=chrome&ie=UTF-8' \
-H 'authority: www.google.com' \
-H 'cache-control: max-age=0' \
-H 'sec-ch-ua-mobile: ?0' \
-H 'upgrade-insecure-requests: 1' \
-H 'user-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.164 Safari/537.36' \
-H 'accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9' \
-H 'sec-fetch-site: same-origin' \
-H 'sec-fetch-mode: navigate' \
-H 'sec-fetch-user: ?1' \
-H 'sec-fetch-dest: document' \
-H 'accept-language: en-US,en;q=0.9' \
-H 'cookie: CGIC=d2VicCxpbWFnZS9hc; NID=219=3XwFj5FYc2Jtkwl5K-QM2cWdxv8Am9t14-zH1QzxtHWEUT3BMg; DV=kyQKkk0J-HU_sc0eciTCQs_p7gJQEAAAA' \
--compressed"#;
if let Ok(r) = parse(input) {
println!("{:#?}", r.1);
}
}