diff --git a/Cargo.lock b/Cargo.lock index 643fdc0..5a1bfb6 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1,10 +1,12 @@ # This file is automatically @generated by Cargo. # It is not intended for manual editing. +version = 3 + [[package]] name = "autocfg" -version = "1.0.1" +version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cdb031dd78e28731d87d56cc8ffef4a8f36ca26c38fe2de700543e627f8a464a" +checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" [[package]] name = "base64" @@ -14,27 +16,27 @@ checksum = "904dfeac50f3cdaba28fc6f57fdcddb75f49ed61346676a78c4ffe55877802fd" [[package]] name = "bitflags" -version = "1.2.1" +version = "1.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf1de2fe8c75bc145a2f577add951f8134889b4795d47466a54a5c846d691693" +checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" [[package]] name = "bumpalo" -version = "3.6.0" +version = "3.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "099e596ef14349721d9016f6b80dd3419ea1bf289ab9b44df8e4dfd3a005d5d9" +checksum = "a4a45a46ab1f2412e53d3a0ade76ffad2025804294569aae387231a0cd6e0899" [[package]] name = "bytes" -version = "1.0.1" +version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b700ce4376041dcd0a327fd0097c41095743c4c8af8887265942faf1100bd040" +checksum = "c4872d67bab6358e59559027aa3b9157c53d9358c51423c17554809a8858e0f8" [[package]] name = "cc" -version = "1.0.66" +version = "1.0.73" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c0496836a84f8d0495758516b8621a622beb77c0fed418570e50764093ced48" +checksum = "2fff2a6927b3bb87f9595d67196a70493f627687a71d87a0d692242c33f58c11" [[package]] name = "cfg-if" @@ -44,20 +46,30 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" [[package]] name = "clap" -version = "2.33.3" +version = "3.1.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "37e58ac78573c40708d45522f0d80fa2f01cc4f9b4e2bf749807255454312002" +checksum = "c4b3ee449efa0c4f95cd48b00539829d3655a98e189a90617246492788d22404" dependencies = [ "bitflags", + "clap_lex", + "indexmap", "textwrap", - "unicode-width", +] + +[[package]] +name = "clap_lex" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a37c35f1112dad5e6e0b1adaff798507497a18fceeb30cceb3bae7d1427b9213" +dependencies = [ + "os_str_bytes", ] [[package]] name = "core-foundation" -version = "0.9.1" +version = "0.9.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0a89e2ae426ea83155dccf10c0fa6b1463ef6d5fcb44cee0b224a408fa640a62" +checksum = "194a7a9e6de53fa55116934067c844d9d749312f75c6f6d0980e8c252f8c2146" dependencies = [ "core-foundation-sys", "libc", @@ -65,19 +77,28 @@ dependencies = [ [[package]] name = "core-foundation-sys" -version = "0.8.2" +version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ea221b5284a47e40033bf9b66f35f984ec0ea2931eb03505246cd27a963f981b" +checksum = "5827cebf4670468b8772dd191856768aedcb1b0278a04f989f7766351917b9dc" [[package]] name = "encoding_rs" -version = "0.8.28" +version = "0.8.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "80df024fbc5ac80f87dfef0d9f5209a252f2a497f7f42944cff24d8253cac065" +checksum = "9852635589dc9f9ea1b6fe9f05b50ef208c85c834a562f0c6abb1c475736ec2b" dependencies = [ "cfg-if", ] +[[package]] +name = "fastrand" +version = "1.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c3fcf0cee53519c866c09b5de1f6c56ff9d647101f81c1964fa632e148896cdf" +dependencies = [ + "instant", +] + [[package]] name = "fnv" version = "1.0.7" @@ -101,9 +122,9 @@ checksum = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b" [[package]] name = "form_urlencoded" -version = "1.0.0" +version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ece68d15c92e84fa4f19d3780f1294e5ca82a78a6d515f1efaabcc144688be00" +checksum = "5fc25a87fa4fd2094bffb06925852034d90a17f0d1e05197d4956d3555752191" dependencies = [ "matches", "percent-encoding", @@ -111,78 +132,48 @@ dependencies = [ [[package]] name = "futures-channel" -version = "0.3.12" +version = "0.3.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f2d31b7ec7efab6eefc7c57233bb10b847986139d88cc2f5a02a1ae6871a1846" +checksum = "c3083ce4b914124575708913bca19bfe887522d6e2e6d0952943f5eac4a74010" dependencies = [ "futures-core", ] [[package]] name = "futures-core" -version = "0.3.12" +version = "0.3.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "79e5145dde8da7d1b3892dad07a9c98fc04bc39892b1ecc9692cf53e2b780a65" - -[[package]] -name = "futures-macro" -version = "0.3.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c287d25add322d9f9abdcdc5927ca398917996600182178774032e9f8258fedd" -dependencies = [ - "proc-macro-hack", - "proc-macro2", - "quote", - "syn", -] +checksum = "0c09fd04b7e4073ac7156a9539b57a484a8ea920f79c7c675d05d289ab6110d3" [[package]] name = "futures-sink" -version = "0.3.12" +version = "0.3.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "caf5c69029bda2e743fddd0582d1083951d65cc9539aebf8812f36c3491342d6" +checksum = "21163e139fa306126e6eedaf49ecdb4588f939600f0b1e770f4205ee4b7fa868" [[package]] name = "futures-task" -version = "0.3.12" +version = "0.3.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "13de07eb8ea81ae445aca7b69f5f7bf15d7bf4912d8ca37d6645c77ae8a58d86" -dependencies = [ - "once_cell", -] +checksum = "57c66a976bf5909d801bbef33416c41372779507e7a6b3a5e25e4749c58f776a" [[package]] name = "futures-util" -version = "0.3.12" +version = "0.3.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "632a8cd0f2a4b3fdea1657f08bde063848c3bd00f9bbf6e256b8be78802e624b" +checksum = "d8b7abd5d659d9b90c8cba917f6ec750a74e2dc23902ef9cd4cc8c8b22e6036a" dependencies = [ "futures-core", - "futures-macro", "futures-task", "pin-project-lite", "pin-utils", - "proc-macro-hack", - "proc-macro-nested", - "slab", -] - -[[package]] -name = "getrandom" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c9495705279e7140bf035dde1f6e750c162df8b625267cd52cc44e0b156732c8" -dependencies = [ - "cfg-if", - "libc", - "wasi", ] [[package]] name = "h2" -version = "0.3.0" +version = "0.3.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6b67e66362108efccd8ac053abafc8b7a8d86a37e6e48fc4f6f7485eb5e9e6a5" +checksum = "37a82c6d637fc9515a4694bbf1cb2457b79d81ce52b3108bdeea58b07dd34a57" dependencies = [ "bytes", "fnv", @@ -195,18 +186,17 @@ dependencies = [ "tokio", "tokio-util", "tracing", - "tracing-futures", ] [[package]] name = "hashbrown" -version = "0.9.1" +version = "0.11.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d7afe4a420e3fe79967a00898cc1f4db7c8a49a9333a29f8a4bd76a253d5cd04" +checksum = "ab5ef0d4909ef3724cc8cce6ccc8572c5c817592e9285f5464f8e86f8bd3726e" [[package]] name = "hentaihavenrs" -version = "0.1.1" +version = "0.1.2" dependencies = [ "clap", "quick-xml", @@ -218,9 +208,9 @@ dependencies = [ [[package]] name = "http" -version = "0.2.3" +version = "0.2.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7245cd7449cc792608c3c8a9eaf69bd4eabbabf802713748fd739c98b82f0747" +checksum = "ff8670570af52249509a86f5e3e18a08c60b177071826898fde8997cf5f6bfbb" dependencies = [ "bytes", "fnv", @@ -229,31 +219,32 @@ dependencies = [ [[package]] name = "http-body" -version = "0.4.0" +version = "0.4.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2861bd27ee074e5ee891e8b539837a9430012e249d7f0ca2d795650f579c1994" +checksum = "1ff4f84919677303da5f147645dbea6b1881f368d03ac84e1dc09031ebd7b2c6" dependencies = [ "bytes", "http", + "pin-project-lite", ] [[package]] name = "httparse" -version = "1.3.5" +version = "1.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "615caabe2c3160b313d52ccc905335f4ed5f10881dd63dc5699d47e90be85691" +checksum = "496ce29bb5a52785b44e0f7ca2847ae0bb839c9bd28f69acac9b99d461c0c04c" [[package]] name = "httpdate" -version = "0.3.2" +version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "494b4d60369511e7dea41cf646832512a94e542f68bb9c49e54518e0f468eb47" +checksum = "c4a1e36c821dbe04574f602848a19f742f4fb3c98d40449f11bcad18d6b17421" [[package]] name = "hyper" -version = "0.14.4" +version = "0.14.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e8e946c2b1349055e0b72ae281b238baf1a3ea7307c7e9f9d64673bdd9c26ac7" +checksum = "b26ae0a80afebe130861d90abf98e3814a4f28a4c6ffeb5ab8ebb2be311e0ef2" dependencies = [ "bytes", "futures-channel", @@ -265,7 +256,7 @@ dependencies = [ "httparse", "httpdate", "itoa", - "pin-project 1.0.5", + "pin-project-lite", "socket2", "tokio", "tower-service", @@ -275,17 +266,15 @@ dependencies = [ [[package]] name = "hyper-rustls" -version = "0.22.1" +version = "0.23.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5f9f7a97316d44c0af9b0301e65010573a853a9fc97046d7331d7f6bc0fd5a64" +checksum = "d87c48c02e0dc5e3b849a2041db3029fd066650f8f717c07bf8ed78ccb895cac" dependencies = [ - "futures-util", + "http", "hyper", - "log", "rustls", "tokio", "tokio-rustls", - "webpki", ] [[package]] @@ -303,9 +292,9 @@ dependencies = [ [[package]] name = "idna" -version = "0.2.1" +version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "de910d521f7cc3135c4de8db1cb910e0b5ed1dc6f57c381cd07e8e661ce10094" +checksum = "418a0a6fab821475f634efe3ccc45c013f742efe03d853e8d3355d5cb850ecf8" dependencies = [ "matches", "unicode-bidi", @@ -314,31 +303,40 @@ dependencies = [ [[package]] name = "indexmap" -version = "1.6.1" +version = "1.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4fb1fa934250de4de8aef298d81c729a7d33d8c239daa3a7575e6b92bfc7313b" +checksum = "0f647032dfaa1f8b6dc29bd3edb7bbef4861b8b8007ebb118d6db284fd59f6ee" dependencies = [ "autocfg", "hashbrown", ] [[package]] -name = "ipnet" -version = "2.3.0" +name = "instant" +version = "0.1.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "47be2f14c678be2fdcab04ab1171db51b2762ce6f0a8ee87c8dd4a04ed216135" +checksum = "7a5bbe824c507c5da5956355e86a746d82e0e1464f65d862cc5e71da70e94b2c" +dependencies = [ + "cfg-if", +] + +[[package]] +name = "ipnet" +version = "2.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "879d54834c8c76457ef4293a689b2a8c59b076067ad77b15efafbb05f92a592b" [[package]] name = "itoa" -version = "0.4.7" +version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dd25036021b0de88a0aff6b850051563c6516d0bf53f8638938edbb9de732736" +checksum = "1aab8fc367588b89dcee83ab0fd66b72b50b72fa1904d7095045ace2b0c81c35" [[package]] name = "js-sys" -version = "0.3.47" +version = "0.3.57" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5cfb73131c35423a367daf8cbd24100af0d077668c8c2943f0e7dd775fef0f65" +checksum = "671a26f820db17c2a2750743f1dd03bafd15b98c9f30c7c2628c024c05d73397" dependencies = [ "wasm-bindgen", ] @@ -351,30 +349,30 @@ checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" [[package]] name = "libc" -version = "0.2.86" +version = "0.2.125" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b7282d924be3275cec7f6756ff4121987bc6481325397dde6ba3e7802b1a8b1c" +checksum = "5916d2ae698f6de9bfb891ad7a8d65c09d232dc58cc4ac433c7da3b2fd84bc2b" [[package]] name = "log" -version = "0.4.14" +version = "0.4.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "51b9bbe6c47d51fc3e1a9b945965946b4c44142ab8792c50835a980d362c2710" +checksum = "6389c490849ff5bc16be905ae24bc913a9c8892e19b2341dbc175e14c341c2b8" dependencies = [ "cfg-if", ] [[package]] name = "matches" -version = "0.1.8" +version = "0.1.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ffc5c5338469d4d3ea17d269fa8ea3512ad247247c30bd2df69e68309ed0a08" +checksum = "a3e378b66a060d48947b590737b30a1be76706c8dd7b8ba0f2fe3989c68a853f" [[package]] name = "memchr" -version = "2.3.4" +version = "2.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0ee1c47aaa256ecabcaea351eae4a9b01ef39ed810004e298d2511ed284b1525" +checksum = "308cc39be01b73d0d18f82a0e7b2a3df85245f84af96fdddc5d202d27e47b86a" [[package]] name = "mime" @@ -384,9 +382,9 @@ checksum = "2a60c7ce501c71e03a9c9c0d35b861413ae925bd979cc7a4e30d060069aaac8d" [[package]] name = "mime_guess" -version = "2.0.3" +version = "2.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2684d4c2e97d99848d30b324b00c8fcc7e5c897b7cbb5819b09e7c90e8baf212" +checksum = "4192263c238a5f0d0c6bfd21f336a313a4ce1c450542449ca191bb657b4642ef" dependencies = [ "mime", "unicase", @@ -394,32 +392,32 @@ dependencies = [ [[package]] name = "mio" -version = "0.7.7" +version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e50ae3f04d169fcc9bde0b547d1c205219b7157e07ded9c5aff03e0637cb3ed7" +checksum = "52da4364ffb0e4fe33a9841a98a3f3014fb964045ce4f7a45a398243c8d6b0c9" dependencies = [ "libc", "log", "miow", "ntapi", + "wasi", "winapi", ] [[package]] name = "miow" -version = "0.3.6" +version = "0.3.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5a33c1b55807fbed163481b5ba66db4b2fa6cde694a5027be10fb724206c5897" +checksum = "b9f1c5b025cda876f66ef43a113f91ebc9f4ccef34843000e0adf6ebbab84e21" dependencies = [ - "socket2", "winapi", ] [[package]] name = "native-tls" -version = "0.2.7" +version = "0.2.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b8d96b2e1c8da3957d58100b09f102c6d9cfdfced01b7ec5a8974044bb09dbd4" +checksum = "fd7e2f3618557f980e0b17e8856252eee3c97fa12c54dff0ca290fb6266ca4a9" dependencies = [ "lazy_static", "libc", @@ -435,44 +433,44 @@ dependencies = [ [[package]] name = "ntapi" -version = "0.3.6" +version = "0.3.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3f6bb902e437b6d86e03cce10a7e2af662292c5dfef23b65899ea3ac9354ad44" +checksum = "c28774a7fd2fbb4f0babd8237ce554b73af68021b5f695a3cebd6c59bac0980f" dependencies = [ "winapi", ] [[package]] name = "once_cell" -version = "1.5.2" +version = "1.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "13bd41f508810a131401606d54ac32a467c97172d74ba7662562ebba5ad07fa0" +checksum = "87f3e037eac156d1775da914196f0f37741a274155e34a0b7e427c35d2a2ecb9" [[package]] name = "openssl" -version = "0.10.32" +version = "0.10.38" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "038d43985d1ddca7a9900630d8cd031b56e4794eecc2e9ea39dd17aa04399a70" +checksum = "0c7ae222234c30df141154f159066c5093ff73b63204dcda7121eb082fc56a95" dependencies = [ "bitflags", "cfg-if", "foreign-types", - "lazy_static", "libc", + "once_cell", "openssl-sys", ] [[package]] name = "openssl-probe" -version = "0.1.2" +version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "77af24da69f9d9341038eba93a073b1fdaaa1b788221b00a69bce9e762cb32de" +checksum = "ff011a302c396a5197692431fc1948019154afc178baf7d8e37367442a4601cf" [[package]] name = "openssl-sys" -version = "0.9.60" +version = "0.9.72" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "921fc71883267538946025deffb622905ecad223c28efbfdef9bb59a0175f3e6" +checksum = "7e46109c383602735fa0a2e48dd2b7c892b048e1bf69e5c3b1d804b7d9c203cb" dependencies = [ "autocfg", "cc", @@ -481,57 +479,23 @@ dependencies = [ "vcpkg", ] +[[package]] +name = "os_str_bytes" +version = "6.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e22443d1643a904602595ba1cd8f7d896afe56d26712531c5ff73a15b2fbf64" + [[package]] name = "percent-encoding" version = "2.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d4fd5641d01c8f18a23da7b6fe29298ff4b55afcccdf78973b24cf3175fee32e" -[[package]] -name = "pin-project" -version = "0.4.27" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2ffbc8e94b38ea3d2d8ba92aea2983b503cd75d0888d75b86bb37970b5698e15" -dependencies = [ - "pin-project-internal 0.4.27", -] - -[[package]] -name = "pin-project" -version = "1.0.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "96fa8ebb90271c4477f144354485b8068bd8f6b78b428b01ba892ca26caf0b63" -dependencies = [ - "pin-project-internal 1.0.5", -] - -[[package]] -name = "pin-project-internal" -version = "0.4.27" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "65ad2ae56b6abe3a1ee25f15ee605bacadb9a764edaba9c2bf4103800d4a1895" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "pin-project-internal" -version = "1.0.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "758669ae3558c6f74bd2a18b41f7ac0b5a195aea6639d6a9b5e5d1ad5ba24c0b" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - [[package]] name = "pin-project-lite" -version = "0.2.4" +version = "0.2.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "439697af366c49a6d0a010c56a0d97685bc140ce0d377b13a2ea2aa42d64a827" +checksum = "e0a7ae3ac2f1173085d398531c705756c94a4c56843785df85a60c1a0afac116" [[package]] name = "pin-utils" @@ -541,100 +505,42 @@ checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" [[package]] name = "pkg-config" -version = "0.3.19" +version = "0.3.25" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3831453b3449ceb48b6d9c7ad7c96d5ea673e9b470a1dc578c2ce6521230884c" - -[[package]] -name = "ppv-lite86" -version = "0.2.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ac74c624d6b2d21f425f752262f42188365d7b8ff1aff74c82e45136510a4857" - -[[package]] -name = "proc-macro-hack" -version = "0.5.19" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dbf0c48bc1d91375ae5c3cd81e3722dff1abcf81a30960240640d223f59fe0e5" - -[[package]] -name = "proc-macro-nested" -version = "0.1.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bc881b2c22681370c6a780e47af9840ef841837bc98118431d4e1868bd0c1086" +checksum = "1df8c4ec4b0627e53bdf214615ad287367e482558cf84b109250b37464dc03ae" [[package]] name = "proc-macro2" -version = "1.0.24" +version = "1.0.37" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e0704ee1a7e00d7bb417d0770ea303c1bccbabf0ef1667dae92b5967f5f8a71" +checksum = "ec757218438d5fda206afc041538b2f6d889286160d649a86a24d37e1235afd1" dependencies = [ "unicode-xid", ] [[package]] name = "quick-xml" -version = "0.20.0" +version = "0.22.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "26aab6b48e2590e4a64d1ed808749ba06257882b461d01ca71baeb747074a6dd" +checksum = "8533f14c8382aaad0d592c812ac3b826162128b65662331e1127b45c3d18536b" dependencies = [ "memchr", ] [[package]] name = "quote" -version = "1.0.8" +version = "1.0.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "991431c3519a3f36861882da93630ce66b52918dcf1b8e2fd66b397fc96f28df" +checksum = "a1feb54ed693b93a84e14094943b84b7c4eae204c512b7ccb95ab0c66d278ad1" dependencies = [ "proc-macro2", ] -[[package]] -name = "rand" -version = "0.8.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0ef9e7e66b4468674bfcb0c81af8b7fa0bb154fa9f28eb840da5c447baeb8d7e" -dependencies = [ - "libc", - "rand_chacha", - "rand_core", - "rand_hc", -] - -[[package]] -name = "rand_chacha" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e12735cf05c9e10bf21534da50a147b924d555dc7a547c42e6bb2d5b6017ae0d" -dependencies = [ - "ppv-lite86", - "rand_core", -] - -[[package]] -name = "rand_core" -version = "0.6.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c026d7df8b298d90ccbbc5190bd04d85e159eaf5576caeacf8741da93ccbd2e5" -dependencies = [ - "getrandom", -] - -[[package]] -name = "rand_hc" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3190ef7066a446f2e7f42e239d161e905420ccab01eb967c9eb27d21b2322a73" -dependencies = [ - "rand_core", -] - [[package]] name = "redox_syscall" -version = "0.2.4" +version = "0.2.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "05ec8ca9416c5ea37062b502703cd7fcb207736bc294f6e0cf367ac6fc234570" +checksum = "62f25bc4c7e55e0b0b7a1d43fb893f4fa1361d0abe38b9ce4f323c2adfe6ef42" dependencies = [ "bitflags", ] @@ -650,15 +556,16 @@ dependencies = [ [[package]] name = "reqwest" -version = "0.11.0" +version = "0.11.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fd281b1030aa675fb90aa994d07187645bb3c8fc756ca766e7c3070b439de9de" +checksum = "46a1f7aa4f35e5e8b4160449f51afc758f0ce6454315a9fa7d0d113e958c41eb" dependencies = [ "base64", "bytes", "encoding_rs", "futures-core", "futures-util", + "h2", "http", "http-body", "hyper", @@ -674,7 +581,9 @@ dependencies = [ "percent-encoding", "pin-project-lite", "rustls", + "rustls-pemfile", "serde", + "serde_json", "serde_urlencoded", "tokio", "tokio-native-tls", @@ -704,11 +613,10 @@ dependencies = [ [[package]] name = "rustls" -version = "0.19.0" +version = "0.20.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "064fd21ff87c6e87ed4506e68beb42459caa4a0e2eb144932e6776768556980b" +checksum = "4fbfeb8d0ddb84706bc597a5574ab8912817c52a397f819e5b614e2265206921" dependencies = [ - "base64", "log", "ring", "sct", @@ -716,10 +624,19 @@ dependencies = [ ] [[package]] -name = "ryu" -version = "1.0.5" +name = "rustls-pemfile" +version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "71d301d4193d031abdd79ff7e3dd721168a9572ef3fe51a1517aba235bd8f86e" +checksum = "1ee86d63972a7c661d1536fefe8c3c8407321c3df668891286de28abcd087360" +dependencies = [ + "base64", +] + +[[package]] +name = "ryu" +version = "1.0.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "73b4b750c782965c211b42f022f59af1fbceabdd026623714f104152f1ec149f" [[package]] name = "schannel" @@ -733,9 +650,9 @@ dependencies = [ [[package]] name = "sct" -version = "0.6.0" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e3042af939fca8c3453b7af0f1c66e533a15a86169e39de2657310ade8f98d3c" +checksum = "d53dcdb7c9f8158937a7981b48accfd39a43af418591a5d008c7b22b5e1b7ca4" dependencies = [ "ring", "untrusted", @@ -743,9 +660,9 @@ dependencies = [ [[package]] name = "security-framework" -version = "2.0.0" +version = "2.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c1759c2e3c8580017a484a7ac56d3abc5a6c1feadf88db2f3633f12ae4268c69" +checksum = "2dc14f172faf8a0194a3aded622712b0de276821addc574fa54fc0a1167e10dc" dependencies = [ "bitflags", "core-foundation", @@ -756,9 +673,9 @@ dependencies = [ [[package]] name = "security-framework-sys" -version = "2.0.0" +version = "2.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f99b9d5e26d2a71633cc4f2ebae7cc9f874044e0c351a27e17892d76dce5678b" +checksum = "0160a13a177a45bfb43ce71c01580998474f556ad854dcbca936dd2841a5c556" dependencies = [ "core-foundation-sys", "libc", @@ -766,18 +683,18 @@ dependencies = [ [[package]] name = "serde" -version = "1.0.123" +version = "1.0.136" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "92d5161132722baa40d802cc70b15262b98258453e85e5d1d365c757c73869ae" +checksum = "ce31e24b01e1e524df96f1c2fdd054405f8d7376249a5110886fb4b658484789" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.123" +version = "1.0.136" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9391c295d64fc0abb2c556bad848f33cb8296276b1ad2677d1ae1ace4f258f31" +checksum = "08597e7152fcd306f41838ed3e37be9eaeed2b61c42e2117266a554fab4662f9" dependencies = [ "proc-macro2", "quote", @@ -786,9 +703,9 @@ dependencies = [ [[package]] name = "serde_json" -version = "1.0.62" +version = "1.0.79" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ea1c6153794552ea7cf7cf63b1231a25de00ec90db326ba6264440fa08e31486" +checksum = "8e8d9fa5c3b304765ce1fd9c4c8a3de2c8db365a5b91be52f186efc675681d95" dependencies = [ "itoa", "ryu", @@ -797,9 +714,9 @@ dependencies = [ [[package]] name = "serde_urlencoded" -version = "0.7.0" +version = "0.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "edfa57a7f8d9c1d260a549e7224100f6c43d43f9103e06dd8b4095a9b2b43ce9" +checksum = "d3491c14715ca2294c4d6a88f15e84739788c1d030eed8c110436aafdaa2f3fd" dependencies = [ "form_urlencoded", "itoa", @@ -809,17 +726,16 @@ dependencies = [ [[package]] name = "slab" -version = "0.4.2" +version = "0.4.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c111b5bd5695e56cffe5129854aa230b39c93a305372fdbb2668ca2394eea9f8" +checksum = "eb703cfe953bccee95685111adeedb76fabe4e97549a58d16f03ea7b9367bb32" [[package]] name = "socket2" -version = "0.3.19" +version = "0.4.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "122e570113d28d773067fab24266b66753f6ea915758651696b6e35e49f88d6e" +checksum = "66d72b759436ae32898a2af0a14218dbf55efde3feeb170eb623637db85ee1e0" dependencies = [ - "cfg-if", "libc", "winapi", ] @@ -832,9 +748,9 @@ checksum = "6e63cff320ae2c57904679ba7cb63280a3dc4613885beafb148ee7bf9aa9042d" [[package]] name = "syn" -version = "1.0.60" +version = "1.0.92" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c700597eca8a5a762beb35753ef6b94df201c81cca676604f547495a0d7f0081" +checksum = "7ff7c592601f11445996a06f8ad0c27f094a58857c2f89e97974ab9235b92c52" dependencies = [ "proc-macro2", "quote", @@ -843,13 +759,13 @@ dependencies = [ [[package]] name = "tempfile" -version = "3.2.0" +version = "3.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dac1c663cfc93810f88aed9b8941d48cabf856a1b111c29a40439018d870eb22" +checksum = "5cdb1ef4eaeeaddc8fbd371e5017057064af0911902ef36b39801f67cc6d79e4" dependencies = [ "cfg-if", + "fastrand", "libc", - "rand", "redox_syscall", "remove_dir_all", "winapi", @@ -857,18 +773,15 @@ dependencies = [ [[package]] name = "textwrap" -version = "0.11.0" +version = "0.15.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d326610f408c7a4eb6f51c37c330e496b08506c9457c9d34287ecc38809fb060" -dependencies = [ - "unicode-width", -] +checksum = "b1141d4d61095b28419e22cb0bbf02755f5e54e0526f97f1e3d1d160e60885fb" [[package]] name = "tinyvec" -version = "1.1.1" +version = "1.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "317cca572a0e89c3ce0ca1f1bdc9369547fe318a683418e42ac8f59d14701023" +checksum = "87cc5ceb3875bb20c2890005a4e226a4651264a5c75edb2421b52861a0a0cb50" dependencies = [ "tinyvec_macros", ] @@ -881,16 +794,18 @@ checksum = "cda74da7e1a664f795bb1f8a87ec406fb89a02522cf6e50620d016add6dbbf5c" [[package]] name = "tokio" -version = "1.2.0" +version = "1.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e8190d04c665ea9e6b6a0dc45523ade572c088d2e6566244c1122671dbf4ae3a" +checksum = "0f48b6d60512a392e34dbf7fd456249fd2de3c83669ab642e021903f4015185b" dependencies = [ - "autocfg", "bytes", "libc", "memchr", "mio", + "once_cell", "pin-project-lite", + "socket2", + "winapi", ] [[package]] @@ -905,9 +820,9 @@ dependencies = [ [[package]] name = "tokio-rustls" -version = "0.22.0" +version = "0.23.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bc6844de72e57df1980054b38be3a9f4702aba4858be64dd700181a8a6d0e1b6" +checksum = "4151fda0cf2798550ad0b34bcfc9b9dcc2a9d2471c895c68f3a8818e54f2389e" dependencies = [ "rustls", "tokio", @@ -916,16 +831,16 @@ dependencies = [ [[package]] name = "tokio-util" -version = "0.6.3" +version = "0.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ebb7cb2f00c5ae8df755b252306272cd1790d39728363936e01827e11f0b017b" +checksum = "0edfdeb067411dba2044da6d1cb2df793dd35add7888d73c16e3381ded401764" dependencies = [ "bytes", "futures-core", "futures-sink", - "log", "pin-project-lite", "tokio", + "tracing", ] [[package]] @@ -936,32 +851,34 @@ checksum = "360dfd1d6d30e05fda32ace2c8c70e9c0a9da713275777f5a4dbb8a1893930c6" [[package]] name = "tracing" -version = "0.1.23" +version = "0.1.34" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f7d40a22fd029e33300d8d89a5cc8ffce18bb7c587662f54629e94c9de5487f3" +checksum = "5d0ecdcb44a79f0fe9844f0c4f33a342cbcbb5117de8001e6ba0dc2351327d09" dependencies = [ "cfg-if", "pin-project-lite", + "tracing-attributes", "tracing-core", ] [[package]] -name = "tracing-core" -version = "0.1.17" +name = "tracing-attributes" +version = "0.1.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f50de3927f93d202783f4513cda820ab47ef17f624b03c096e86ef00c67e6b5f" +checksum = "cc6b8ad3567499f98a1db7a752b07a7c8c7c7c34c332ec00effb2b0027974b7c" dependencies = [ - "lazy_static", + "proc-macro2", + "quote", + "syn", ] [[package]] -name = "tracing-futures" -version = "0.2.4" +name = "tracing-core" +version = "0.1.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ab7bb6f14721aa00656086e9335d363c5c8747bae02ebe32ea2c7dece5689b4c" +checksum = "f54c8ca710e81886d498c2fd3331b56c93aa248d49de2222ad2742247c60072f" dependencies = [ - "pin-project 0.4.27", - "tracing", + "lazy_static", ] [[package]] @@ -981,33 +898,24 @@ dependencies = [ [[package]] name = "unicode-bidi" -version = "0.3.4" +version = "0.3.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "49f2bd0c6468a8230e1db229cff8029217cf623c767ea5d60bfbd42729ea54d5" -dependencies = [ - "matches", -] +checksum = "099b7128301d285f79ddd55b9a83d5e6b9e97c92e0ea0daebee7263e932de992" [[package]] name = "unicode-normalization" -version = "0.1.17" +version = "0.1.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "07fbfce1c8a97d547e8b5334978438d9d6ec8c20e38f56d4a4374d181493eaef" +checksum = "d54590932941a9e9266f0832deed84ebe1bf2e4c9e4a3554d393d18f5e854bf9" dependencies = [ "tinyvec", ] -[[package]] -name = "unicode-width" -version = "0.1.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9337591893a19b88d8d87f2cec1e73fad5cdfd10e5a6f349f498ad6ea2ffb1e3" - [[package]] name = "unicode-xid" -version = "0.2.1" +version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f7fe0bb3479651439c9112f72b6c505038574c9fbb575ed1bf3b797fa39dd564" +checksum = "8ccb82d61f80a663efe1f787a51b16b5a51e3314d6ac365b08639f52387b33f3" [[package]] name = "untrusted" @@ -1017,9 +925,9 @@ checksum = "a156c684c91ea7d62626509bce3cb4e1d9ed5c4d978f7b4352658f96a4c26b4a" [[package]] name = "url" -version = "2.2.0" +version = "2.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5909f2b0817350449ed73e8bcd81c8c3c8d9a7a5d8acba4b27db277f1868976e" +checksum = "a507c383b2d33b5fc35d1861e77e6b383d158b2da5e14fe51b83dfedf6fd578c" dependencies = [ "form_urlencoded", "idna", @@ -1029,15 +937,15 @@ dependencies = [ [[package]] name = "vcpkg" -version = "0.2.11" +version = "0.2.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b00bca6106a5e23f3eee943593759b7fcddb00554332e856d990c893966879fb" +checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426" [[package]] name = "version_check" -version = "0.9.2" +version = "0.9.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b5a972e5669d67ba988ce3dc826706fb0a8b01471c088cb0b6110b805cc36aed" +checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" [[package]] name = "want" @@ -1051,27 +959,25 @@ dependencies = [ [[package]] name = "wasi" -version = "0.10.2+wasi-snapshot-preview1" +version = "0.11.0+wasi-snapshot-preview1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fd6fbd9a79829dd1ad0cc20627bf1ed606756a7f77edff7b66b7064f9cb327c6" +checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" [[package]] name = "wasm-bindgen" -version = "0.2.70" +version = "0.2.80" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "55c0f7123de74f0dab9b7d00fd614e7b19349cd1e2f5252bbe9b1754b59433be" +checksum = "27370197c907c55e3f1a9fbe26f44e937fe6451368324e009cba39e139dc08ad" dependencies = [ "cfg-if", - "serde", - "serde_json", "wasm-bindgen-macro", ] [[package]] name = "wasm-bindgen-backend" -version = "0.2.70" +version = "0.2.80" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7bc45447f0d4573f3d65720f636bbcc3dd6ce920ed704670118650bcd47764c7" +checksum = "53e04185bfa3a779273da532f5025e33398409573f348985af9a1cbf3774d3f4" dependencies = [ "bumpalo", "lazy_static", @@ -1084,9 +990,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-futures" -version = "0.4.20" +version = "0.4.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3de431a2910c86679c34283a33f66f4e4abd7e0aec27b6669060148872aadf94" +checksum = "6f741de44b75e14c35df886aff5f1eb73aa114fa5d4d00dcd37b5e01259bf3b2" dependencies = [ "cfg-if", "js-sys", @@ -1096,9 +1002,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro" -version = "0.2.70" +version = "0.2.80" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3b8853882eef39593ad4174dd26fc9865a64e84026d223f63bb2c42affcbba2c" +checksum = "17cae7ff784d7e83a2fe7611cfe766ecf034111b49deb850a3dc7699c08251f5" dependencies = [ "quote", "wasm-bindgen-macro-support", @@ -1106,9 +1012,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.70" +version = "0.2.80" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4133b5e7f2a531fa413b3a1695e925038a05a71cf67e87dafa295cb645a01385" +checksum = "99ec0dc7a4756fffc231aab1b9f2f578d23cd391390ab27f952ae0c9b3ece20b" dependencies = [ "proc-macro2", "quote", @@ -1119,15 +1025,15 @@ dependencies = [ [[package]] name = "wasm-bindgen-shared" -version = "0.2.70" +version = "0.2.80" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dd4945e4943ae02d15c13962b38a5b1e81eadd4b71214eee75af64a4d6a4fd64" +checksum = "d554b7f530dee5964d9a9468d95c1f8b8acae4f282807e7d27d4b03099a46744" [[package]] name = "web-sys" -version = "0.3.47" +version = "0.3.57" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c40dc691fc48003eba817c38da7113c15698142da971298003cac3ef175680b3" +checksum = "7b17e741662c70c8bd24ac5c5b18de314a2c26c32bf8346ee1e6f53de919c283" dependencies = [ "js-sys", "wasm-bindgen", @@ -1135,9 +1041,9 @@ dependencies = [ [[package]] name = "webpki" -version = "0.21.4" +version = "0.22.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b8e38c0608262c46d4a56202ebabdeb094cef7e560ca7a226c6bf055188aa4ea" +checksum = "f095d78192e208183081cc07bc5515ef55216397af48b873e5edcd72637fa1bd" dependencies = [ "ring", "untrusted", @@ -1145,9 +1051,9 @@ dependencies = [ [[package]] name = "webpki-roots" -version = "0.21.0" +version = "0.22.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "82015b7e0b8bad8185994674a13a93306bea76cf5a16c5a181382fd3a5ec2376" +checksum = "44d8de8415c823c8abd270ad483c6feeac771fad964890779f9a8cb24fbbc1bf" dependencies = [ "webpki", ] @@ -1176,9 +1082,9 @@ checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" [[package]] name = "winreg" -version = "0.7.0" +version = "0.10.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0120db82e8a1e0b9fb3345a539c478767c0048d842860994d96113d5b667bd69" +checksum = "80d0f4e272c85def139476380b12f9ac60926689dd2e01d4923222f40580869d" dependencies = [ "winapi", ] diff --git a/Cargo.toml b/Cargo.toml index 1a10409..0287839 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "hentaihavenrs" -version = "0.1.1" +version = "0.1.2" authors = ["blank X "] edition = "2018" @@ -10,9 +10,9 @@ edition = "2018" lto = true [dependencies] -tokio = { version = "1.1", features = ["rt"] } +tokio = { version = "1.18", features = ["rt"] } reqwest = { version = "0.11", features = ["multipart", "rustls-tls"] } serde = { version = "1.0", features = ["derive"] } serde_json = "1.0" -quick-xml = "0.20" -clap = { version = "2.33", default-features = false } +quick-xml = "0.22" +clap = { version = "3.1", features = ["std"], default-features = false } diff --git a/src/commands/download.rs b/src/commands/download.rs index 5754f85..b623973 100644 --- a/src/commands/download.rs +++ b/src/commands/download.rs @@ -1,14 +1,14 @@ use crate::utils; +use clap::ArgMatches; +use std::fs::{create_dir, rename}; use std::io; -use std::fs::{rename, create_dir}; use std::path::PathBuf; use std::process::{exit, Command}; -use clap::ArgMatches; const MAX_DOWNLOAD_ATTEMPTS: i32 = 5; -pub async fn download(arg_m: &ArgMatches<'_>) { +pub async fn download(arg_m: &ArgMatches) { let print_only = arg_m.is_present("print"); let id = arg_m.value_of("id").unwrap(); let client = utils::create_client(); @@ -26,17 +26,21 @@ pub async fn download(arg_m: &ArgMatches<'_>) { if filename.exists() { continue; } - let download_url = match utils::get_url(tcloned_client.clone(), &episode_url).await { - Ok(Some(i)) => i, - Ok(None) => { - eprintln!("Failed to get {}: get_url returned None", filename.display()); - continue; - }, - Err(err) => { - eprintln!("Failed to get {}: {}", filename.display(), err); - continue; - } - }; + let download_url = + match utils::get_url(tcloned_client.clone(), &episode_url).await { + Ok(Some(i)) => i, + Ok(None) => { + eprintln!( + "Failed to get {}: get_url returned None", + filename.display() + ); + continue; + } + Err(err) => { + eprintln!("Failed to get {}: {}", filename.display(), err); + continue; + } + }; if print_only { println!("{}", download_url); continue; @@ -56,12 +60,17 @@ pub async fn download(arg_m: &ArgMatches<'_>) { for i in 0..MAX_DOWNLOAD_ATTEMPTS { eprintln!("Downloading {} (attempt {})", filename.display(), i); let mut command = Command::new("ffmpeg"); - let command = command.args(&["-v", "warning", "-stats", "-nostdin", "-y", "-i"]); + let command = + command.args(&["-v", "warning", "-stats", "-nostdin", "-y", "-i"]); let mut command = command.arg(&download_url.video); if let Some(ref captions) = download_url.captions { command = command.args(&["-i", &captions]); } - match command.args(&["-c", "copy", "-f", "matroska"]).arg(&tmp_filename).spawn() { + match command + .args(&["-c", "copy", "-f", "matroska"]) + .arg(&tmp_filename) + .spawn() + { Ok(mut child) => { match child.wait() { Ok(exit_status) => { @@ -69,16 +78,29 @@ pub async fn download(arg_m: &ArgMatches<'_>) { fail_dl = false; match rename(&tmp_filename, &filename) { Ok(_) => (), - Err(err) => eprintln!("Failed to rename {} to {} due to {}", tmp_filename.display(), filename.display(), err) + Err(err) => eprintln!( + "Failed to rename {} to {} due to {}", + tmp_filename.display(), + filename.display(), + err + ), }; break; } - eprintln!("ffmpeg exited with {:?}", exit_status.code()); - }, - Err(err) => eprintln!("Failed to wait on ffmpeg process due to {}", err) + eprintln!( + "ffmpeg exited with {:?}", + exit_status.code() + ); + } + Err(err) => eprintln!( + "Failed to wait on ffmpeg process due to {}", + err + ), }; - }, - Err(err) => eprintln!("Failed to spawn ffmpeg process due to {}", err) + } + Err(err) => { + eprintln!("Failed to spawn ffmpeg process due to {}", err) + } }; } if fail_dl { @@ -86,13 +108,13 @@ pub async fn download(arg_m: &ArgMatches<'_>) { return_fail = true; } } - }, + } None => { eprintln!("Failed to get {}: does not exist", id); return_fail = true; } }; - }, + } Err(err) => { eprintln!("Failed to get {}: {}", id, err); return_fail = true; diff --git a/src/commands/mod.rs b/src/commands/mod.rs index 249189a..778cad0 100644 --- a/src/commands/mod.rs +++ b/src/commands/mod.rs @@ -1,6 +1,6 @@ -mod view; -mod search; mod download; -pub use view::view; -pub use search::search; +mod search; +mod view; pub use download::download; +pub use search::search; +pub use view::view; diff --git a/src/commands/search.rs b/src/commands/search.rs index 84abcde..e146b56 100644 --- a/src/commands/search.rs +++ b/src/commands/search.rs @@ -1,10 +1,14 @@ use crate::utils; -use std::process::exit; use clap::ArgMatches; +use std::process::exit; -pub async fn search(arg_m: &ArgMatches<'_>) { - let query = arg_m.values_of("query").unwrap_or_default().collect::>().join(" "); +pub async fn search(arg_m: &ArgMatches) { + let query = arg_m + .values_of("query") + .unwrap_or_default() + .collect::>() + .join(" "); let query = query.trim(); let results = utils::search(utils::create_client(), query).await.unwrap(); if results.is_empty() { diff --git a/src/commands/view.rs b/src/commands/view.rs index 239cb6e..534d6d5 100644 --- a/src/commands/view.rs +++ b/src/commands/view.rs @@ -1,19 +1,24 @@ use crate::utils; -use std::process::exit; use clap::ArgMatches; +use std::process::exit; extern crate tokio; -pub async fn view(arg_m: &ArgMatches<'_>) { +pub async fn view(arg_m: &ArgMatches) { let client = utils::create_client(); - let handles = arg_m.values_of("id").unwrap().map(|id| { - let cloned_client = client.clone(); - let id = id.to_string(); - let cid = id.clone(); - (tokio::spawn(async move { - utils::get_hentai(cloned_client, &cid).await - }), id) - }).collect::>(); + let handles = arg_m + .values_of("id") + .unwrap() + .map(|id| { + let cloned_client = client.clone(); + let id = id.to_string(); + let cid = id.clone(); + ( + tokio::spawn(async move { utils::get_hentai(cloned_client, &cid).await }), + id, + ) + }) + .collect::>(); let mut fail = false; let mut one_done = false; for handle in handles { @@ -38,7 +43,7 @@ pub async fn view(arg_m: &ArgMatches<'_>) { println!(""); } println!("{}", &hentai); - }, + } None => { if one_done { eprintln!(""); @@ -47,7 +52,7 @@ pub async fn view(arg_m: &ArgMatches<'_>) { fail = true; } }; - }, + } Err(err) => { if one_done { eprintln!(""); diff --git a/src/main.rs b/src/main.rs index 8ee19bf..b66a73c 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,46 +1,40 @@ mod commands; mod structs; mod utils; -use clap::{App, AppSettings, Arg, SubCommand}; +use clap::{Arg, Command}; extern crate tokio; fn main() { - let matches = App::new("hentaihavenrs") + let matches = Command::new("hentaihavenrs") .about("hentaihaven.tv downloader in rust") .version(env!("CARGO_PKG_VERSION")) - .setting(AppSettings::SubcommandRequiredElseHelp) + .subcommand_required(true) .subcommand( - SubCommand::with_name("search") - .arg( - Arg::with_name("query") + Command::new("search").arg( + Arg::new("query") .takes_value(true) - .multiple(true) - .help("Search query") - ) + .multiple_values(true) + .help("Search query"), + ), ) .subcommand( - SubCommand::with_name("view") - .aliases(&["info", "show"]) - .arg( - Arg::with_name("id") + Command::new("view").visible_aliases(&["info", "show"]).arg( + Arg::new("id") .takes_value(true) - .multiple(true) - .required(true) - ) + .multiple_values(true) + .required(true), + ), ) .subcommand( - SubCommand::with_name("download") - .alias("dl") - .arg( - Arg::with_name("print") - .long("print") - .short("p") - .help("Print the URL to download only") - ).arg( - Arg::with_name("id") - .takes_value(true) - .required(true) - ) + Command::new("download") + .visible_alias("dl") + .arg( + Arg::new("print") + .long("print") + .short('p') + .help("Print the URL to download only"), + ) + .arg(Arg::new("id").takes_value(true).required(true)), ) .get_matches(); @@ -49,9 +43,9 @@ fn main() { .build() .unwrap(); match matches.subcommand() { - ("search", Some(sub_m)) => runtime.block_on(commands::search(sub_m)), - ("view", Some(sub_m)) => runtime.block_on(commands::view(sub_m)), - ("download", Some(sub_m)) => runtime.block_on(commands::download(sub_m)), - _ => panic!("AppSettings::SubcommandRequiredElseHelp do your job please") + Some(("search", sub_m)) => runtime.block_on(commands::search(sub_m)), + Some(("view", sub_m)) => runtime.block_on(commands::view(sub_m)), + Some(("download", sub_m)) => runtime.block_on(commands::download(sub_m)), + _ => unreachable!("subcommand_required do your job please"), }; } diff --git a/src/structs.rs b/src/structs.rs index 1c18d96..6dff6df 100644 --- a/src/structs.rs +++ b/src/structs.rs @@ -1,18 +1,18 @@ -use std::fmt; use serde::Deserialize; -extern crate reqwest; +use std::fmt; extern crate quick_xml; +extern crate reqwest; extern crate serde_json; #[derive(Deserialize, Debug)] pub struct SearchResult { pub id: i32, - pub title: RenderedTitle + pub title: RenderedTitle, } #[derive(Deserialize, Debug)] pub struct RenderedTitle { - pub rendered: String + pub rendered: String, } impl fmt::Display for SearchResult { @@ -30,18 +30,20 @@ pub struct HentaiInfo { pub genres: Vec, pub censored: bool, pub episode_urls: Vec, - pub summary: String + pub summary: String, } impl fmt::Display for HentaiInfo { fn fmt(&self, formatter: &mut fmt::Formatter<'_>) -> fmt::Result { - write!(formatter, "ID: {}\nTitle: {}\nViews: {}\nCensored: {}\nGenres: {}\nEpisodes: {}\nSummary:\n{}", + write!( + formatter, + "ID: {}\nTitle: {}\nViews: {}\nCensored: {}\nGenres: {}\nEpisodes: {}\nSummary:\n{}", &self.id, &self.title, self.views, match self.censored { true => "Yes", - false => "No" + false => "No", }, &self.genres.join(", "), self.episode_urls.len(), @@ -53,7 +55,7 @@ impl fmt::Display for HentaiInfo { #[derive(Debug)] pub struct HentaiVideo { pub captions: Option, - pub video: String + pub video: String, } impl fmt::Display for HentaiVideo { @@ -69,18 +71,18 @@ impl fmt::Display for HentaiVideo { #[derive(Deserialize, Debug)] pub struct RawHentaiVideo { - pub data: RawHentaiVideoData + pub data: RawHentaiVideoData, } #[derive(Deserialize, Debug)] pub struct RawHentaiVideoData { pub captions: RawHentaiVideoSrc, - pub sources: Vec + pub sources: Vec, } #[derive(Deserialize, Debug)] pub struct RawHentaiVideoSrc { - pub src: String + pub src: String, } #[derive(Debug)] @@ -113,12 +115,10 @@ impl From for Error { impl fmt::Display for Error { fn fmt(&self, formatter: &mut fmt::Formatter<'_>) -> fmt::Result { - formatter.write_str( - &match self { - Error::Reqwest(err) => format!("reqwest error: {}", err), - Error::QuickXML(err) => format!("quick-xml error: {}", err), - Error::SerdeJSON(err) => format!("serde_json error: {}", err), - } - ) + formatter.write_str(&match self { + Error::Reqwest(err) => format!("reqwest error: {}", err), + Error::QuickXML(err) => format!("quick-xml error: {}", err), + Error::SerdeJSON(err) => format!("serde_json error: {}", err), + }) } } diff --git a/src/utils.rs b/src/utils.rs index a323399..f00045e 100644 --- a/src/utils.rs +++ b/src/utils.rs @@ -1,34 +1,46 @@ use crate::structs; -use quick_xml::Reader; use quick_xml::events::Event; +use quick_xml::Reader; extern crate reqwest; extern crate serde_json; -pub async fn search(client: reqwest::Client, query: &str) -> Result, structs::Error> { - let text = &client.get("https://hentaihaven.xxx/wp-json/wp/v2/wp-manga") - .query(&[("search", &query)]) - .send() - .await? - .text() - .await?; +pub async fn search( + client: reqwest::Client, + query: &str, +) -> Result, structs::Error> { + let text = &client + .get("https://hentaihaven.xxx/wp-json/wp/v2/wp-manga") + .query(&[("search", &query)]) + .send() + .await? + .text() + .await?; let text = text.trim_start_matches("\u{feff}"); Ok(serde_json::from_str(&text)?) } -pub async fn get_hentai(client: reqwest::Client, id: &str) -> Result, structs::Error> { +pub async fn get_hentai( + client: reqwest::Client, + id: &str, +) -> Result, structs::Error> { let url = match id.contains(|c: char| !c.is_digit(10)) { true => format!("https://hentaihaven.xxx/watch/{}", &id), - false => format!("https://hentaihaven.xxx/?p={}", &id) + false => format!("https://hentaihaven.xxx/?p={}", &id), }; - let resp = client.get(&url) - .send() - .await?; + let resp = client.get(&url).send().await?; if resp.status() != 200 { return Ok(None); } let mut id = String::new(); - let slug = resp.url().path().trim_end_matches('/').rsplitn(2, '/').nth(0).unwrap().to_string(); + let slug = resp + .url() + .path() + .trim_end_matches('/') + .rsplitn(2, '/') + .nth(0) + .unwrap() + .to_string(); let text = resp.text().await?.replace(" ", " "); let mut reader = Reader::from_str(&text); reader.check_end_names(false); @@ -52,13 +64,10 @@ pub async fn get_hentai(client: reqwest::Client, id: &str) -> Result { if e.name() == b"div" { - let class = e.attributes() - .find(|i| { - match i.as_ref() { - Ok(i) => i.key == b"class", - Err(_) => false - } - }); + let class = e.attributes().find(|i| match i.as_ref() { + Ok(i) => i.key == b"class", + Err(_) => false, + }); if let Some(class) = class { match class.unwrap().unescape_and_decode_value(&reader) { Ok(class_name) => { @@ -69,80 +78,75 @@ pub async fn get_hentai(client: reqwest::Client, id: &str) -> Result is_inside_nav_links = true, "listing-chapters_wrap" => is_inside_chapter_list = true, "summary__content show-more" => is_inside_summary = true, - _ => () + _ => (), }; - }, - Err(_) => () + } + Err(_) => (), }; } } else if e.name() == b"a" { is_inside_a = true; if is_inside_nav_links { - let class = e.attributes() - .find(|i| { - match i.as_ref() { - Ok(i) => i.key == b"class", - Err(_) => false - } - }); + let class = e.attributes().find(|i| match i.as_ref() { + Ok(i) => i.key == b"class", + Err(_) => false, + }); if let Some(class) = class { match class.unwrap().unescape_and_decode_value(&reader) { Ok(class_name) => { - if class_name.to_lowercase().split_whitespace().any(|i| i == "uncensored") { + if class_name + .to_lowercase() + .split_whitespace() + .any(|i| i == "uncensored") + { censored = false; is_inside_nav_links = false; } - }, - Err(_) => () + } + Err(_) => (), }; } } else if is_inside_chapter_list { - let href = e.attributes() - .find(|i| { - match i.as_ref() { - Ok(i) => i.key == b"href", - Err(_) => false - } - }); + let href = e.attributes().find(|i| match i.as_ref() { + Ok(i) => i.key == b"href", + Err(_) => false, + }); if let Some(href) = href { match href.unwrap().unescape_and_decode_value(&reader) { Ok(href) => episode_urls.push(href), - Err(_) => () + Err(_) => (), }; } } else if id.is_empty() { - let data_post = e.attributes() - .find(|i| { - match i.as_ref() { - Ok(i) => i.key == b"data-post", - Err(_) => false - } - }); + let data_post = e.attributes().find(|i| match i.as_ref() { + Ok(i) => i.key == b"data-post", + Err(_) => false, + }); if let Some(data_post) = data_post { match data_post.unwrap().unescape_and_decode_value(&reader) { Ok(data_post) => id = data_post, - Err(_) => () + Err(_) => (), }; } } } - }, + } Ok(Event::Text(e)) => { let text = match e.unescape_and_decode(&reader) { Ok(text) => text, - Err(_) => continue + Err(_) => continue, }; if is_inside_summary_heading { match text.trim() { "Rank" => to_read_rank = true, "Genre(s)" => to_read_genres = true, - _ => () + _ => (), }; } else if is_inside_summary_content { if to_read_rank { match text.trim().splitn(2, " ").nth(0).unwrap().parse::() { Ok(i) => rank = i, - Err(_) => () + Err(_) => (), }; to_read_rank = false; } else if to_read_genres && is_inside_a { @@ -153,7 +157,7 @@ pub async fn get_hentai(client: reqwest::Client, id: &str) -> Result { if e.name() == b"div" { if is_inside_summary_heading { @@ -174,10 +178,10 @@ pub async fn get_hentai(client: reqwest::Client, id: &str) -> Result panic!("Error at position {}: {:?}", reader.buffer_position(), err), Ok(Event::Eof) => break, - _ => () + _ => (), }; buf.clear(); } @@ -194,14 +198,15 @@ pub async fn get_hentai(client: reqwest::Client, id: &str) -> Result Result, structs::Error> { - let resp = client.get(url) - .send() - .await?; +pub async fn get_url( + client: reqwest::Client, + url: &str, +) -> Result, structs::Error> { + let resp = client.get(url).send().await?; if resp.status() != 200 { return Ok(None); } @@ -213,40 +218,38 @@ pub async fn get_url(client: reqwest::Client, url: &str) -> Result { - let src = e.attributes() - .find(|i| { - match i.as_ref() { - Ok(i) => i.key == b"src", - Err(_) => false - } - }); + let src = e.attributes().find(|i| match i.as_ref() { + Ok(i) => i.key == b"src", + Err(_) => false, + }); if let Some(src) = src { match src.unwrap().unescape_and_decode_value(&reader) { Ok(src) => { iframe_url = Some(src); - break - }, - Err(_) => () + break; + } + Err(_) => (), }; } - }, + } Err(err) => panic!("Error at position {}: {:?}", reader.buffer_position(), err), Ok(Event::Eof) => break, - _ => () + _ => (), }; buf.clear(); } let iframe_url = match iframe_url { Some(tmp) => tmp, - None => return Ok(None) + None => return Ok(None), }; parse_iframe(client, &iframe_url).await } -async fn parse_iframe(client: reqwest::Client, url: &str) -> Result, structs::Error> { - let resp = client.get(url) - .send() - .await?; +async fn parse_iframe( + client: reqwest::Client, + url: &str, +) -> Result, structs::Error> { + let resp = client.get(url).send().await?; if resp.status() != 200 { return Ok(None); } @@ -261,36 +264,40 @@ async fn parse_iframe(client: reqwest::Client, url: &str) -> Result { let text = match reader.decode(e.escaped()) { Ok(text) => text, - Err(_) => continue + Err(_) => continue, }; for i in text.split('\n') { let i = i.trim(); if !i.starts_with("data.append('") { continue; } - let mut i = i.trim_start_matches("data.append('").trim_end_matches("');").splitn(2, "', '"); + let mut i = i + .trim_start_matches("data.append('") + .trim_end_matches("');") + .splitn(2, "', '"); let key = match i.next() { Some(i) => i, - None => continue + None => continue, }; let value = match i.next() { Some(i) => i, - None => continue + None => continue, }; form = form.text(key.to_string(), value.to_string()); form_modified = true; } - }, + } Err(err) => panic!("Error at position {}: {:?}", reader.buffer_position(), err), Ok(Event::Eof) => break, - _ => () + _ => (), }; buf.clear(); } if !form_modified { return Ok(None); } - let text = client.post("https://hentaihaven.xxx/wp-admin/admin-ajax.php") + let text = client + .post("https://hentaihaven.xxx/wp-admin/admin-ajax.php") .multipart(form) .send() .await? @@ -299,17 +306,23 @@ async fn parse_iframe(client: reqwest::Client, url: &str) -> Result Some(raw_data.captions.src), - _ => None + _ => None, }; let video_url = match raw_data.sources.get(0) { Some(i) => i.src.clone(), - None => return Ok(None) + None => return Ok(None), }; Ok(Some(structs::HentaiVideo { captions: captions, - video: video_url + video: video_url, })) }