GHC 2019-05-24

12 comments.

, https://git.io/fjBaG in jarun/googler
Pushed to master. Might need to issue a patch release.

Thanks @mmblz for the report and investigation.

Notes to @jarun and self:

- Shell completion scripts haven't been updated in quite a while.
- I need to fix the CI tests to catch mark no results as failure on known good queries.

, https://git.io/fjB2W in zmwangx/chocolatey-googler
I'm primarily a macOS user and only use Windows sparingly, so I don't presume to know much about Windows, but I don't think Git for Windows (where your bash comes from) bundles Python 3. Any reason you can't use googler in cmd or PowerShell?

There's also [Windows Subsystem for Linux](https://docs.microsoft.com/en-us/windows/wsl/install-win10) which is a full Linux experience on top of Windows 10, although that falls outside the scope of the Chocolatey package.

, https://git.io/fjBuA in jarun/googler
Oh by the way I need to take care of something else too so expect the patch in 1-2 hours.

, https://git.io/fjBux in jarun/googler
Sure.

, https://git.io/fjBup in jarun/googler
> can you please raise a PR with the above changes?

Or I could do it (not trying to take credit, I'm just more efficient since I probably know the code better and know what to change/remove immediately). If you want to be officially recognized for the contribution then go for it.

, https://git.io/fjBuh in jarun/googler
What about `googler/3.8 (like MSIE)`? (I might be one of the few people who want the UA to mean something.)

While we're at it, `--noua` option should be removed (or made a noop and emit a deprecation warning, your call). Disabling user agent is no longer a reliable way to get the classic layout. The `ua` global variable should go, too, thank god it's been a thorn in my eyes.

, https://git.io/fjBuj in jarun/googler
I'm pretty sure user agent is key here; it's not the first time we dealt with layout problems. 

> Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0)

Is that IE7? I don't have intermittent problems with that UA, but it could be dumb luck, I don't know if Google is supposed to recognize that. But, I'm fairly sure if you use a modern user agent like `Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:68.0) Gecko/20100101 Firefox/68.0`, you're guaranteed to get the modern desktop layout (note that the parser currently can't handle it), at the cost of stability (of the classic layout) and the possibility of being dragged into an A/B test any time.

, https://git.io/fjBuw in jarun/googler
Briefly tried `w3m/0.5.3` and still getting intermittent card results. If by "w3m is still working for me" you mean Google works inside w3m, then sure, they just show you the text; layout doesn't matter much.

One way out is finding a user agent that reliably produces the classic layout (IE8 maybe?). Another way out is use a know modern browser UA, and parse the modern desktop layout instead.

, https://git.io/fjBur in jarun/googler
> The card layout is complicated by the css apparently having been obfuscated.

This sure is annoying. All hail lack of namespacing of CSS and as a result crazy shit like this people resort to.

, https://git.io/fjBEh in jarun/googler
Update: I was consistently getting the classic layout when I first looked at the bug ten minutes ago. But now I'm getting the card layout almost every damn time... I suppose we can wait for 24 hours and see if the mobile layout just stops, but if not we definitely need to support the different layout.

I'm changing the title of this issue as it has nothing to do with `-j`.

, https://git.io/fjBEj in jarun/googler
Now that I look at the former image more closely, that's not even a desktop layout. I've only seen the every-result-in-a-card layout on mobile. Hopefully just an A/B test (they can't seriously think `googler/3.8` is the UA of a phone browser, can they?).

, https://git.io/fjBue in jarun/googler
This got nothing to do with the order of arguments. Google was sending you a different layout (~the~ a more modern layout instead of the classic one which we expect when using a non-browser UA `googler/3.8`). Just look at the two HTML files you attached in a browser, the difference is obvious:

<img width="1004" alt="Screen Shot 2019-05-24 at 9 34 08 AM" src="https://user-images.githubusercontent.com/4149852/58296767-9b7c5b80-7e07-11e9-8152-e666d0dc56ee.png">
<img width="1004" alt="Screen Shot 2019-05-24 at 9 34 11 AM" src="https://user-images.githubusercontent.com/4149852/58296768-a0d9a600-7e07-11e9-994f-d4c3d02bdcc4.png">

I can look into the failed case and see if our parser could support that one too, but sometimes Google does temporary A/B testing and stuff. I'm short on time recently, so please let me know if this is actually a persistent issue before I delve into it.