MarioVilas / googlesearch

Google search from Python (unofficial).
BSD 3-Clause "New" or "Revised" License
1.14k stars 390 forks source link

Unable to use custom date ranges #73

Closed tobinsouth closed 5 years ago

tobinsouth commented 5 years ago

The tbs parameter doesn't work with custom date ranges.

tbs has no effect when you input

cdr%3A1%2Ccd_min%3A1%2F1%2F2019%2Ccd_max%3A2%2F1%2F2019 or cdr:1,cd_min:01/01/2019,cd_max:02/01/2019

It just returns the default results. These strings work when entered directly into the google url via Chrome. I've been mainly trying to get this to work for the search_news function, but the issue applies to everything.

Thanks

tobinsouth commented 5 years ago

This is solved by using a better user agent as discussed in issue #72.

Using a random user agent from fake-useragent seems to work. However this can only be passed into the search function and any other search types much be manually set.