josejuniormoreira82 / QSnovo

0 stars 0 forks source link

Suggestions for adding file sending function through Telegram #1

Closed tankisstank closed 4 weeks ago

tankisstank commented 1 month ago

Greeting! First of all, I give you a very thanks for all your great work. Your project has been helped me a lot to pull data from quikstrike. And I want to suggest some functions, that you can sending file via Telegram instead of sending file through email, or have an option to do a semi bypass GCapcha, skip some sleep() time.

This is some of my work, hope can contribute a little to your great work.

Option to do a semi-automatic bypass GCapcha

  IsAutomationByPassCapcha = bool( os.getenv("AutomationByPassCapcha "))
  if IsAutomationByPassCapcha:
      solver = recaptchaV2Proxyless()
      solver.set_verbose(1)
      solver.set_key(anticaptcha_api_key)
      solver.set_website_url(link2)
      solver.set_website_key(chave_captcha)
      resposta = solver.solve_and_return_solution()

      if resposta != 0:
          print("resposta: " + resposta)
          # preencher o campo do token do captcha
          driver.execute_script(f"document.getElementById('g-recaptcha-response').innerHTML = '{resposta}'")
          driver.find_element(By.ID, 'btnContinue').click()
      else:
          print("task finished with error: " + solver.error_code)
      pass
  else:
      # Waiting user solve the capcha
      # get the submit button
      bt_submit = driver.find_element(By.ID, 'btnContinue')
      print ("Wait for the user to click the submit button")
      # wait for the user to click the submit button (check every 1s with a 1000s timeout)
      WebDriverWait(driver, timeout=1000, poll_frequency=1) \
        .until(EC.staleness_of(bt_submit))    
      print ("Submitted. Starting to crawling.")

Function to check stage of page is loading complete This function will help you to check the stage of page, and you don't need to sleep() anymore.

def page_is_loading(driver):

  while True:
      x = driver.execute_script("return document.readyState")
      print("Loading...")
      if x == "complete":
          return True
      else:
          yield False

To check the stage of tab load, you should check the refresh button

# Check stage tab load by verify the refresh button
WebDriverWait(driver, 10).until(EC.element_to_be_clickable((By.XPATH, '//*[@id="refreshButton"]')))
josejuniormoreira82 commented 1 month ago

Hello friend. Thank you very much for the suggestions. I'm learning Python. This is my first script. I'm fascinated by the possibilities that studying quantitative finance and Python can provide. I have a lot to learn in both studies.

I have some doubts about your suggestion.

You proposed bypassing the captcha and requested a key with the function os.getenv("AutomationByPassCapcha"). Is this a captcha service that you use?

And the last suggestion about "Check stage tab load" I didn't understand where to insert.

I'm having trouble automating the code in Github actions. The API doesn't solve the captcha. Did you test the script and did it work?

I really appreciate the suggestions and if you can help another newbie, I'd be happy.

Thank you.

tankisstank commented 1 month ago

@josejuniormoreira82 AutomationByPassCapcha is just a Boolean value (True, False), I set it to false to do manual click the I'm not a Robot check box. In my case, I set it to false, so the python automation will pause and wait for my action.

"Check stage tab load", is to detect the refresh circle is stop loading, mean it complete load the data.

tankisstank commented 1 month ago

And the last suggestion about "Check stage tab load" I didn't understand where to insert.

I'm having trouble automating the code in Github actions. The API doesn't solve the captcha. Did you test the script and did it work?

I really appreciate the suggestions and if you can help another newbie, I'd be happy.

Thank you.

I have to remove the double quote from your code


solver = recaptchaV2Proxyless()
solver.set_verbose(1)
solver.set_key(anticaptcha_api_key)
solver.set_website_url(link2)
solver.set_website_key(chave_captcha)
josejuniormoreira82 commented 1 month ago

Hi friend, I managed to adjust the code with your suggestions and the script turned out well.

I'm having trouble automating this routine on github with the scheduled library, in fact the error seems to be in the captcha response.

Do you have any suggestions?

tankisstank commented 4 weeks ago

I can help you, drop me a DM