tmoitie / iRacing-week-planner

A weekly planner for iRacing
https://iracing-week-planner.tmo.lol
MIT License
94 stars 46 forks source link

scrapeData script is not working since iRacing added a recaptcha on login page #64

Closed gmourier closed 2 years ago

gmourier commented 3 years ago

I've unsuccessfuly tested to bypass the recaptcha by using randomly generated user agents with puppeteer-extra-plugin-stealth package. Some paid solutions exists but i don't think we are in the right scope for that.

The only way to populate data was to directly reach Series page by using setCookie in puppeteer after a successfull manual login.

Here is an example.


   const page = await browser.newPage();
   const seriesUrl = 'http://members.iracing.com/membersite/member/Series.do';
   const cookies = [{
    'url': seriesUrl,
    'name': 'irsso_membersv2',
    'value': 'XXX'
  }];
  await page.setCookie(...cookies);
  await page.goto(seriesUrl);
tmoitie commented 3 years ago

Weirdly I'm not seeing a captcha, although it's concerning if they plan on rolling it out to everyone. Given they've added a scraping endpoint in the latest build I had assumed that they wanted to facilitate this sort of thing.

I'm going to leave this issue open so people can see the work around if they get the issue, but for now my CI/CD tooling still seems to work so I'll leave the code as is.

gmourier commented 3 years ago

Weirdly in fact, i've just retested on master branch and it's ok for now. Giving some tests i've made we only need irsso_membersv2 as a cookie if a workaround is needed one day.

tmoitie commented 3 years ago

That's good news.

I think if I was them I would implement a captcha after a number of failed login attempts from a browser or IP address. You may have just been temporarily caught in one of those.

gmourier commented 3 years ago

You are right @tmoitie. I think i have triggered the recaptcha because of multiple failed attempts due to a missleading space char at the end of one of my env var dedicated to the script. That's good news for sure!