Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FEATURE] Currency conversion #129

Closed
Aikatsui opened this issue Oct 5, 2020 · 15 comments · Fixed by #536
Closed

[FEATURE] Currency conversion #129

Aikatsui opened this issue Oct 5, 2020 · 15 comments · Fixed by #536
Assignees
Labels
enhancement New feature or request

Comments

@Aikatsui
Copy link
Contributor

Aikatsui commented Oct 5, 2020

  1. Time
    Whoogle display time in 24 format. search: pakistan time, google display it in AM/PM format

  2. Currency conversation
    This feature not available on whoogle. search: eur to usd
    (You can attach cool component for that)

  3. Weather
    This feature not available on whoogle. search: pakistan weather or certain city weather
    (You can ignore if difficult to implement)

  4. Calculator
    This feature not available for whoogle. search: calculator

(You may need to integrate other services if difficult to take from google)

So far i only expect solution for 1 and 2.

@accountForIssues
Copy link

I think 2-4 are not possible to implement as Google loads this via javascript in the browser whereas Whoogle scrapes and parses the results from a no-javascript version of Google search results.

@benbusby I thought it was possible to view (basic) results to such queries (1-3) using Whoogle. I remember it worked some versions ago (maybe I misremember). Currently on the latest version, none seem to work. Using the same query on Google no-js page (gbv=1), they show basic results for the query.

Example queries;

  • usd to gbp
  • weather nyc
  • time london
  • 15*88
  • dog in polish

Usually, the first div in the search results is the basic answer response to such queries. I know Google makes it difficult by randomizing the class names often but is it possible for Whoogle to detect/scrape these and show it ? Currently, it feels like they are being removed as all other results remain.

@ghost
Copy link

ghost commented Jun 18, 2021

This may make delay to implement this feature but it's not a problem, if we can go to next level than to google search then it'll be better too while privacy friendly. so i like to add a comment (enhancement request) about 2 and 3. I guess there're many free data providing services sites and APIs. (If that sounds like forcing, there's no thing like you should implement, that's only suggestions to make this project better 😄)

Currency conversation
e.g. the search engine get data from morningstar and coinbase for cryptocurrency
https://developers.coinbase.com (Retrieve real-time or historical price information) that's only an example; not as suggestion to use it or particular api. i don't know about its usability and on limited environments etc or possible to scrape from sites.

i'm interest to see whoogle usable to view day/week/years currency statistics charts, contents from economic calendar and other details useful for particular field persons. it'll be amazing for other whoogle users.

Weather
I assume this feature hasn't worked when @Aikatsui opened this issue but now it seems work to show weather in specific country or city from weather.com

image
image

It'll be better if it also able to display past and future weather details UI and some other useful contents.

About "Calculator"
This doesn't need to fetch any remote data or connect to anywhere. I think you may able to add a built-in powerful calculator that has many facilities and work perfectly with web-apps to use with desktop and mobile web browsers.

Thank you for develop whoogle. 🥇 we like it alot 👍 app-0.5.0

@benbusby
Copy link
Owner

Closing, since the issue is quite old at this point, and each of the OP's queries for basic currency conversion, weather, etc seem to all be working as expected.

@itsnotsaved
Copy link

Closing, since the issue is quite old at this point, and each of the OP's queries for basic currency conversion, weather, etc seem to all be working as expected.

@benbusby Request to reopen, currency conversation doesn't work

image

image

@itsnotsaved
Copy link

itsnotsaved commented Nov 2, 2021

@accountForIssues has said,

I think 2-4 are not possible to implement as Google loads this via javascript in the browser whereas Whoogle scrapes and parses the results from a no-javascript version of Google search results.

if not possible, may be you can integrate any good solution as @urynon said,

Currency conversation
e.g. the search engine get data from morningstar and coinbase for cryptocurrency
https://developers.coinbase.com (Retrieve real-time or historical price information) that's only an example; not as suggestion to use it or particular api. i don't know about its usability and on limited environments etc or possible to scrape from sites.
i'm interest to see whoogle usable to view day/week/years currency statistics charts, contents from economic calendar and other details useful for particular field persons. it'll be amazing for other whoogle users.

I saw these resources,
https://exchangerate.host/
https://github.com/exchangeratesapi/exchangeratesapi and it is deployable to heroku etc as whoogle.
(as i see its cloud service 250 requests/m free https://exchangeratesapi.io/) and not sure if that a good idea to integrate "exchangeratesapi" but no public instances as libreddit, lingva etc except exchangeratesapi.io

@vacom13
Copy link
Contributor

vacom13 commented Nov 7, 2021

@benbusby I would like to give a more fully featured currency conversion a try. Basically, as we discussed in the mention above, I would use the regex to identify whether search query includes such a request for conversion. If its true, I could basically just get the first card from response and use the numbers
example
in it and create my own conversion factor which I could then use for the input boxes shown below

example 2
then, I could code up some basic js for the same to allow for such conversions within the input box. As for knowing whether the user asked for a conversion, I was thinking of creating a json file with country currency codes in it so that the regex can use those. Does this make any sense?

@benbusby
Copy link
Owner

benbusby commented Nov 7, 2021

@vacom13 yeah, that all sounds correct I think. As long as the JS you write is all self-contained (i.e. doesn't rely on external libraries) that should work great. I'm guessing a simple way to do that would be to use the ratio found in the original query -- for example 1:74.19 -- and use that to calculate new results for all subsequent values the user enters into the input box. If you want to rely on an external service though, you'd need to offload the calculation to the server instead, and just use JS to query for results.

@benbusby benbusby changed the title Search for time, currency conversation, weather and calculator issues [FEATURE] Currency conversion Nov 7, 2021
@benbusby benbusby reopened this Nov 7, 2021
@vacom13
Copy link
Contributor

vacom13 commented Nov 7, 2021

@benbusby I was thinking of simply using the ratio to avoid using external services. Is that cool? And yes the js wont rely on external libraries.

@benbusby
Copy link
Owner

benbusby commented Nov 7, 2021

@vacom13 yep, that sounds great

@vacom13
Copy link
Contributor

vacom13 commented Nov 11, 2021

@benbusby just an update. I was thinking of making the regex when it hit me that a better way might be to just check for the disclaimer link in the first card of the search results and matching the href to https://g.co/gfd if it exists as surely, all the conversion queries which display this card would have it. Thereby accounting for all possible combinations effectively I think 😅.

Disclaimer

hrefy

@vacom13
Copy link
Contributor

vacom13 commented Nov 13, 2021

@benbusby I keep getting this error please help.

Error-1.jpg

The second one is what concerns me. It doesnt allow me to run the js function for some reason.

The code I wrote still needs to be improved 😅 but here it is.

Code.jpg

Js.jpg

@benbusby
Copy link
Owner

@vacom13 you might want to disable the CSP while you're developing this. There's another issue in the backlog for removing it entirely, which I agree with, just haven't had a sec to do it yet. The line you'd want to remove is resp.headers['Content-Security-Policy'] = app.config['CSP'] in app/routes.py. It should stop giving you that error afterwards. I'll go through and more thoroughly remove it sometime this weekend and then you can merge that change into your branch.

@benbusby benbusby added the enhancement New feature or request label Nov 14, 2021
@vacom13
Copy link
Contributor

vacom13 commented Nov 15, 2021

@benbusby okay great!

@vacom13
Copy link
Contributor

vacom13 commented Nov 17, 2021

@benbusby I have the feature down. Maybe I could just create a pr and you can check?

@benbusby
Copy link
Owner

@vacom13 for sure! Open a PR whenever you're ready

@benbusby benbusby linked a pull request Nov 28, 2021 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants