A
A
ARCHY19902021-07-22 10:17:41
Python
ARCHY1990, 2021-07-22 10:17:41

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 occurs60f919c8d9bb5927281491.png

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()


Perhaps someone knows how to implement data entry without selenium? I will be very grateful for your help.

Answer the question

In order to leave comments, you need to log in

3 answer(s)
S
soremix, 2021-07-22
@ARCHY1990

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={}&regreg={}&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)

Z
Zolg, 2021-07-22
@Zolg

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?

G
galaxy, 2021-07-22
@galaxy

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

At public services, alerts also come perfectly through the Russian Post application. Why else is there a bot? Base of numbers with STS to collect?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question