Minor refactor
Change cli to grab version from the Cargo manifest Rename fetch_url to fetch_html
This commit is contained in:
parent
7e9dcfc2b7
commit
217cd3e442
3 changed files with 4 additions and 4 deletions
|
@ -8,7 +8,7 @@ pub fn cli_init() -> AppConfig {
|
|||
AppSettings::ArgRequiredElseHelp,
|
||||
AppSettings::UnifiedHelpMessage,
|
||||
])
|
||||
.version("0.3.0-alpha1")
|
||||
.version(clap::crate_version!())
|
||||
.about(
|
||||
"
|
||||
Paperoni is an article downloader.
|
||||
|
|
|
@ -7,7 +7,7 @@ use crate::{errors::ErrorKind, errors::PaperoniError, extractor::Extractor};
|
|||
|
||||
type HTMLResource = (String, String);
|
||||
|
||||
pub async fn fetch_url(url: &str) -> Result<HTMLResource, PaperoniError> {
|
||||
pub async fn fetch_html(url: &str) -> Result<HTMLResource, PaperoniError> {
|
||||
let client = surf::Client::new();
|
||||
println!("Fetching...");
|
||||
|
||||
|
|
|
@ -18,7 +18,7 @@ mod moz_readability;
|
|||
use cli::AppConfig;
|
||||
use epub::generate_epubs;
|
||||
use extractor::Extractor;
|
||||
use http::{download_images, fetch_url};
|
||||
use http::{download_images, fetch_html};
|
||||
|
||||
fn main() {
|
||||
let app_config = cli::cli_init();
|
||||
|
@ -30,7 +30,7 @@ fn main() {
|
|||
|
||||
fn download(app_config: AppConfig) {
|
||||
let articles = task::block_on(async {
|
||||
let urls_iter = app_config.urls().iter().map(|url| fetch_url(url));
|
||||
let urls_iter = app_config.urls().iter().map(|url| fetch_html(url));
|
||||
let mut responses = stream::from_iter(urls_iter).buffered(app_config.max_conn());
|
||||
let mut articles = Vec::new();
|
||||
while let Some(fetch_result) = responses.next().await {
|
||||
|
|
Reference in a new issue