There’s a web that checks if a text (in Catalan) has mistakes. I want to write a code to write a string into the textarea and get the response, but I don’t know how to do it.
That’s what I have until now:
import requests
from bs4 import BeautifulSoup
text_to_check = "Aixo es un text amb faltes"
response = requests.post("https://www.softcatala.org/corrector/", data={"text": text_to_check})
# Parse the HTML code
soup = BeautifulSoup(response.text, 'html.parser')
# Print the HTML code
#print(soup.prettify())
# Split the HTML code into a list of lines
lines = str(soup).split('\n')
# Iterate over the lines and print each line with the line number
#for i, line in enumerate(lines):
# Nline = f'{i+1}: {line}'
# print(Nline)
# --- search engine ----
for line in lines:
if 'text_to_check' in line:
print(line)
Could anyone check it and help me to do it? I also accept a JavaScript version, because my intention is make it work with IOS shortcuts.
Thanks