Closed zortos293 closed 3 years ago
It is currently not supported. But I'm open for pull requests.
A naive approach would be "clicking" the toggle in the mainscreen via the headless browser.
for a quick fix you could just add "&safe=active" in the searchQuery since there is no formating or treatment at line 42
for a future version it could be solved with this (I already tested and it works just fine):
constructor({
safe = false,
} = {}) {
this.safe = this._isQuerySafe(safe);
}
_isQuerySafe(safe) {
if (safe === true) {
return '&safe=active';
} else return '';
}
async scrape(searchQuery, limit = 100) {
const query = `https://www.google.com/search?q=${searchQuery}&source=lnms&tbm=isch${this.safe}&sa=X&tbs=${this.tbs}`;
}
also, why is there a "Logger.info()" below the definition of the query variable? it just floods my console since i like to use a customized console and it ruins the flow :v
for a quick fix you could just add "&safe=active" in the searchQuery since there is no formating or treatment at line 42
I already made a pull request with these alterations.
for a future version it could be solved with this (I already tested and it works just fine):
constructor({ safe = false, } = {}) { this.safe = this._isQuerySafe(safe); } _isQuerySafe(safe) { if (safe === true) { return '&safe=active'; } else return ''; } async scrape(searchQuery, limit = 100) { const query = `https://www.google.com/search?q=${searchQuery}&source=lnms&tbm=isch${this.safe}&sa=X&tbs=${this.tbs}`; }
Thanks! This indeed solves it! I've merged it and I'll create a new release.
also, why is there a "Logger.info()" below the definition of the query variable? it just floods my console since i like to use a customized console and it ruins the flow :v
This is a mistake. I'll fix it. Thanks for reporting
I'm closing this. Feature added in 6.1
i want to turn of nsfw content so that it doesn't popup on discord how can i do that