- Перейдите на https://www.civitekflorida.com/ocrs/county/51/
- Примите отказ от ответственности
- Нажмите «Общедоступно»
- Перейти на вкладку поиска по обращениям
- 2024 год, CP для типа суда и 1 для номера последовательности.
- нажмите «Отправить»! (Мне не удается открыть ту же страницу ответа.)
from twocaptcha import TwoCaptcha
import re
from requests import Session
API_KEY = '2CAPTCHA_API_KEY'
headers = {
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:134.0) Gecko/20100101 Firefox/134.0',
}
def turnstile():
solver = TwoCaptcha(API_KEY)
return solver.turnstile('0x4AAAAAAAR0Af-5MfzdbO3p', 'https://www.civitekflorida.com/ocrs/app/search.xhtml')['code']
def main():
with Session() as client:
client.allow_redirects = True
client.headers.update(headers)
r = client.get('https://www.civitekflorida.com/ocrs/county/51/')
soup = LexborHTMLParser(r.content)
data = {
'javax.faces.partial.ajax': 'true',
'javax.faces.source': 'j_idt42:j_idt45',
'javax.faces.partial.execute': '@all',
'j_idt42:j_idt45': 'j_idt42:j_idt45',
'j_idt42': 'j_idt42',
'javax.faces.ViewState': soup.css_first('input[name$="ViewState"]').attrs['value']
}
r = client.post(
'https://www.civitekflorida.com/ocrs/cou ... ndex.xhtml', data=data)
r = client.get(
'https://www.civitekflorida.com/ocrs/cou ... imer.xhtml')
soup = LexborHTMLParser(r.content)
data = {
'javax.faces.partial.ajax': 'true',
'javax.faces.source': 'j_idt42:j_idt44',
'javax.faces.partial.execute': '@all',
'j_idt42:j_idt44': 'j_idt42:j_idt44',
'j_idt42': 'j_idt42',
'javax.faces.ViewState': soup.css_first('input[name$="ViewState"]').attrs['value']
}
r = client.post(
'https://www.civitekflorida.com/ocrs/cou ... imer.xhtml', data=data)
r = client.get('https://www.civitekflorida.com/ocrs/app/search.xhtml')
soup = LexborHTMLParser(r.content)
_id = soup.css('script[id^="form:j"][type]')[-1].attrs['id']
data = {
"cf-turnstile-response": turnstile(),
"form": "form",
"form:search_tab:businessname": "",
"form:search_tab:dob_input": "",
"form:search_tab:fname": "",
"form:search_tab:fromDate_input": "",
"form:search_tab:lastname": "",
"form:search_tab:ps_court_filter": "",
"form:search_tab:ssn": "",
"form:search_tab:toDate_input": "",
"form:search_tab_activeIndex": "1",
"form:search_tab_newTab": "form:search_tab:search_tab2",
"form:search_tab_tabindex": "1",
"javax.faces.ViewState": soup.css_first('input[name$="ViewState"]').attrs['value'],
"javax.faces.behavior.event": "tabChange",
"javax.faces.partial.ajax": "true",
"javax.faces.partial.event": "tabChange",
"javax.faces.partial.execute": "form:search_tab",
"javax.faces.partial.render": "form:search_tab",
"javax.faces.source": "form:search_tab",
"tab": "0"
}
r = client.post(
'https://www.civitekflorida.com/ocrs/app/search.xhtml', data=data)
javax = re.search('CDATA\[(.*?)]', r.text).group(1)
client.headers.update({
'accept': 'application/xml, text/xml, */*; q=0.01',
'accept-language': 'en-US,en;q=0.5',
'accept-encoding': 'gzip, deflate, br, zstd',
'content-type': 'application/x-www-form-urlencoded; charset=UTF-8',
'faces-request': 'partial/ajax',
'x-requested-with': 'XMLHttpRequest',
'origin': 'https://www.civitekflorida.com',
'Referer': 'https://www.civitekflorida.com/ocrs/app/search.xhtml',
'sec-fetch-dest': 'empty',
'sec-fetch-mode': 'cors',
'sec-fetch-site': 'same-origin',
'priority': 'u=0',
'te': 'trailers',
})
soup = LexborHTMLParser(r.content)
code = turnstile()
data = {
"cf-turnstile-response": code,
"form": "form",
_id: _id,
"form:search_tab:branchLoc": "%",
"form:search_tab:cs_court1_focus": "",
"form:search_tab:cs_court1_input": "CP",
"form:search_tab:partyIden": "%",
"form:search_tab:seq": "1",
"form:search_tab:year": "2024",
"form:search_tab_activeIndex": "1",
"javax.faces.ViewState": javax,
"javax.faces.partial.ajax": "true",
"javax.faces.partial.execute": "@all",
"javax.faces.partial.render": "form:search_tab",
"javax.faces.source": _id,
"tab": "1"
}
r = client.post(
'https://www.civitekflorida.com/ocrs/app/search.xhtml', data=data)
print(r.text)
if __name__ == "__main__":
main()
Подробнее здесь: https://stackoverflow.com/questions/793 ... aptcha-api