Coder Social home page Coder Social logo

Comments (22)

jarun avatar jarun commented on May 20, 2024

Sorry, no plans at the time. We don't intend to bring all of Google's services to the cli.

from googler.

Phyks avatar Phyks commented on May 20, 2024

So no need to make a PR if I get something working?

from googler.

jarun avatar jarun commented on May 20, 2024

We have the ToDo list just for that.
Added @zmwangx for his opinion.

Are you interested in contributing to googler or just this feature?

from googler.

Phyks avatar Phyks commented on May 20, 2024

We have the ToDo list just for that.

I saw it, but there was nothing linked to this issue. And I thought it would deserve its own issue to ease discussion on this.

Are you interested in contributing to googler or just this feature?

Actually I had the idea of making Google Now features (not sure how to call them, the rectangle with parsed infos when you type some specific queries) available from the CLI. I looked up for similar script, and came across a very basic Ruby script, not updated anymore, and this Googler script which I did not know about. I thought it might be interesting to add such a feature, and was willing to write my own script. If I get something functional and you are interested in it, I was offering you to merge it in Googler.

from googler.

jarun avatar jarun commented on May 20, 2024

Actually I had the idea of making Google Now features

I'll leave it to you and @zmwangx.
Re-open the defect as you guys see fit.

from googler.

zmwangx avatar zmwangx commented on May 20, 2024

The box does many things. I don't think there's a generic way to parse it.

Just to give you a concrete example: calculator and unit converter are two entirely different things and will need two entirely different handlers.

So no need to make a PR if I get something working?

If you have something then please do raise a PR, but as you know, there's no guarantee that features will be merged — we really need to look at how well it works, how good the implementation is, etc.

from googler.

zmwangx avatar zmwangx commented on May 20, 2024

By the way, half related, WolframAlpha is much better for this purpose, and they have an API. I personally wouldn't recommend wasting time on this.

from googler.

Phyks avatar Phyks commented on May 20, 2024

Hmm, I have something which is working fine for calculations (calculations with or without units) and for unit conversion.

It extracts weather as well, and it's just a matter of formatting to render it nicely (using lynx at the moment).

It does not work yet for cities / countries / people.

These are all the queries I can think of at the moment.

I know about wolfram alpha, but it only works in English (whereas Google handles French as well) and results are not comparable with Google for weather forecasts for example.

from googler.

zmwangx avatar zmwangx commented on May 20, 2024

You could raise a PR with what you have actually. We could take a look at whether it could possibly end up in a mergeable state. If it doesn't then you might not want to waste your time; if it does then you can work from there. Thanks.

from googler.

jarun avatar jarun commented on May 20, 2024

You could raise a PR with what you have actually.

I second this. Please share what you've got as a PR and we can discuss this further.

from googler.

Phyks avatar Phyks commented on May 20, 2024

Re weather on WolframAlpha: if you query about "Stanford, CA weather" for instance, it gives a temperature curves, cloud cover curves, station info, etc. Much more complete than Google. Not that I'm a big fan of WolframAlpha; just stating the facts.

Actually, I do agree on this particular point. But you have to query in English (weather in Paris works in WolframAlpha and Google but météo Paris only works in Google, météo is the French word for weather). Plus it does not clearly show the data for complex queries such as weather in paris tomorrow, at least in my quick test, and returns much much information (maybe too much actually for a simple CLI tool). But that's another point, and I agree WolframAlpha may be an option to consider.

You could raise a PR with what you have actually.

What I have at the moment is a quite dirty script, written in a couple of minutes and built around scrapy. I am not sure I should open a PR with it, and I'd rather put it in a Gist https://gist.github.com/Phyks/a9458568ef3b66590a860f0afcc4a59c.

As stated above, it works with:

  • calc (with or without units): python3 google_now.py 10+20 or python3 google_now.py "10Hz + 20Hz".
  • unit conversions: python3 google_now.py "Hz in GHz".
  • weather, although render is not perfect: python3 google_now.py "weather in Paris" | lynx -stdin.

It does not work with people and places at the moment.

from googler.

jarun avatar jarun commented on May 20, 2024

scrapy

@zmwangx has written a very well-documented parser. We must remove scrapy dependency to start with and extend googler parser.

calculator

do scientific calculations work?

weather

We don't need to bother about rendering in lynx (or any browser for that matter). googler shows the data in plaintext. You can either open a URL or the current search in browser. It should work with places is all.

It does not work with people and places at the moment.

no problem.

from googler.

Phyks avatar Phyks commented on May 20, 2024

Sure about scrapy. As stated above, this is a quick and dirty proof of concept coded in a couple of minutes.

What are "scientific calculations"? Isn't it already covered by python3 google_now.py "10Hz + 20Hz" ?

Concerning weather, I do not want to render in Lynx, I want to ncursify the HTML output. That is why there is this Lynx dependency at the moment.

from googler.

jarun avatar jarun commented on May 20, 2024

What are "scientific calculations"

If it covers logarithmic/trigonometric ratios, then fine.

Concerning weather, I do not want to render in Lynx, I want to ncursify the HTML output. That is why there is this Lynx dependency at the moment.

I guess there's cmdline a weather util to do just that. For googler, plaintext output and opening the search link in browser (if any) would suffice.

from googler.

Phyks avatar Phyks commented on May 20, 2024
% python tmp/google_now.py "ln(2)"
ln(2) = 0,693147181

Concerning weather, I do not see your point. For now, I have

% python google_now.py "weather in Paris"
### **Météo** à **Paris**

![Ensoleillé](//ssl.gstatic.com/onebox/weather/60/sun.png)| 21 °C |
[°F](/setprefs?fheit=1&sig=0_AW4nLDP-xA6rZMZqS72g4gxdUxU=&prev=https://www.goo
gle.fr/search%3Fq%3Dweather%2Bin%2BParis)| | sam.| dim.| lun.| mar.  
---|---|---|---|---|---|---  
![Pluie](//ssl.gstatic.com/onebox/weather/35/rain.png)|
![Pluie](//ssl.gstatic.com/onebox/weather/35/rain.png)|
![Pluie](//ssl.gstatic.com/onebox/weather/35/rain.png)|
![Averses](//ssl.gstatic.com/onebox/weather/35/rain.png)| | | | | | |  
Ensoleillé  
Vent : N à 11 km/h  
Humidité : 66%| 21 °C| 15 °C| 19 °C| 14 °C| 15 °C| 13 °C| 16 °C| 14 °C

My goal is to make it a bit more readable.

from googler.

jarun avatar jarun commented on May 20, 2024

From what I see below:
ban weather

can we scrape: time, "light thunderstorms and rain", temp (F and C both), precipitation, humidity and wind? Just the data, no images.

BTW, time can be another option in addition to calc and weather.

from googler.

Phyks avatar Phyks commented on May 20, 2024

Here we go, supporting people and places as well (output is made as Markdown at the moment): https://gist.github.com/Phyks/a9458568ef3b66590a860f0afcc4a59c.

Plus it does support time:

% python google_now.py "what time is it in NY"
13:41

samedi, 28 mai 2016 (UTC−4)

Heure (New York, État de New York, États-Unis)

I think we can scrape it further for the weather, but we have to find the correct xpaths to use.

from googler.

jarun avatar jarun commented on May 20, 2024

I think we can scrape it further for the weather, but we have to find the correct xpaths to use.

We should get rid of html2text too. We strive to keep our dependencies minimal... reduces external factors affecting the project in addition to other obvious benefits.

@zmwangx, I think we are now in a position to take a call. IF the dependencies are gone, I believe calc, time and weather are good additions. What do you think?

from googler.

zmwangx avatar zmwangx commented on May 20, 2024

IF the dependencies are gone, I believe calc, time and weather are good additions.

  1. With a cursory look, it would be a pain to actually convert the xpaths to usable HTMLParser code. It would be a lot of code with little gain, and who knows if it would break at some point (I can certainly imagine Google improving these cards as time goes on, whereas the regular search result structures are much less likely to change). We already have enough things to worry about. I wouldn't be the one converting or maintaining that code.
  2. These are certainly not worthless additions, but not so useful either.
    • Calc: too many ways to calculate in the command line. Python itself is a calculator.
    • Time: date is usually enough (TZ=America/New_York date). If you don't remember the timezone names, no problem, googler "what time is it in NY", then press o, or 1, then <enter>. Bam.
    • Weather: Again, googler --> o/1 <enter>. Or get something better? https://github.com/schachmat/wego/

Shortcuts are nice, but I would rather do one thing and one thing well.

@Phyks If your script works for you and you need that functionality often, good for you, just polish your script and make it a googlenow executable or something. For everyone else, googler then open the first result shouldn't be that hard. They could even search in the issue tracker and find your script.

@jarun Your call, but I vote for nay.

from googler.

zmwangx avatar zmwangx commented on May 20, 2024

Reopening because it should be open at this point (before a decision is made).

from googler.

jarun avatar jarun commented on May 20, 2024

Thanks @zmwangx! I understand the concerns over RoI here.

@Phyks don't have your hopes high but let me think over it and get back tomorrow. I'll also consult some non-dev googler users to make it a fair call.

from googler.

jarun avatar jarun commented on May 20, 2024

Guys,

From the feedback I got it seems cmdline users prefer wcalc or speedcrunch as the calculator. And for weather the visual forecast seems quite important. It's either wego or a weather indicator or directly weather.com.

So despite my personal inclination to have a handy app, I've come to the conclusion that everything can't be done well by a single app. And then there's the chance of losing the identity as a cmdline google search utility to cmdline utility for google search, calc, weather ....

@Phyks thanks for the suggestion and effort with the samples.

Closing the request accordingly.

from googler.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.