function retrieveNovelChapterLink(HTML, selector, row, retries){
    const $ = cheerio.load(HTML);

    pretty.logPrint("Retrieving chapter number and link...");

    try{

        // Get the 3rd TD element from each TR in the table; it's usually 
        // where the chapter link is located.
        let chapter_link = $($(selector).get(row)).attr("href");

        // Current implementation of hyperlinking in Novel Updates are // in before url
        // This will replace it, delete this when implementation changes
        chapter_link = chapter_link.replace("//www","https://www");

        // Get Chapter number (e.g. v1c1)
        let chapter_number = String($($(selector).get(row)).text());

        return { chapter: chapter_number, link: chapter_link };
    }catch(err){

        if(retries>0){
            
            errDict.getError(10);
            errDict.customError(err.message);
            pretty.logPrint(`Retrying to retrieve chapter link... (Retries left: ${retries-1})`);
            return retrieveNovelChapterLink(HTML,selector,retries-1);
        }
        else{
            errDict.getError(11);
            return null;
        }
    }

}
/**
 * Retrieves the chapter link of the novel.
 * 
 * @param {String} HTML The HTML body retrieved from the request package
 * @param {String} selector The set of string CSS selector for the chapter link
 * @param {Number} row The current row index in the table
 * @param {Number} retries This is the maximum number of retries till error gets thrown
 * 
 * @returns An object containing the link and the chapter number of the chapter, null if error or does not exist.
 */
Retrieves the chapter link of the novel.

@param {String} HTML The HTML body retrieved from the request package
@param {String} selector The set of string CSS selector for the chapter link
@param {Number} row The current row index in the table
@param {Number} retries This is the maximum number of retries till error gets thrown

@returns An object containing the link and the chapter number of the chapter, null if error or does not exist.
Retrieves the chapter link of the novel . @param { String } HTML The HTML body retrieved from the request package @param { String } selector The set of string CSS selector for the chapter link @param { Number } row The current row index in the table @param { Number } retries This is the maximum number of retries till error gets thrown @returns An object containing the link and the chapter number of the chapter null if error or does not exist .
function retrieveNovelChapterLink(HTML, selector, row, retries){
    const $ = cheerio.load(HTML);
    pretty.logPrint("Retrieving chapter number and link...");
    try{
        let chapter_link = $($(selector).get(row)).attr("href");
        chapter_link = chapter_link.replace("//www","https://www");
        let chapter_number = String($($(selector).get(row)).text());
        return { chapter: chapter_number, link: chapter_link };
    }catch(err){
        if(retries>0){
            errDict.getError(10);
            errDict.customError(err.message);
            pretty.logPrint(`Retrying to retrieve chapter link... (Retries left: ${retries-1})`);
            return retrieveNovelChapterLink(HTML,selector,retries-1);
        }
        else{
            errDict.getError(11);
            return null;
        }
    }
}
function retrieveNovelChapterLink ( HTML , selector , row , retries ) { const $ = cheerio . load ( HTML ) ; pretty . logPrint ( "Retrieving chapter number and link..." ) ; try { let chapter_link = $ ( $ ( selector ) . get ( row ) ) . attr ( "href" ) ; chapter_link = chapter_link . replace ( "//www" , "https://www" ) ; let chapter_number = String ( $ ( $ ( selector ) . get ( row ) ) . text ( ) ) ; return { chapter : chapter_number , link : chapter_link } ; } catch ( err ) { if ( retries > 0 ) { errDict . getError ( 10 ) ; errDict . customError ( err . message ) ; pretty . logPrint ( ` ${ retries - 1 } ` ) ; return retrieveNovelChapterLink ( HTML , selector , retries - 1 ) ; } else { errDict . getError ( 11 ) ; return null ; } } }
Retrieves the chapter link of the novel.
Retrieves the chapter link of the novel .
// Get the 3rd TD element from each TR in the table; it's usually  // where the chapter link is located. // Current implementation of hyperlinking in Novel Updates are // in before url // This will replace it, delete this when implementation changes // Get Chapter number (e.g. v1c1)