Closed zachspar closed 3 years ago
Fixed by my new PR's to develop and dev2 this issue can be closed now.
This is still a problem for people in the US (+ some other countries), even with @Genghius's changes:
[zspar@archtop:~]$ tuxi weather 10001
---
Cloudy
34ºC 1ºF
Precipitation: 46%
Humidity: 46%
Wind: 11 mph
18 km/h
---
I think this issue should be re-opened @Bugswriter, and @Genghius you can extend your sed
chain even more :D, as your solution does not work for everyone (mentioned earlier by @colonvirus)
When did you updated your tuxi? I believe you will not get any weather issue from our current main branch.
When did you updated your tuxi? I believe you will not get any issue from our current main branch.
Just now:
[zspar@archtop:~/Code]$ git clone https://github.com/Bugswriter/tuxi.git && cd tuxi
Cloning into 'tuxi'...
remote: Enumerating objects: 21, done.
remote: Counting objects: 100% (21/21), done.
remote: Compressing objects: 100% (19/19), done.
remote: Total 679 (delta 9), reused 7 (delta 2), pack-reused 658
Receiving objects: 100% (679/679), 274.91 KiB | 5.50 MiB/s, done.
Resolving deltas: 100% (357/357), done.
[zspar@archtop:~/Code/tuxi]$ ./tuxi weather 10001
---
Cloudy
34ºC 1ºF
Precipitation: 45%
Humidity: 45%
Wind: 11 mph
18 km/h
---
[zspar@archtop:~/Code/tuxi]$
The issue is persistent in the main branch :( , this is why I think it should be re-opened
@Genghius I guess only you can .solve this issue.
maybe you are getting this issue because your country is US or somewhere which give F priority. Tell us your country.
This is still a problem for people in the US (+ some other countries)
@spidyshivam, Yes I am in the the US. This issue still affects everybody here.
@Genghius I guess only you can .solve this issue.
There are 2 ways to solve this issue. 1-Act like the USA doesn't exist and ignore any further issues or PR's raised that involve weather and the USA, hoping someday the USA will switch to normal measurement units. 2-Rewrite the weather command in a much more convoluted and hard way (would take me a while).
if I haven't passed a PR with option 2 by this afternoon it most likely means I gave up. XD
1-Act like the USA doesn't exist and ignore any further issues or PR's raised that involve weather and the USA, hoping someday the USA will switch to normal measurement units.
@Genghius I'm not opposed to this 😂 lol.
It is not that big of a problem, and I can flip flop it for myself. But I'm sure another annoying American will raise this issue again 😉.
That being said, it seems like you're the sed
guru, and I hope you can squash this. Good luck 👍
ok, imma go a little more in-depth as to why I can't fix this. -The div we are scrapping for weather has a script embedded into it.
This ^ is how google will normally show weather, I can just get data from the div and done. However... This ^ is how google shows weather to People in the USA, they will get F selected by default.
And this ^ is how the weather command gets its data right before it goes through sed.
What does this mean? -The temperatures have their units in separate lines. -The units don't swap position when in USA mode so I cant just give temperatures their units based on the actual lines of the units. -I have absolutely no idea how to work around this. I cannot fix it as the weather command currently is.
Of course, there is the option of going through the JSON properly and figuring out how to do this. that is ofcourse... if you fret not upon the sight of this:
[
{
"children": [
{
"alt": "Clear with periodic clouds",
"class": "wob_tci",
"id": "wob_tci",
"src": "//ssl.gstatic.com/onebox/weather/64/sunny_s_cloudy.png",
"tag": "img"
},
{
"aria-level": "3",
"children": [
{
"children": [
{
"children": [
{
"class": "wob_t TVtOme",
"id": "wob_tm",
"style": "display:inline",
"tag": "span",
"text": "12"
},
{
"class": "wob_t",
"id": "wob_ttm",
"style": "display:none",
"tag": "span",
"text": "53"
}
],
"class": "vk_bk TylWce",
"tag": "div"
},
{
"children": [
{
"aria-disabled": "true",
"aria-label": "°Celsius",
"class": "wob_t",
"role": "button",
"style": "display:inline",
"tag": "span",
"text": "°C"
},
{
"children": [
{
"aria-label": "°Celsius",
"tag": "span",
"text": "°C"
}
],
"class": "wob_t",
"data-lams": "",
"data-metric": "true",
"data-url": "/setprefs?fheit=0\u0026amp;sig=0_iHUdiCkXSAcGp1M2Ikcw3J4k4Go=\u0026amp;prev=https://www.google.com/search%3Fhl%3Den_GB%26q%3Dweather%2Blisbon",
"data-ved": "2ahUKEwi2ntf_z_vuAhXFoXEKHQ1wDrEQ-lswAHoECAEQAQ",
"href": "#",
"jsaction": "ytDzMd",
"role": "button",
"style": "display:none;text-decoration:none",
"tag": "a"
},
{
"class": "Az4ne",
"tag": "span"
},
{
"children": [
{
"aria-label": "°Fahrenheit",
"tag": "span",
"text": "°F"
}
],
"class": "wob_t",
"data-lams": "",
"data-metric": "false",
"data-url": "/setprefs?fheit=1\u0026amp;sig=0_iHUdiCkXSAcGp1M2Ikcw3J4k4Go=\u0026amp;prev=https://www.google.com/search%3Fhl%3Den_GB%26q%3Dweather%2Blisbon",
"data-ved": "2ahUKEwi2ntf_z_vuAhXFoXEKHQ1wDrEQ-1swAHoECAEQAg",
"href": "#",
"jsaction": "ytDzMd",
"role": "button",
"style": "display:inline;text-decoration:none;margin-left:-1px",
"tag": "a"
},
{
"aria-disabled": "true",
"aria-label": "°Fahrenheit",
"class": "wob_t",
"role": "button",
"style": "display:none;margin-left:-1px",
"tag": "span",
"text": "°F"
}
],
"class": "vk_bk wob-unit",
"jscontroller": "a3bY8",
"tag": "div"
}
],
"tag": "div"
}
],
"class": "Ab33Nc",
"jscontroller": "a3bY8",
"role": "heading",
"tag": "div"
},
{
"children": [
{
"children": [
{
"id": "wob_pp",
"tag": "span",
"text": "2%"
}
],
"tag": "div",
"text": "Precipitation:"
},
{
"children": [
{
"id": "wob_hm",
"tag": "span",
"text": "66%"
}
],
"tag": "div",
"text": "Humidity:"
},
{
"children": [
{
"children": [
{
"class": "wob_t",
"id": "wob_ws",
"tag": "span",
"text": "5 mph"
},
{
"class": "wob_t",
"id": "wob_tws",
"style": "display:none",
"tag": "span",
"text": "5 mph"
}
],
"tag": "span"
}
],
"tag": "div",
"text": "Wind:"
}
],
"class": "wtsRwe",
"tag": "div"
}
],
"class": "UQt4rd",
"tag": "div"
}
]
Abandon all hope ye who enter here.
There is the option of having a constant that allows switching the position of the units... if yall are ok with just that then make a pr for it....
there also s the option to use multiple commands to just reliably pup elements by class, but that would require making the weather command more than 1 line long.
So we can't solve this. fine if we can't solve this .. but instead of showing broken stuff we can just give temperature?
we "can" solve this.
its just such a royal headache that i dont think anyone here wants to do it.
However, we have the option to just show the temperature as, for example:
25º
leaving it up to the user to guess if that means Celcius or fahrenheit.
that's a good idea. I think we should do it. nice @Genghius
that's a good idea. I think we should do it.
The above PR should close out this issue. All it does, as @Genghius suggested, is remove the unit from weather output, and leaves it up to the user to decide what unit it should be.
@Genghius, one thing we can do in the sed
chain is just compare the two values. The greater value is always F. Which seems like a pretty viable solution to me. @Bugswriter reject my PR and @Genghius try one more time !! haha
which PR? Also solution is pretty hacky But IG we ll get no issue going for a sleep so ll answer in 6 hours.
Def Hacky, but it will always be a fact that C < F. @Genghius you can put that into ye mere sed
chain
id
s are shown to normal users vs. US users.Def Hacky, but it will always be a fact that C < F. @Genghius you can put that into ye mere
sed
chain129 can be cancelled. It has some insight as to what div
id
s are shown to normal users vs. US users.
sorting by value is a good idea. could be easily done with awk, whomever is willing to, make a pr with that.
What is this whole units issue yall are talking about? what is those "fahrenheit" that you guys keep mentioning, my units are just fine. What is this whole "USA" thing that keeps being mentioned too?
Coming from the guy who uses Celsius and Miles per hour 😭😂
british all the way.
Coming from the guy who uses Celsius and Miles per hour
actually google, only shows speed in mph tho?
Not for me @Genghius , shows both.
[zspar@archtop:~]$ tuxi weather 10001
Cloudy
34ºC 1ºF
Precipitation: 46%
Humidity: 46%
Wind: 11 mph
18 km/h
Read up when we re-opened this issue
i see....
@Bugswriter Can you close this? My last merged PR fixed this, and it is working on the main branch.
@sudocanttype , it is fixed for me. @Bugswriter , we can close this issue.
Thanks
Output: Works perfect for me :+1: Note: I am located in New York with this output
tuxi >>> ./tuxi weather new york
Clear with periodic clouds
4ºC 39ºF
Precipitation: 1%
Humidity: 58%
Wind: 7 mph
11 km/h
shell
bashOperating system/version
: archTerminal name/version
: st$TERM
Steps to Reproduce the Problem
Run tuxi with weather query:
tuxi weather 10001
Expected Behavior
32 ºF 0 ºC
Actual Behavior
32 ºC 0 ºF
The Problem
The degrees are flip flopped. I have committed the changes to my fork and will open a PR.
Log