Closed kjellberg closed 1 year ago
Would love to get some feedback on this commit. I really need it for my production server ASAP :)
@Athlon1600
This is not a bad idea but the implementation of it is what's bothering me. First of all, those query parameters keep changing every few months anyways. What gbv=1 means today, may not mean the same 3 months from now. And how is a person supposed to remember them all and what happens when they change? Code like this:
$google->setPreference('gbv', 1);
would break once Google replaces gbv with some other name or even splits the functionality into two variables. But if let's say you had:
$google->enableJavascript(false);
that would not break assuming you change the code inside "enableJavascript" function. But that would make it just as ugly. A MUCH BETTER solution would be to add a new "preference" named "query_params" that would let any user override any search param they want:
$override = array(
'q' => 'new_query',
'gbv' => 0
);
$google->setPreference('query_params', $override);
and this whole functionality could be added with just one line of code like this:
https://github.com/Athlon1600/SerpScraper/commit/abb71d547890e779c1690283802d55f3e5285507
Would this work?
Yeah, cool, you're absolutely right! And with your code its possible to add more query params (Y)
The most important thing for me was the possibility to change language.
Added the possibility to change more query string parameters