feat: crawler scaffold with chromium launcher (0.22.0)
- crawler module (browser, source trait, jobs, diff) + binary - chromiumoxide launcher with fetcher feature (auto-downloads Chromium on first run, caches under ~/.cache/mangalord/chromium) - LaunchOptions struct with extra_args, parseable from CRAWLER_BROWSER_MODE and CRAWLER_BROWSER_ARGS - migration 0012 introduces sources, manga_sources, chapter_sources, crawler_jobs - integration tests for headed + headless launch, ipify load+parse, and extra-args propagation (all #[ignore], opt-in)
This commit is contained in:
29
backend/src/bin/crawler.rs
Normal file
29
backend/src/bin/crawler.rs
Normal file
@@ -0,0 +1,29 @@
|
||||
//! Crawler binary.
|
||||
//!
|
||||
//! Today: a thin shell that launches Chromium via the shared
|
||||
//! `crawler::browser` module and exits. Useful as an ad-hoc smoke test
|
||||
//! for the launcher in addition to the integration test in
|
||||
//! `tests/crawler_browser_smoke.rs`.
|
||||
//!
|
||||
//! Future: reads config, picks `Source` impls, runs the job loop.
|
||||
|
||||
use mangalord::crawler::browser::{self, LaunchOptions};
|
||||
use tracing_subscriber::EnvFilter;
|
||||
|
||||
#[tokio::main]
|
||||
async fn main() -> anyhow::Result<()> {
|
||||
dotenvy::dotenv().ok();
|
||||
tracing_subscriber::fmt()
|
||||
.with_env_filter(
|
||||
EnvFilter::try_from_default_env()
|
||||
.unwrap_or_else(|_| "info,mangalord=debug".into()),
|
||||
)
|
||||
.init();
|
||||
|
||||
let options = LaunchOptions::from_env();
|
||||
tracing::info!(?options, "launching browser");
|
||||
let handle = browser::launch(options).await?;
|
||||
tracing::info!("browser launched; closing");
|
||||
handle.close().await?;
|
||||
Ok(())
|
||||
}
|
||||
Reference in New Issue
Block a user