#include "Scraper.h" #include "../components/AsyncReqComponent.h" std::vector Scraper::getResults(ScraperSearchParams params) { std::shared_ptr req = makeHttpReq(params); while(req->status() == HttpReq::REQ_IN_PROGRESS); return parseReq(params, req); } void Scraper::getResultsAsync(ScraperSearchParams params, Window* window, std::function)> returnFunc) { std::shared_ptr httpreq = makeHttpReq(params); AsyncReqComponent* req = new AsyncReqComponent(window, httpreq, [this, params, returnFunc] (std::shared_ptr r) { returnFunc(parseReq(params, r)); }, [returnFunc] () { returnFunc(std::vector()); }); window->pushGui(req); }