dajk / hltv-api

DEPRECATED: An unofficial JSON api for popular CS:GO website hltv.org. Check available methods on https://hltv-api.vercel.app/
http://npm.im/hltv-api
MIT License
277 stars 59 forks source link

Question about api functionality #109

Open iGabyTM opened 1 year ago

iGabyTM commented 1 year ago

I'm trying to make a similar project, because I need it made with java and different data, but I can not get past cloudflare verification. I use selenium and chrome driver, with the following options:

private static final String USER_AGENT = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Safari/537.36";

final var options = new ChromeOptions();

if (headless) {
    options.addArguments("--headless");
}

options.addArguments(
        "--disable-blink-features=AutomationControlled",
        "--disable-geolocation",
        "--user-agent=" + USER_AGENT
);
options.setExperimentalOption("excludeSwitches", List.of("enable-automation"));
options.setCapability(CapabilityType.PLATFORM_NAME, Pkatform.WINDOWS);
final var driver = new ChromeDriver(options);
driver.executeScript("Object.defineProperty(navigator, 'webdriver', {get: () => undefined})");
driver.manage().window().maximize();
return driver;

I've looked at the code of your lib and I couldn't really find anything about hiding the webdriver, and yet your code works just fine xD The extra data I need is from https://www.hltv.org/betting/analytics/<match id>, I wonder if they have extra protection for that page, because the match page loads just fine.