Skip to main content

Command Palette

Search for a command to run...

Day 4/100 100 Days of code

Info Hunter

Updated
1 min read
Day 4/100 100 Days of code
C

AKA Chris, is a software developer from Athens, Greece. He started programming with basic when he was very young. He lost interest in programming during school years but after an unsuccessful career in audio, he decided focus on what he really loves which is technology.

He loves working with older languages like C and wants to start programming electronics and microcontrollers because he wants to get into embedded systems programming.

I spent most of the time making corrections because the Scraper class didn't work properly. It works now as it should but it only finds text that contains the keywords, not the whole page.

It still needs a lot of work. I am pretty happy with my progress so far. This is the code that I added:

//    Start scraping
    std::vector<std::string> scraperKeywords;

    for (int amount : urlCounterHolder)
    {
        std::cout << amount << std::endl;
        for (int j = 0; j < amount; j++)
        {
            std::cout << getSettingsKeywords[j] << std::endl;
            scraperKeywords.push_back(getSettingsKeywords[j]);
        }

        std::cout << getUrls[counter] << std::endl;

        Scraper scraper;
        scraper.SetupScraper(scraperKeywords, getUrls[counter]);
        AnalyzePages pageAnalyzer;

        // Get info from website
        cpr::Response r = scraper.request_info(scraper.baseURL);

        // Parse it
        std::vector<std::string> urls = scraper.ParseContent(r.text,
                                                             (char *) "href",
                                                             (char *) "/");

        // Iterate through them
        for (const std::string &item: urls) {
            std::cout << item << std::endl;
            pageAnalyzer.analyzeEntry(item, scraperKeywords, scraper);

        }

        counter++;
    }

I need to handle disconnections when the application runs and add an interface for the run option to inform the user what is going and give them the ability to stop the search if they want to.

100 Days of Code

Part 4 of 50

100 days of code is a good initiative to go into hard mode and spend more time in programming. These 100 days will be focused on completing projects and research.

Up next

Day 5/100 100 days of Code

Delivering Safe C++ - Bjarne Stroustrup - CppCon 2023