Answer the question
In order to leave comments, you need to log in
Parsing of the site GIBBD.RF. Checking for fines?
I want to write a telegram bot that will check whether a fine has come to me or not, if I receive a fine, to notify me about it. For these purposes, I decided to use selenium, but when filling, the cursor is set at the end of the line and no filling occurs
import time
from selenium import webdriver
driver = webdriver.Chrome('chromedriver.exe')
driver.get('https://гибдд.рф/check/fines#')
time.sleep(5)
driver.find_element_by_xpath('//*[@id="checkFinesRegnum"]').send_keys('В098РЕ')
driver.find_element_by_xpath('//*[@id="checkFinesRegreg"]').send_keys('126')
time.sleep(1)
driver.find_element_by_xpath('//*[@id="checkFinesStsnum"]').send_keys('56АВ999999')
time.sleep(5)
driver.find_element_by_xpath('//*[@id="checkFines"]/p[4]/a').click()
time.sleep(5)
driver.quit()
Answer the question
In order to leave comments, you need to log in
It is better to look for some kind of API, even on a paid basis, which provides the ability to receive fines. It seems that Yandex launched a service for paying fines a long time ago, maybe they have something, or look through public services, if possible.
Personally, the code works for me, but there is a captcha on the site, so I don’t think it will be possible to parse a lot. Alternatively, you can simply send requests via requests, but first you need to solve the captcha through some kind of captcha solving service, and insert the solution key into the captcha
import requests
regnum = 'В098РЕ'
regreg = '126'
stsnum = '56АВ999999'
captcha = ''
headers = {'User-Agent': 'Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/60.0.3112.90 Safari/537.36',}
data = 'regnum={}®reg={}&stsnum={}&reCaptchaToken={}'.format(regnum, regreg, stsnum, captcha).encode('utf-8')
r = requests.post('https://xn--b1afk4ade.xn--90adear.xn--p1ai/proxy/check/fines', data=data, headers=headers)
print(r.text)
Well, how, how - emulate a mouse / keyboard, OCR screen, or you can recognize it with a neural network.
There is, of course, the option to call https://service.gibbd.rf/proxy/check/fines directly, but this is for wimps, right?
Googlecaptcha than going to parse?
I want to write a telegram bot that will check whether a fine has come to me or not, if I receive a fine, to notify me about it
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question