mirror of
https://github.com/Hopiu/lychee.git
synced 2026-05-01 02:14:53 +00:00
* Bump flake 1.83.0 -> 1.87.0 * Move archive functionality into lychee-lib * Create example, update name and docs * Split function & update tests * Remove trailing slashes in API calls & update tests * Apply lint suggestions * Rename function * Move module * Add cargo-nextest to devShell to support 'make test'
18 lines
487 B
Rust
18 lines
487 B
Rust
use lychee_lib::archive::Archive;
|
|
use std::{error::Error, time::Duration};
|
|
use url::Url;
|
|
|
|
#[tokio::main]
|
|
async fn main() -> Result<(), Box<dyn Error>> {
|
|
let archive = Archive::WaybackMachine;
|
|
let url = Url::parse("https://example.com")?;
|
|
let result = archive
|
|
.get_archive_snapshot(&url, Duration::from_secs(10))
|
|
.await?;
|
|
|
|
if let Some(replacement) = result {
|
|
println!("Good news! {} can be replaced with {}", url, replacement);
|
|
}
|
|
|
|
Ok(())
|
|
}
|