pub async fn crawl_page_urls(
    client: &Client,
    board: &BoardName,
    range: &RangeInclusive<u32>,
) -> Result<Vec<String>, Error> {
    info!(
        "Start crawling URLs of articles from board {} page {} to {}",
        board,
        range.start(),
        range.end()
    );
    let mut article_urls: Vec<String> = vec![];
    let mut error: Error = Error::InvalidResponse;
    for page_num in range.clone() {
        let page_url = compose_page_url(&board, page_num);
        match crawl_one_page_urls(client, &page_url).await {
            Ok(mut urls) => article_urls.append(&mut urls),
            Err(e) => {
                error!("{:?} occurred when crawling {}", e, page_url);
                error = e;
            }
        };
    }

    info!(
        "Finish crawling URLs of articles from board {} page {} to {}",
        board,
        range.start(),
        range.end()
    );
    if article_urls.is_empty() {
        error!("No URL was found");
        return Err(error);
    }
    Ok(article_urls)
}
/// Given a board, crawls and returns the URLs of articles within range.
Given a board, crawls and returns the URLs of articles within range.
Given a board crawls and returns the URLs of articles within range .
pub async fn crawl_page_urls(
    client: &Client,
    board: &BoardName,
    range: &RangeInclusive<u32>,
) -> Result<Vec<String>, Error> {
    info!(
        "Start crawling URLs of articles from board {} page {} to {}",
        board,
        range.start(),
        range.end()
    );
    let mut article_urls: Vec<String> = vec![];
    let mut error: Error = Error::InvalidResponse;
    for page_num in range.clone() {
        let page_url = compose_page_url(&board, page_num);
        match crawl_one_page_urls(client, &page_url).await {
            Ok(mut urls) => article_urls.append(&mut urls),
            Err(e) => {
                error!("{:?} occurred when crawling {}", e, page_url);
                error = e;
            }
        };
    }
    info!(
        "Finish crawling URLs of articles from board {} page {} to {}",
        board,
        range.start(),
        range.end()
    );
    if article_urls.is_empty() {
        error!("No URL was found");
        return Err(error);
    }
    Ok(article_urls)
}
pub async fn crawl_page_urls ( client : & Client , board : & BoardName , range : & RangeInclusive < u32 > , ) -> Result < Vec < String > , Error > { info ! ( " " board range start ( ) range end ( ) ) ; let mut article_urls : Vec < String > = vec ! [ ] ; let mut error : Error = Error :: InvalidResponse ; for page_num in range . clone ( ) { let page_url = compose_page_url ( & board , page_num ) ; match crawl_one_page_urls ( client , & page_url ) . await { Ok ( mut urls ) => article_urls . append ( & mut urls ) , Err ( e ) => { error ! ( " " e page_url ) ; error = e ; } } ; } info ! ( " " board range start ( ) range end ( ) ) ; if article_urls . is_empty ( ) { error ! ( " " ) ; return Err ( error ) ; } Ok ( article_urls ) }
Given a board, crawls and returns the URLs of articles within range.
Given a board crawls and returns the URLs of articles within range .
client
&Client
board
&BoardName
range
&RangeInclusive<u32>