Closed MarceloBrazolim closed 3 years ago
I used a replace() function as a temporary fix that could avoid the recognition of the "&safe=" criteria.
const result = await google.scrape(query.replace(/&safe=/g, ""), 20)
This is just temporary tho, it's still recomended to find a definitive solution.
I feel ashamed to notice just now how easy the fix was -_- https://github.com/pevers/images-scraper/pull/67
Using "/search?q=${searchQuery}${this.safe}" gives the window for the final user to add "&safe=off" to the searchQuery disabling the google safe search feature, given that the google engine looks for the first defined criteria and ignores subsequent definitions of the same criteria.
I have tried to use "safe=active" before "search?q=" without success as it return a 404 error page or to the main google search page.
If anyone finds a good and reasonable clue of how to avoid this behavior, please reply to this issue.