@@ -10,18 +10,39 @@ services used by Reverso is not available, though some are known.
1010They work and behave differently, so our main goal was to create
1111a unified and simple API, the responses of which would have a clear
1212structure and behavior.
13+
1314## Navigation
15+ - [ How to use this library] ( #How-to-use )
1416- [ Main components] ( #main-components )
1517 - [ Response] ( #response )
1618 - [ Language] ( #language )
1719- [ Usage] ( #usage )
1820 - [ Standart workfolw] ( #standard-workflow )
1921 - [ getVoiceStream] ( #getvoicestream )
22+ - [ getContext problems] ( #getcontext-problems )
2023- [ Response status] ( #response-status )
2124 - [ Success] ( #success )
2225 - [ Failure] ( #failure )
2326- [ Credits] ( #credits )
2427
28+ ## How to use
29+ ** Recently, the [ Context page] ( https://context.reverso.net/ ) started using Cloudflare
30+ protection. The solution to this was to use a third-party scraping API that
31+ utilizes a headless browser to bypass the protection (by executing JavaScript
32+ code on the page).**
33+
34+ Since ZenRows was chosen as the third-party API, follow these simple steps to use it:
35+
36+ Go to the [ website] ( https://www.zenrows.com/ ) and complete a simple registration.
37+ - Answer a few questions during the initial registration (this part can be skipped).
38+ - Obtain an API key as part of the free trial period.
39+ - Insert it into the already created apikey.properties file in the format:
40+ ` apiKey=yourKey `
41+ - Everything is ready to use!
42+
43+ P.S It is also worth mentioning that this key can be inserted into the constructor
44+ when creating a [ Reverso object] ( #usage ) . However, the first option is preferable.
45+
2546## Main components
2647### Response
2748Abstract class Response declares the common structure of all responses
@@ -58,6 +79,7 @@ public enum Language {
5879 ARABIC (" ar" , true , null ),
5980 GERMAN (" de" , true , null ),
6081 ENGLISH (" en" , true , " eng" ),
82+ ROMANIAN (" ro" , false , null )
6183}
6284```
6385Each object in this enumeration has fields that help determine whether
@@ -74,15 +96,18 @@ does not support the respective functionality.
7496For example:
7597``` java
7698JAPANESE (" ja" , true , null );
99+ ROMANIAN (" ro" , false , null );
77100```
78101
79- The third field is null, this means that ** spellCheck** are not available
80- for * japanese* language.
102+ <i > Japanese </i > – Synonym search and verb conjugation are available, but spell check is not. <br >
103+ <i >Romanian </i > – Only synonyms are available. Verb conjugation and spell check are not available.
104+ And so on.
81105
82106## Usage
83107The fundamental class, ** Reverso** , manages all interactions with the API.
84- First, we need to create an instance of this class.
85- ## Standard workflow
108+ First, we need to create an instance of this class. As mentioned above, the API key can also
109+ be added to the class constructor, although this is not mandatory.
110+ ### Standard workflow
86111To retrieve the necessary data, we must call one of the methods
87112of this class.
88113
@@ -126,7 +151,7 @@ Here's the output :
126151Most methods are very similar, some require two languages in their
127152arguments, such as the translation method, which is logical.
128153
129- ## getVoiceStream
154+ ### getVoiceStream
130155However, there is a method that differs slightly from the others:
131156
132157` VoiceResponse getVoiceStream(Voice voice, String sourceText) `
@@ -157,6 +182,13 @@ method, the *byte[] mp3Data* field is ignored. However, in this class, we
157182can also get this field as a Base64 string by invoking
158183the ` getAudioAsBase64() ` method.
159184
185+ ### getContext problems
186+
187+ Unfortunately, due to the use of a third-party API, the method may be unstable. The response
188+ time can take a while, which can sometimes be critical. This is because the API needs to process
189+ the request in a headless browser mode and execute the necessary JavaScripts, which has significantly
190+ slowed it down. Also, we cannot predict the state of the third-party API servers at the time of use.
191+
160192## Response status
161193Each response object has a ` boolean isOK ` field, along with a
162194corresponding getter method, which indicates the success of our
0 commit comments