You are not logged in.

#3851 2020-09-17 08:49:25

ector1935
Member
Registered: 2017-05-03
Posts: 231

Re: Conky weather+moon scripts (Accuw/WUndergr/Weather.com/NWS/MoonGiant)

TeoBigusGeekus wrote:

How's accuweather script holding up?
Just tried it and everything's ok.

Hi Teo,i Confirm working.
Cheers

Offline

#3852 2020-09-18 12:07:40

ector1935
Member
Registered: 2017-05-03
Posts: 231

Re: Conky weather+moon scripts (Accuw/WUndergr/Weather.com/NWS/MoonGiant)

Hi,Today weather.com is not working.
Groups and hours are in hibernation.
Does it only happen to me ?!
Cheers

Offline

#3853 2020-09-18 15:53:02

Sector11
Conky 1.9er Mod Squid
From: Upstairs
Registered: 2015-08-20
Posts: 6,449

Re: Conky weather+moon scripts (Accuw/WUndergr/Weather.com/NWS/MoonGiant)

ector1935 wrote:

Hi,Today weather.com is not working.
Groups and hours are in hibernation.
Does it only happen to me ?!
Cheers

Same here.

GRRRRRRRRRRRRRRRRR!

These changes have to be a systematic change that thwarts anything but "their weather apps".

My phone came with a weather.com "widget" that never fails.


The sun will never set if you keep walking towards it. - my son
Being positive doesn't understand physics.
_______________________________
Debian 10 Buster = SharpBang ♯!

Offline

#3854 2020-09-19 21:10:31

TeoBigusGeekus
BL DieHard
From: /Greece/Kastoria
Registered: 2015-10-04
Posts: 1,413

Re: Conky weather+moon scripts (Accuw/WUndergr/Weather.com/NWS/MoonGiant)

All in good time, my schedule is pretty hectic these days.
So, patience please.


Please make Autocad Civil 3D and Archicad work on Linux!
Please make Autocad Civil 3D and Archicad work on Linux!
Please make Autocad Civil 3D and Archicad work on Linux!
Please make Autocad Civil 3D and Archicad work on Linux!

Offline

#3855 2020-09-19 22:35:23

Sector11
Conky 1.9er Mod Squid
From: Upstairs
Registered: 2015-08-20
Posts: 6,449

Re: Conky weather+moon scripts (Accuw/WUndergr/Weather.com/NWS/MoonGiant)

Mean time, back at the farm ...
mean_time.jpg
Patience is a stick in time.


The sun will never set if you keep walking towards it. - my son
Being positive doesn't understand physics.
_______________________________
Debian 10 Buster = SharpBang ♯!

Offline

#3856 2020-09-22 15:56:39

fvirgola80
Member
From: Italy / Rome
Registered: 2015-10-08
Posts: 262

Re: Conky weather+moon scripts (Accuw/WUndergr/Weather.com/NWS/MoonGiant)

Good evening to all friends how are you? .... You thought I was no longer there and instead ....
I wondered what it would be like to have a weather station .... I have to say the top is so I finally got the Davis vantage pro 2 .... and I must say that his job does it very well ... I am asked .. Why not publish the data online ... and so to the console of the weather station I connected the raspberry pi 3 with debian ... the interesting thing is that there is the WeeWx software that manages the same weather station ... so after some time I created my first website that I invite you to see www.meteocivitavecchia.it
Tell me what you think .... I can say that the approach with the Linux operating system of bunsenlabs helped me a lot, but not only did programming in conky help me too ....
I await your impressions
See you soon
luke skywalker wink  wink  wink


Nothing happens by chance

Offline

#3857 2020-09-22 16:08:29

Sector11
Conky 1.9er Mod Squid
From: Upstairs
Registered: 2015-08-20
Posts: 6,449

Re: Conky weather+moon scripts (Accuw/WUndergr/Weather.com/NWS/MoonGiant)

WOW!!!   That's nice.  I like it.


The sun will never set if you keep walking towards it. - my son
Being positive doesn't understand physics.
_______________________________
Debian 10 Buster = SharpBang ♯!

Offline

#3858 2020-09-23 22:15:17

TeoBigusGeekus
BL DieHard
From: /Greece/Kastoria
Registered: 2015-10-04
Posts: 1,413

Re: Conky weather+moon scripts (Accuw/WUndergr/Weather.com/NWS/MoonGiant)

ANNOUNCEMENT
No complaints from Accuweather users, so I pushed the new script. Sorry for the delay, it's been a rough period (it still is).

Last edited by TeoBigusGeekus (2020-09-23 22:15:40)


Please make Autocad Civil 3D and Archicad work on Linux!
Please make Autocad Civil 3D and Archicad work on Linux!
Please make Autocad Civil 3D and Archicad work on Linux!
Please make Autocad Civil 3D and Archicad work on Linux!

Offline

#3859 2020-09-23 22:17:06

TeoBigusGeekus
BL DieHard
From: /Greece/Kastoria
Registered: 2015-10-04
Posts: 1,413

Re: Conky weather+moon scripts (Accuw/WUndergr/Weather.com/NWS/MoonGiant)

@fvirgola80
Nice job my friend, congratulations!!!

The weather.com script will have to wait for the moment, sorry guys.


Please make Autocad Civil 3D and Archicad work on Linux!
Please make Autocad Civil 3D and Archicad work on Linux!
Please make Autocad Civil 3D and Archicad work on Linux!
Please make Autocad Civil 3D and Archicad work on Linux!

Offline

#3860 2020-09-24 07:24:51

unklar
Member
Registered: 2015-10-31
Posts: 1,264

Re: Conky weather+moon scripts (Accuw/WUndergr/Weather.com/NWS/MoonGiant)

TeoBigusGeekus wrote:

ANNOUNCEMENT
No complaints from Accuweather users, so I pushed the new script. Sorry for the delay, it's been a rough period (it still is).

Sorry Teo, I have to bitch again. ops

The times for the sun and moon are not correct. In my German version PM times are shown - and, that twice, twice.

RrMlFZzt.png

I would like to see a European weather provider, but I don't know what to look out for you.
The principle is similar to screenscraping ?
We should think about it to get away from the Americans...  monkey

What do you and the others think?

Offline

#3861 2020-09-24 07:28:33

unklar
Member
Registered: 2015-10-31
Posts: 1,264

Re: Conky weather+moon scripts (Accuw/WUndergr/Weather.com/NWS/MoonGiant)

@fvirgola80

questo è eccellente!  angel

Offline

#3862 2020-09-24 22:25:29

TeoBigusGeekus
BL DieHard
From: /Greece/Kastoria
Registered: 2015-10-04
Posts: 1,413

Re: Conky weather+moon scripts (Accuw/WUndergr/Weather.com/NWS/MoonGiant)

unklar wrote:

The times for the sun and moon are not correct. In my German version PM times are shown - and, that twice, twice.

That was my mistake. Ich habe verkackt, Entschuldigung.


Please make Autocad Civil 3D and Archicad work on Linux!
Please make Autocad Civil 3D and Archicad work on Linux!
Please make Autocad Civil 3D and Archicad work on Linux!
Please make Autocad Civil 3D and Archicad work on Linux!

Offline

#3863 2020-09-24 22:26:43

TeoBigusGeekus
BL DieHard
From: /Greece/Kastoria
Registered: 2015-10-04
Posts: 1,413

Re: Conky weather+moon scripts (Accuw/WUndergr/Weather.com/NWS/MoonGiant)

ANNOUNCEMENT
Accuweather script: Moonrise/set, Sunrise/set times were wrong, I've corrected it. Thanks to unklar for reporting it.


Please make Autocad Civil 3D and Archicad work on Linux!
Please make Autocad Civil 3D and Archicad work on Linux!
Please make Autocad Civil 3D and Archicad work on Linux!
Please make Autocad Civil 3D and Archicad work on Linux!

Offline

#3864 2020-09-25 11:19:28

unklar
Member
Registered: 2015-10-31
Posts: 1,264

Re: Conky weather+moon scripts (Accuw/WUndergr/Weather.com/NWS/MoonGiant)

Teo, perfect!

qQPwQ2lt.png

Thank you very much for your tireless work.  smile Nobody is perfect.  big_smile

Last edited by unklar (2020-09-25 11:49:15)

Offline

#3865 2020-09-26 09:57:11

fvirgola80
Member
From: Italy / Rome
Registered: 2015-10-08
Posts: 262

Re: Conky weather+moon scripts (Accuw/WUndergr/Weather.com/NWS/MoonGiant)

Sector11 wrote:

WOW!!!   That's nice.  I like it.

kiss  kiss


Nothing happens by chance

Offline

#3866 2020-09-26 09:58:38

fvirgola80
Member
From: Italy / Rome
Registered: 2015-10-08
Posts: 262

Re: Conky weather+moon scripts (Accuw/WUndergr/Weather.com/NWS/MoonGiant)

TeoBigusGeekus wrote:

@fvirgola80
Nice job my friend, congratulations!!!
wink tongue devil kiss kiss


Nothing happens by chance

Offline

#3867 2020-09-26 09:59:27

fvirgola80
Member
From: Italy / Rome
Registered: 2015-10-08
Posts: 262

Re: Conky weather+moon scripts (Accuw/WUndergr/Weather.com/NWS/MoonGiant)

unklar wrote:

@fvirgola80

questo è eccellente!  angel

Grazie unklar wink  tongue  kiss


Nothing happens by chance

Offline

#3868 2020-09-28 21:45:10

ector1935
Member
Registered: 2017-05-03
Posts: 231

Re: Conky weather+moon scripts (Accuw/WUndergr/Weather.com/NWS/MoonGiant)

TeoBigusGeekus wrote:

ANNOUNCEMENT
No complaints from Accuweather users, so I pushed the new script. Sorry for the delay, it's been a rough period (it still is).

Hello teo,
for weather.com no update ?!
Always when time allows it, I was only asking for news.
Cheers

Offline

#3869 2020-09-29 20:25:33

TeoBigusGeekus
BL DieHard
From: /Greece/Kastoria
Registered: 2015-10-04
Posts: 1,413

Re: Conky weather+moon scripts (Accuw/WUndergr/Weather.com/NWS/MoonGiant)

I've barely touched it ector1935.
It's gonna take a while.


Please make Autocad Civil 3D and Archicad work on Linux!
Please make Autocad Civil 3D and Archicad work on Linux!
Please make Autocad Civil 3D and Archicad work on Linux!
Please make Autocad Civil 3D and Archicad work on Linux!

Offline

#3870 2020-10-13 16:17:01

il.harun
Member
Registered: 2020-06-04
Posts: 11

Re: Conky weather+moon scripts (Accuw/WUndergr/Weather.com/NWS/MoonGiant)

Hi Teo.
weather_com is tired of experimenting and Conky is working.

#!/usr/bin/env bash


#########################################################################################
# Put the command that launches the conky configuration file that uses this script here #
#########################################################################################
weather_conky_launch_command="conky -b"


#########################################################################################################
# Put your language's interpretation of today, tenday and hourly - as shown in weather.com's url - here #
# Example for German:														   	   				                                     	    #
#     today=heute																						                                            #
#     tenday=10tage																						                                          #
#     hourly=stundlich                                                                                  #	
# Example for French:																					                                          #
#     today=aujour																						                                          #
#     tenday=10jours																					                                          #
#     hourly=parheure																					                                          #
# etc., you get the idea																				                                        #
# Replace your language's abbreviations for the wind directions as well                                 #
# At last, change Night to whatever it is in your language: Nacht, Nuit, Νύχτα, etc.                    #
#########################################################################################################
today=today
tenday=tenday
hourly=hourbyhour
north=N
south=S
west=W
east=E
#en
#
night=Night
#ru
#night=Ночь

###############################################################################################################################
# Put your Weather.com address here, add en-IE between weather.com and weather for metric. You can use any language you want. #
###############################################################################################################################
#address="https://weather.com/weather/today/l/d3e4167b6d899b0052a00ed051f449d51c5fc10e852f659680f3b6e0ed2c638b"
#address="https://weather.com/en-IE/weather/today/l/44114afd18d51b90206ceecf0e548aa87fe4ccfa9e6e746022ac3bd079d429c5"
#address="https://weather.com/en-IE/weather/today/l/ARBA0009:1:AR"
#address="https://weather.com/de-LI/wetter/heute/l/6f62e1be6a5f0d36914ae9eab7c3aedbbec5b5c6e0946c3fe6069a94435fc196"
#address="https://weather.com/el-GR/weather/today/l/44114afd18d51b90206ceecf0e548aa87fe4ccfa9e6e746022ac3bd079d429c5"
#address="https://weather.com/de-DE/wetter/heute/l/44114afd18d51b90206ceecf0e548aa87fe4ccfa9e6e746022ac3bd079d429c5"
#address="https://weather.com/fr-FR/temps/aujour/l/0121bf9710ae35daa414ce903453d12358ddc10bee696b17d1f973fafc5260c4"
#
#
#######ru
#address="https://weather.com/ru-RU/weather/today/l/RSXX0063:1:RS"
#address="https://weather.com/ru-RU/weather/today/l/aad6cfff41f8ff8ba6f7f704388aca9ef8ec099f20666c32d00f240a6f1b9d9f"
#address="https://weather.com/ru-IE/weather/today/l/aad6cfff41f8ff8ba6f7f704388aca9ef8ec099f20666c32d00f240a6f1b9d9f"
#
#######en
#
address="https://weather.com/en-IE/weather/today/l/RSXX0063:1:RS"
#address="https://weather.com/en-IE/weather/today/l/aad6cfff41f8ff8ba6f7f704388aca9ef8ec099f20666c32d00f240a6f1b9d9f"
#
#




##########################
# Function: colorize_svg #
##########################
colorize_svg () {
    sed -i -e 's/var(--color-moon)/#e3e3e3/g' -e 's/var(--color-star)/#e3e3e3/g' -e 's/var(--color-cloud)/#d3d3d3/g' -e 's/var(--color-na)/#d3d3d3/g' -e 's/var(--color-fog)/#d3d3d3/g' -e 's/var(--color-hail)/#d3d3d3/g' -e 's/var(--color-tornado)/#d3d3d3/g' -e 's/var(--color-wind)/#d3d3d3/g' -e 's/var(--color-storm)/#d3d3d3/g' -e 's/var(--color-lightning)/#ebdb00/g' -e 's/var(--color-sun)/#ebdb00/g' -e 's/var(--color-drop)/#6adef8/g' -e 's/var(--color-snowflake)/#d3d3d3/g' -e 's/var(--color-thunderstorm-mask)/#2b2b2b/g' $1
}


############################
# Function: wind_direction #
############################
wind_direction() {
  if (( $1 >= 350 && $1 <= 10 )); then
    echo $north
  elif (( $1 > 10 && $1 < 80 )); then
    echo $north$east
  elif (( $1 >= 80 && $1 <= 100 )); then
    echo $east
  elif (( $1 > 100 && $1 < 170 )); then
    echo $south$east
  elif (( $1 >= 170 && $1 <= 190 )); then  
    echo $south
  elif (( $1 > 190 && $1 < 260 )); then
    echo $south$west
  elif (( $1 >= 260 && $1 <= 280 )); then  
    echo $west
  elif (( $1 > 280 && $1 < 350 )); then
    echo $north$west    
  fi
}


#######################
# Pause weather conky #
#######################
pkill -STOP -xf "$weather_conky_launch_command"


#######
# Now #
#######
curl \
  -H 'authority: weather.com' \
  -H 'cache-control: max-age=0' \
  -H 'upgrade-insecure-requests: 1' \
  -H 'user-agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.142 Safari/537.36' \
  -H 'accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9' \
  -H 'sec-fetch-site: none' \
  -H 'sec-fetch-mode: navigate' \
  -H 'sec-fetch-user: ?1' \
  -H 'sec-fetch-dest: document' \
  -H 'accept-language: en-US,en;q=0.9' \
  -H 'cookie: logatimLevel=INFO; akacd_NxtGen-DHLS=2177452799~rv=98~id=614d27d4c75f75df7bad5550f54e64b1; speedpin=4G; ci=TWC-Locale-Group=US&X-Origin-Hint=Prod-IBM-LS&TWC-GeoIP-Country=DE&TWC-Privacy=gdpr' \
  --compressed -o $HOME/Weather_com_conky_script/now_raw "$address"

sed '/CurrentConditions--tempValue--3KcTQ">\|set="current-conditions" name="moonphase"/!d' $HOME/Weather_com_conky_script/now_raw > $HOME/Weather_com_conky_script/now
tr -d '\n' < $HOME/Weather_com_conky_script/now > $HOME/Weather_com_conky_script/now_temp
mv $HOME/Weather_com_conky_script/now_temp $HOME/Weather_com_conky_script/now
sed -i 's/\u002F//g' $HOME/Weather_com_conky_script/now
sed -i 's/<\/span>/\n/g' $HOME/Weather_com_conky_script/now
sed -i '/"precipPhrase"/d' $HOME/Weather_com_conky_script/now
sed -i '/CurrentConditions--tempValue--3KcTQ">\|CurrentConditions--phraseValue--2xXSr">\|TemperatureValue">\|feelsLikeTempValue--2aogo">\|name="sunset-line" \|name="wind"\|name="humidity"\|name="dewpoint"\|name="dewpoint"\|name="pressure"\|name="uv"\|name="visibility"\|name="moonphase"/!d' $HOME/Weather_com_conky_script/now
sed -i -e '1s/^.*CurrentConditions--tempValue--3KcTQ">//' -e 's/^.*phraseValue--2xXSr">//g' -e 's/"TemperatureValue">/\n/g' -e 's/^.*precipValue--RBVJT"><span>//' -e 's/^.*feelsLikeTempValue--2aogo">//' -e 's/SunriseSunset--dateValue--2nwgx">/\n/g' -e '/SegmentHighTemp/d' $HOME/Weather_com_conky_script/now
sed -i -e '/SunriseSunsetContainer/d' -e '/\/<span data-testid=/d' -e 's/<\/p><\/div>.*$//g' -e 's/^.*"PercentageValue">//g' -e 's/^.*"UVIndexValue">//g' -e 's/^.*"VisibilityValue">//g' -e '/name="dewpoint"/d' -e 's/<\/div><\/div><div class="_-_-components-src-organism.*$//g' -e 's/^.*transform:rotate(//g' -e 's/deg)" set/deg\n/g' $HOME/Weather_com_conky_script/now
sed -i -e 's/^.*<\/path><\/svg>//g' -e 's/^.*wxData--23DP5">//g' -e 's/<\/div>.*$//g' -e 's/deg//g' -e '13s/%//' -e 's/°//g' -e '16s/Unlimited/Unlim\./' $HOME/Weather_com_conky_script/now
sed -i 's/^.*>//g' $HOME/Weather_com_conky_script/now
w_degrees=$(sed -n 10p $HOME/Weather_com_conky_script/now)
w_direction=$(wind_direction $w_degrees)
sed -i 10s/^.*$/$w_direction/ $HOME/Weather_com_conky_script/now
#Tidy up now file
sed -n 1,2p $HOME/Weather_com_conky_script/now > $HOME/Weather_com_conky_script/now_temp
sed -n 5p $HOME/Weather_com_conky_script/now >> $HOME/Weather_com_conky_script/now_temp
sed -n 3,4p $HOME/Weather_com_conky_script/now >> $HOME/Weather_com_conky_script/now_temp
sed -n 15p $HOME/Weather_com_conky_script/now >> $HOME/Weather_com_conky_script/now_temp
sed -n 10p $HOME/Weather_com_conky_script/now >> $HOME/Weather_com_conky_script/now_temp
wind_speed=$(sed -n 11p $HOME/Weather_com_conky_script/now)
sed -i "7s|$| $wind_speed|" $HOME/Weather_com_conky_script/now_temp
sed -n 12p $HOME/Weather_com_conky_script/now >> $HOME/Weather_com_conky_script/now_temp
sed -n 13p $HOME/Weather_com_conky_script/now >> $HOME/Weather_com_conky_script/now_temp
sed -n 14p $HOME/Weather_com_conky_script/now >> $HOME/Weather_com_conky_script/now_temp
sed -n 16p $HOME/Weather_com_conky_script/now >> $HOME/Weather_com_conky_script/now_temp
echo "sunrise" >> $HOME/Weather_com_conky_script/now_temp
sed -n 6p $HOME/Weather_com_conky_script/now >> $HOME/Weather_com_conky_script/now_temp
echo "sunset" >> $HOME/Weather_com_conky_script/now_temp
sed -n 7p $HOME/Weather_com_conky_script/now >> $HOME/Weather_com_conky_script/now_temp
echo "moonphrase" >> $HOME/Weather_com_conky_script/now_temp
sed -n 17p $HOME/Weather_com_conky_script/now >> $HOME/Weather_com_conky_script/now_temp
mv $HOME/Weather_com_conky_script/now_temp $HOME/Weather_com_conky_script/now
#extract svg now
sed '/<svg>/!d' $HOME/Weather_com_conky_script/now_raw > $HOME/Weather_com_conky_script/svg_classes
sed -i -e 's/^.*<svg>//' -e 's/<\/svg>.*$/<\/svg>/' $HOME/Weather_com_conky_script/svg_classes
sed '/<svg set="weather/!d' $HOME/Weather_com_conky_script/now_raw > $HOME/Weather_com_conky_script/Forecast_Images/now.svg
sed -i 's/<svg/\n<svg/g' $HOME/Weather_com_conky_script/Forecast_Images/now.svg
sed -i -e '/<svg set="weather/!d' -e 's/<\/svg>.*$//g' $HOME/Weather_com_conky_script/Forecast_Images/now.svg
sed -i -e '2,$d' -e 's/^.*viewBox/<svg xmlns:xlink="http:\/\/www.w3.org\/1999\/xlink" viewBox/' $HOME/Weather_com_conky_script/Forecast_Images/now.svg
cat $HOME/Weather_com_conky_script/svg_classes >> $HOME/Weather_com_conky_script/Forecast_Images/now.svg
colorize_svg $HOME/Weather_com_conky_script/Forecast_Images/now.svg


###########
# 10 Days #
###########
address10=$(echo $address|sed s/$today/$tenday/)
curl \
  -H 'authority: weather.com' \
  -H 'cache-control: max-age=0' \
  -H 'upgrade-insecure-requests: 1' \
  -H 'user-agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.142 Safari/537.36' \
  -H 'accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9' \
  -H 'sec-fetch-site: none' \
  -H 'sec-fetch-mode: navigate' \
  -H 'sec-fetch-user: ?1' \
  -H 'sec-fetch-dest: document' \
  -H 'accept-language: en-US,en;q=0.9' \
  -H 'cookie: logatimLevel=INFO; akacd_NxtGen-DHLS=2177452799~rv=98~id=614d27d4c75f75df7bad5550f54e64b1; speedpin=4G; ci=TWC-Locale-Group=US&X-Origin-Hint=Prod-IBM-LS&TWC-GeoIP-Country=DE&TWC-Privacy=gdpr' \
  --compressed -o $HOME/Weather_com_conky_script/10days_raw "$address10"

sed '/DetailsSummary--daypartName--1Mebr"/!d' $HOME/Weather_com_conky_script/10days_raw > $HOME/Weather_com_conky_script/10days
sed -i -e 's/DetailsSummary--daypartName--1Mebr">/\n/g' -e 's/DailyContent--daypartDate--3MM0J">/\n/g' -e 's/DailyContent--temp--_8DL5">/\n/g' -e 's/"weatherIcon" class=[^>]*>/\n/g' -e 's/highTempValue--3x6cL">/\n/g' -e 's/lowTempValue--1DlJK">/\n/g' -e 's/DetailsSummary--condition--mqdxh">/\n/g' -e 's/<span class="[^>]*DetailsSummary--extendedData[^>]*>/\n/g' -e 's/"PercentageValue">/\n/g' -e 's/windWrapper--1Va1P undefined">/\n/g' $HOME/Weather_com_conky_script/10days
sed -i -e 's/"PercentageValue" class="[^>]*>/\n/g' -e 's/windWrapper--[^>]*>/\n/g' -e 's/DailyContent--narrative--3AcXd">/\n/g' -e 's/"UVIndexValue" class="[^>]*>/\n/g' -e 's/"SunriseTime" class="[^>]*>/\n/g' -e 's/"SunsetTime" class="[^>]*>/\n/g' -e 's/"MoonriseTime" class="[^>]*>/\n/g' -e 's/"MoonsetTime" class="[^>]*>/\n/g' $HOME/Weather_com_conky_script/10days
sed -i -e '/<\/head><body>/d' -e 's/<\/span> | / /g' -e 's/<\/span>.*$//g' -e 's/<\/h3>.*$//g' -e 's/<!-- -->//g' -e 's/<\/svg>.*$//g' -e 's/<\/p><\/div>.*$//g' -e 's/<svg class.*viewBox/<svg xmlns:xlink="http:\/\/www.w3.org\/1999\/xlink" viewBox/g' -e 's/<\/h2>.*$//g' -e '/<svg aria-hidden/d' $HOME/Weather_com_conky_script/10days
sed -i '/ '"$night"'$/{4,$!b;n;n;d}' $HOME/Weather_com_conky_script/10days
#extract svg days
sed '/<svg xmlns/!d' $HOME/Weather_com_conky_script/10days > $HOME/Weather_com_conky_script/10days_svgs
for (( i=1; i<=15; i+=1 ))
	do
    sed -n ${i}p $HOME/Weather_com_conky_script/10days_svgs > $HOME/Weather_com_conky_script/Forecast_Images/d$i.svg
		cat $HOME/Weather_com_conky_script/svg_classes >> $HOME/Weather_com_conky_script/Forecast_Images/d$i.svg
		colorize_svg $HOME/Weather_com_conky_script/Forecast_Images/d$i.svg
  done
sed -i '/<svg xmlns/d' $HOME/Weather_com_conky_script/10days


##########
# Hourly #
##########
addressH=$(echo $address|sed s/$today/$hourly/)
curl \
  -H 'authority: weather.com' \
  -H 'cache-control: max-age=0' \
  -H 'upgrade-insecure-requests: 1' \
  -H 'user-agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.142 Safari/537.36' \
  -H 'accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9' \
  -H 'sec-fetch-site: none' \
  -H 'sec-fetch-mode: navigate' \
  -H 'sec-fetch-user: ?1' \
  -H 'sec-fetch-dest: document' \
  -H 'accept-language: en-US,en;q=0.9' \
  -H 'cookie: logatimLevel=INFO; akacd_NxtGen-DHLS=2177452799~rv=98~id=614d27d4c75f75df7bad5550f54e64b1; speedpin=4G; ci=TWC-Locale-Group=US&X-Origin-Hint=Prod-IBM-LS&TWC-GeoIP-Country=DE&TWC-Privacy=gdpr' \
  --compressed -o $HOME/Weather_com_conky_script/hourly_raw "$addressH"

sed '/DetailsSummary--daypartName--1Mebr">/!d' $HOME/Weather_com_conky_script/hourly_raw > $HOME/Weather_com_conky_script/hourly
sed -i -e 's/DetailsSummary--daypartName--1Mebr">/\n/g' -e 's/DetailsSummary--tempValue--RcZzi">/\n/g' -e 's/DetailsSummary--condition--mqdxh">/\n/g' -e 's/windWrapper--1Va1P undefined">/\n/g' -e 's/HourlyContent--wxPhraseLong--2CO9i">/\n/g' -e 's/DetailsTable--value--1F3Ze">/\n/g' -e 's/data-testid="PercentageValue">/\n/g' $HOME/Weather_com_conky_script/hourly
sed -i -e '/<\/head><body>/d' -e 's/<\/span>.*$//g' -e 's/<\/h2>.*$//g' -e 's/<!-- -->//g' -e 's/<\/p>.*$//g' -e 's/<\/svg>.*$//g' -e 's/<svg.*viewBox/<svg xmlns:xlink="http:\/\/www.w3.org\/1999\/xlink" viewBox/g' $HOME/Weather_com_conky_script/hourly
#extract svg hourly
sed '/<svg xmlns/!d' $HOME/Weather_com_conky_script/hourly > $HOME/Weather_com_conky_script/hourly_svgs
for (( i=1; i<=48; i+=1 ))
	do
    sed -n ${i}p $HOME/Weather_com_conky_script/hourly_svgs > $HOME/Weather_com_conky_script/Forecast_Images/h$i.svg
		cat $HOME/Weather_com_conky_script/svg_classes >> $HOME/Weather_com_conky_script/Forecast_Images/h$i.svg
		colorize_svg $HOME/Weather_com_conky_script/Forecast_Images/h$i.svg
  done
sed -i '/<svg xmlns/d' $HOME/Weather_com_conky_script/hourly
#Add leading zeros to hour values, where needed
for (( i=1; i<=424; i+=9 ))
	do
    if (( $(sed -n ${i}p $HOME/Weather_com_conky_script/hourly|wc -c) == 5 )); then
      sed -i ${i}s/^/0/ $HOME/Weather_com_conky_script/hourly
    fi
  done


########################################################
# Moonrise/Moonset values from 10days file to now file #
########################################################
echo -e "\nmoonrise\n\n\n" >> $HOME/Weather_com_conky_script/now
tod_ton=$(sed -n 1p $HOME/Weather_com_conky_script/10days|awk '{ print $3 }')
if [[ $tod_ton == $night ]]; then
    sed -i "19s|^.*$|$(sed -n 8p $HOME/Weather_com_conky_script/10days)|" $HOME/Weather_com_conky_script/now
    sed -i '20s/^.*$/moonset/' $HOME/Weather_com_conky_script/now
    sed -i "21s|^.*$|$(sed -n 9p $HOME/Weather_com_conky_script/10days)|" $HOME/Weather_com_conky_script/now
elif [[ $tod_ton != $night ]]; then
    sed -i "19s|^.*$|$(sed -n 17p $HOME/Weather_com_conky_script/10days)|" $HOME/Weather_com_conky_script/now
    sed -i '20s/^.*$/moonset/' $HOME/Weather_com_conky_script/now
    sed -i "21s|^.*$|$(sed -n 18p $HOME/Weather_com_conky_script/10days)|" $HOME/Weather_com_conky_script/now
fi


###############
# Cleaning up #
###############
#rm $HOME/Weather_com_conky_script/{now_raw,10days_raw,10days_svgs,hourly_raw,hourly_svgs,svg_classes}


########################
# Convert svgs to pngs "
########################
for i in $HOME/Weather_com_conky_script/Forecast_Images/*.svg
do
	fn=$(basename "$i")
	n=${fn%.*}
#
	convert -background none $HOME/Weather_com_conky_script/Forecast_Images/"$n".svg $HOME/Weather_com_conky_script/Forecast_Images/"$n".png
#	rsvg-convert $HOME/Weather_com_conky_script/Forecast_Images/"$n".svg > $HOME/Weather_com_conky_script/Forecast_Images/"$n".png
done
#
rm $HOME/Weather_com_conky_script/Forecast_Images/*.svg


########################
# Resume weather conky #
########################
pkill -CONT -xf "$weather_conky_launch_command"

Last edited by il.harun (2020-10-13 16:20:14)

Offline

#3871 2020-10-13 23:07:24

TeoBigusGeekus
BL DieHard
From: /Greece/Kastoria
Registered: 2015-10-04
Posts: 1,413

Re: Conky weather+moon scripts (Accuw/WUndergr/Weather.com/NWS/MoonGiant)

Are you sure?
It doesn't work for me.


Please make Autocad Civil 3D and Archicad work on Linux!
Please make Autocad Civil 3D and Archicad work on Linux!
Please make Autocad Civil 3D and Archicad work on Linux!
Please make Autocad Civil 3D and Archicad work on Linux!

Offline

#3872 2020-10-14 07:13:47

il.harun
Member
Registered: 2020-06-04
Posts: 11

Re: Conky weather+moon scripts (Accuw/WUndergr/Weather.com/NWS/MoonGiant)

Working version of Weather_com_conky_script_14_10_2020.tar.gz, at the moment.
here: https://drive.google.com/drive/folders/ … sp=sharing
If it doesn't work for you, it means: weather_com continues to experiment.

Offline

#3873 2020-10-14 08:11:49

unklar
Member
Registered: 2015-10-31
Posts: 1,264

Re: Conky weather+moon scripts (Accuw/WUndergr/Weather.com/NWS/MoonGiant)

^^Teo, what works correctly here is the output of the now file (with your unchanged script)
The output of 10days is now only 117 lines long and the text output for "Today"; "Tomorrow"; "Tonight" is missing

2020-10-14-10-00-05_scrot.th.png

https://scrot.cloud/images/2020/10/14/2 … _scrot.png

@il.harun,
Your script does not work here either...  hmm

Last edited by unklar (2020-10-14 08:16:37)

Offline

#3874 2020-10-14 10:56:26

ceeslans
Member
Registered: 2015-09-30
Posts: 93

Re: Conky weather+moon scripts (Accuw/WUndergr/Weather.com/NWS/MoonGiant)

unklar wrote:

^^Teo, what works correctly here is the output of the now file (with your unchanged script)
@il.harun,
Your script does not work here either...  hmm

uhmmmm.... actually, il.harun's conkyweather script does work - or at least on my MX system. The 'now' + 'hourly' + '10 days'  files are correctly created.

BUT: no icons are generated mad cry


b8wY73nt.png

Offline

#3875 2020-10-14 11:40:15

ceeslans
Member
Registered: 2015-09-30
Posts: 93

Re: Conky weather+moon scripts (Accuw/WUndergr/Weather.com/NWS/MoonGiant)

^^ EDIT

the svg-->png conversion issue was easily solved, by copying the latest script section over to il-harun's script.
below the updated version, that runs flawlessly on my system (MX is based on Debian 10 buster too)

#!/usr/bin/env bash


#########################################################################################
# Put the command that launches the conky configuration file that uses this script here #
#########################################################################################
weather_conky_launch_command="conky -b"


#########################################################################################################
# Put your language's interpretation of today, tenday and hourly - as shown in weather.com's url - here #
# Example for German:														   	   				                                     	    #
#     today=heute																						                                            #
#     tenday=10tage																						                                          #
#     hourly=stundlich                                                                                  #	
# Example for French:																					                                          #
#     today=aujour																						                                          #
#     tenday=10jours																					                                          #
#     hourly=parheure																					                                          #
# etc., you get the idea																				                                        #
# Replace your language's abbreviations for the wind directions as well                                 #
# At last, change Night to whatever it is in your language: Nacht, Nuit, Νύχτα, etc.                    #
#########################################################################################################
today=today
tenday=tenday
hourly=hourbyhour
north=N
south=S
west=W
east=E
#en
#
night=Night
#ru
#night=Ночь

###############################################################################################################################
# Put your Weather.com address here, add en-IE between weather.com and weather for metric. You can use any language you want. #
###############################################################################################################################
#address="https://weather.com/weather/today/l/d3e4167b6d899b0052a00ed051f449d51c5fc10e852f659680f3b6e0ed2c638b"
#address="https://weather.com/en-IE/weather/today/l/44114afd18d51b90206ceecf0e548aa87fe4ccfa9e6e746022ac3bd079d429c5"
#address="https://weather.com/en-IE/weather/today/l/ARBA0009:1:AR"
#address="https://weather.com/de-LI/wetter/heute/l/6f62e1be6a5f0d36914ae9eab7c3aedbbec5b5c6e0946c3fe6069a94435fc196"
#address="https://weather.com/el-GR/weather/today/l/44114afd18d51b90206ceecf0e548aa87fe4ccfa9e6e746022ac3bd079d429c5"
#address="https://weather.com/de-DE/wetter/heute/l/44114afd18d51b90206ceecf0e548aa87fe4ccfa9e6e746022ac3bd079d429c5"
address="https://weather.com/en-IE/weather/today/l/b82ceb3db8080589ea47a71c06871ea61de3a21bc710ab755c62c0e5ba885be1"


##########################
# Function: colorize_svg #
##########################
colorize_svg () {
    sed -i -e 's/var(--color-moon)/#e3e3e3/g' -e 's/var(--color-star)/#e3e3e3/g' -e 's/var(--color-cloud)/#d3d3d3/g' -e 's/var(--color-na)/#d3d3d3/g' -e 's/var(--color-fog)/#d3d3d3/g' -e 's/var(--color-hail)/#d3d3d3/g' -e 's/var(--color-tornado)/#d3d3d3/g' -e 's/var(--color-wind)/#d3d3d3/g' -e 's/var(--color-storm)/#d3d3d3/g' -e 's/var(--color-lightning)/#ebdb00/g' -e 's/var(--color-sun)/#ebdb00/g' -e 's/var(--color-drop)/#6adef8/g' -e 's/var(--color-snowflake)/#d3d3d3/g' -e 's/var(--color-thunderstorm-mask)/#2b2b2b/g' $1
}


############################
# Function: wind_direction #
############################
wind_direction() {
  if (( $1 >= 350 && $1 <= 10 )); then
    echo $north
  elif (( $1 > 10 && $1 < 80 )); then
    echo $north$east
  elif (( $1 >= 80 && $1 <= 100 )); then
    echo $east
  elif (( $1 > 100 && $1 < 170 )); then
    echo $south$east
  elif (( $1 >= 170 && $1 <= 190 )); then  
    echo $south
  elif (( $1 > 190 && $1 < 260 )); then
    echo $south$west
  elif (( $1 >= 260 && $1 <= 280 )); then  
    echo $west
  elif (( $1 > 280 && $1 < 350 )); then
    echo $north$west    
  fi
}


#######################
# Pause weather conky #
#######################
pkill -STOP -xf "$weather_conky_launch_command"


#######
# Now #
#######
curl \
  -H 'authority: weather.com' \
  -H 'cache-control: max-age=0' \
  -H 'upgrade-insecure-requests: 1' \
  -H 'user-agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.142 Safari/537.36' \
  -H 'accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9' \
  -H 'sec-fetch-site: none' \
  -H 'sec-fetch-mode: navigate' \
  -H 'sec-fetch-user: ?1' \
  -H 'sec-fetch-dest: document' \
  -H 'accept-language: en-US,en;q=0.9' \
  -H 'cookie: logatimLevel=INFO; akacd_NxtGen-DHLS=2177452799~rv=98~id=614d27d4c75f75df7bad5550f54e64b1; speedpin=4G; ci=TWC-Locale-Group=US&X-Origin-Hint=Prod-IBM-LS&TWC-GeoIP-Country=DE&TWC-Privacy=gdpr' \
  --compressed -o $HOME/Weather_com_conky_script/now_raw "$address"

sed '/CurrentConditions--tempValue--3KcTQ">\|set="current-conditions" name="moonphase"/!d' $HOME/Weather_com_conky_script/now_raw > $HOME/Weather_com_conky_script/now
tr -d '\n' < $HOME/Weather_com_conky_script/now > $HOME/Weather_com_conky_script/now_temp
mv $HOME/Weather_com_conky_script/now_temp $HOME/Weather_com_conky_script/now
sed -i 's/\u002F//g' $HOME/Weather_com_conky_script/now
sed -i 's/<\/span>/\n/g' $HOME/Weather_com_conky_script/now
sed -i '/"precipPhrase"/d' $HOME/Weather_com_conky_script/now
sed -i '/3KcTQ">\|CurrentConditions--phraseValue--2xXSr">\|TemperatureValue">\|feelsLikeTempValue--2aogo">\|name="sunset-line" \|name="wind"\|name="humidity"\|name="dewpoint"\|name="dewpoint"\|name="pressure"\|name="uv"\|name="visibility"\|name="moonphase"/!d' $HOME/Weather_com_conky_script/now
sed -i -e '1s/^.*3KcTQ">//' -e 's/^.*phraseValue--2xXSr">//g' -e 's/"TemperatureValue">/\n/g' -e 's/^.*precipValue--RBVJT"><span>//' -e 's/^.*feelsLikeTempValue--2aogo">//' -e 's/SunriseSunset--dateValue--2nwgx">/\n/g' -e '/SegmentHighTemp/d' $HOME/Weather_com_conky_script/now
sed -i -e '/SunriseSunsetContainer/d' -e '/\/<span data-testid=/d' -e 's/<\/p><\/div>.*$//g' -e 's/^.*"PercentageValue">//g' -e 's/^.*"UVIndexValue">//g' -e 's/^.*"VisibilityValue">//g' -e '/name="dewpoint"/d' -e 's/<\/div><\/div><div class="_-_-components-src-organism.*$//g' -e 's/^.*transform:rotate(//g' -e 's/deg)" set/deg\n/g' $HOME/Weather_com_conky_script/now
sed -i -e 's/^.*<\/path><\/svg>//g' -e 's/^.*wxData--23DP5">//g' -e 's/<\/div>.*$//g' -e 's/deg//g' -e '13s/%//' -e 's/°//g' -e '16s/Unlimited/Unlim\./' $HOME/Weather_com_conky_script/now
sed -i 's/^.*>//g' $HOME/Weather_com_conky_script/now
w_degrees=$(sed -n 10p $HOME/Weather_com_conky_script/now)
w_direction=$(wind_direction $w_degrees)
sed -i 10s/^.*$/$w_direction/ $HOME/Weather_com_conky_script/now
#Tidy up now file
sed -n 1,2p $HOME/Weather_com_conky_script/now > $HOME/Weather_com_conky_script/now_temp
sed -n 5p $HOME/Weather_com_conky_script/now >> $HOME/Weather_com_conky_script/now_temp
sed -n 3,4p $HOME/Weather_com_conky_script/now >> $HOME/Weather_com_conky_script/now_temp
sed -n 15p $HOME/Weather_com_conky_script/now >> $HOME/Weather_com_conky_script/now_temp
sed -n 10p $HOME/Weather_com_conky_script/now >> $HOME/Weather_com_conky_script/now_temp
wind_speed=$(sed -n 11p $HOME/Weather_com_conky_script/now)
sed -i "7s|$| $wind_speed|" $HOME/Weather_com_conky_script/now_temp
sed -n 12p $HOME/Weather_com_conky_script/now >> $HOME/Weather_com_conky_script/now_temp
sed -n 13p $HOME/Weather_com_conky_script/now >> $HOME/Weather_com_conky_script/now_temp
sed -n 14p $HOME/Weather_com_conky_script/now >> $HOME/Weather_com_conky_script/now_temp
sed -n 16p $HOME/Weather_com_conky_script/now >> $HOME/Weather_com_conky_script/now_temp
echo "sunrise" >> $HOME/Weather_com_conky_script/now_temp
sed -n 6p $HOME/Weather_com_conky_script/now >> $HOME/Weather_com_conky_script/now_temp
echo "sunset" >> $HOME/Weather_com_conky_script/now_temp
sed -n 7p $HOME/Weather_com_conky_script/now >> $HOME/Weather_com_conky_script/now_temp
echo "moonphrase" >> $HOME/Weather_com_conky_script/now_temp
sed -n 17p $HOME/Weather_com_conky_script/now >> $HOME/Weather_com_conky_script/now_temp
mv $HOME/Weather_com_conky_script/now_temp $HOME/Weather_com_conky_script/now
#extract svg now
sed '/<svg>/!d' $HOME/Weather_com_conky_script/now_raw > $HOME/Weather_com_conky_script/svg_classes
sed -i -e 's/^.*<svg>//' -e 's/<\/svg>.*$/<\/svg>/' $HOME/Weather_com_conky_script/svg_classes
sed '/<svg set="weather/!d' $HOME/Weather_com_conky_script/now_raw > $HOME/Weather_com_conky_script/Forecast_Images/now.svg
sed -i 's/<svg/\n<svg/g' $HOME/Weather_com_conky_script/Forecast_Images/now.svg
sed -i -e '/<svg set="weather/!d' -e 's/<\/svg>.*$//g' $HOME/Weather_com_conky_script/Forecast_Images/now.svg
sed -i -e '2,$d' -e 's/^.*viewBox/<svg xmlns:xlink="http:\/\/www.w3.org\/1999\/xlink" viewBox/' $HOME/Weather_com_conky_script/Forecast_Images/now.svg
cat $HOME/Weather_com_conky_script/svg_classes >> $HOME/Weather_com_conky_script/Forecast_Images/now.svg
colorize_svg $HOME/Weather_com_conky_script/Forecast_Images/now.svg


###########
# 10 Days #
###########
address10=$(echo $address|sed s/$today/$tenday/)
curl \
  -H 'authority: weather.com' \
  -H 'cache-control: max-age=0' \
  -H 'upgrade-insecure-requests: 1' \
  -H 'user-agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.142 Safari/537.36' \
  -H 'accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9' \
  -H 'sec-fetch-site: none' \
  -H 'sec-fetch-mode: navigate' \
  -H 'sec-fetch-user: ?1' \
  -H 'sec-fetch-dest: document' \
  -H 'accept-language: en-US,en;q=0.9' \
  -H 'cookie: logatimLevel=INFO; akacd_NxtGen-DHLS=2177452799~rv=98~id=614d27d4c75f75df7bad5550f54e64b1; speedpin=4G; ci=TWC-Locale-Group=US&X-Origin-Hint=Prod-IBM-LS&TWC-GeoIP-Country=DE&TWC-Privacy=gdpr' \
  --compressed -o $HOME/Weather_com_conky_script/10days_raw "$address10"

sed '/DetailsSummary--daypartName--1Mebr"/!d' $HOME/Weather_com_conky_script/10days_raw > $HOME/Weather_com_conky_script/10days
sed -i -e 's/DetailsSummary--daypartName--1Mebr">/\n/g' -e 's/DailyContent--daypartDate--3MM0J">/\n/g' -e 's/DailyContent--temp--_8DL5">/\n/g' -e 's/"weatherIcon" class=[^>]*>/\n/g' -e 's/highTempValue--3x6cL">/\n/g' -e 's/lowTempValue--1DlJK">/\n/g' -e 's/DetailsSummary--condition--mqdxh">/\n/g' -e 's/<span class="[^>]*DetailsSummary--extendedData[^>]*>/\n/g' -e 's/"PercentageValue">/\n/g' -e 's/windWrapper--1Va1P undefined">/\n/g' $HOME/Weather_com_conky_script/10days
sed -i -e 's/"PercentageValue" class="[^>]*>/\n/g' -e 's/windWrapper--[^>]*>/\n/g' -e 's/DailyContent--narrative--3AcXd">/\n/g' -e 's/"UVIndexValue" class="[^>]*>/\n/g' -e 's/"SunriseTime" class="[^>]*>/\n/g' -e 's/"SunsetTime" class="[^>]*>/\n/g' -e 's/"MoonriseTime" class="[^>]*>/\n/g' -e 's/"MoonsetTime" class="[^>]*>/\n/g' $HOME/Weather_com_conky_script/10days
sed -i -e '/<\/head><body>/d' -e 's/<\/span> | / /g' -e 's/<\/span>.*$//g' -e 's/<\/h3>.*$//g' -e 's/<!-- -->//g' -e 's/<\/svg>.*$//g' -e 's/<\/p><\/div>.*$//g' -e 's/<svg class.*viewBox/<svg xmlns:xlink="http:\/\/www.w3.org\/1999\/xlink" viewBox/g' -e 's/<\/h2>.*$//g' -e '/<svg aria-hidden/d' $HOME/Weather_com_conky_script/10days
sed -i '/ '"$night"'$/{4,$!b;n;n;d}' $HOME/Weather_com_conky_script/10days
#extract svg days
sed '/<svg xmlns/!d' $HOME/Weather_com_conky_script/10days > $HOME/Weather_com_conky_script/10days_svgs
for (( i=1; i<=15; i+=1 ))
	do
    sed -n ${i}p $HOME/Weather_com_conky_script/10days_svgs > $HOME/Weather_com_conky_script/Forecast_Images/d$i.svg
		cat $HOME/Weather_com_conky_script/svg_classes >> $HOME/Weather_com_conky_script/Forecast_Images/d$i.svg
		colorize_svg $HOME/Weather_com_conky_script/Forecast_Images/d$i.svg
  done
sed -i '/<svg xmlns/d' $HOME/Weather_com_conky_script/10days


##########
# Hourly #
##########
addressH=$(echo $address|sed s/$today/$hourly/)
curl \
  -H 'authority: weather.com' \
  -H 'cache-control: max-age=0' \
  -H 'upgrade-insecure-requests: 1' \
  -H 'user-agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.142 Safari/537.36' \
  -H 'accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9' \
  -H 'sec-fetch-site: none' \
  -H 'sec-fetch-mode: navigate' \
  -H 'sec-fetch-user: ?1' \
  -H 'sec-fetch-dest: document' \
  -H 'accept-language: en-US,en;q=0.9' \
  -H 'cookie: logatimLevel=INFO; akacd_NxtGen-DHLS=2177452799~rv=98~id=614d27d4c75f75df7bad5550f54e64b1; speedpin=4G; ci=TWC-Locale-Group=US&X-Origin-Hint=Prod-IBM-LS&TWC-GeoIP-Country=DE&TWC-Privacy=gdpr' \
  --compressed -o $HOME/Weather_com_conky_script/hourly_raw "$addressH"

sed '/DetailsSummary--daypartName--1Mebr">/!d' $HOME/Weather_com_conky_script/hourly_raw > $HOME/Weather_com_conky_script/hourly
sed -i -e 's/DetailsSummary--daypartName--1Mebr">/\n/g' -e 's/DetailsSummary--tempValue--RcZzi">/\n/g' -e 's/DetailsSummary--condition--mqdxh">/\n/g' -e 's/windWrapper--1Va1P undefined">/\n/g' -e 's/HourlyContent--wxPhraseLong--2CO9i">/\n/g' -e 's/DetailsTable--value--1F3Ze">/\n/g' -e 's/data-testid="PercentageValue">/\n/g' $HOME/Weather_com_conky_script/hourly
sed -i -e '/<\/head><body>/d' -e 's/<\/span>.*$//g' -e 's/<\/h2>.*$//g' -e 's/<!-- -->//g' -e 's/<\/p>.*$//g' -e 's/<\/svg>.*$//g' -e 's/<svg.*viewBox/<svg xmlns:xlink="http:\/\/www.w3.org\/1999\/xlink" viewBox/g' $HOME/Weather_com_conky_script/hourly
#extract svg hourly
sed '/<svg xmlns/!d' $HOME/Weather_com_conky_script/hourly > $HOME/Weather_com_conky_script/hourly_svgs
for (( i=1; i<=48; i+=1 ))
	do
    sed -n ${i}p $HOME/Weather_com_conky_script/hourly_svgs > $HOME/Weather_com_conky_script/Forecast_Images/h$i.svg
		cat $HOME/Weather_com_conky_script/svg_classes >> $HOME/Weather_com_conky_script/Forecast_Images/h$i.svg
		colorize_svg $HOME/Weather_com_conky_script/Forecast_Images/h$i.svg
  done
sed -i '/<svg xmlns/d' $HOME/Weather_com_conky_script/hourly
#Add leading zeros to hour values, where needed
for (( i=1; i<=424; i+=9 ))
	do
    if (( $(sed -n ${i}p $HOME/Weather_com_conky_script/hourly|wc -c) == 5 )); then
      sed -i ${i}s/^/0/ $HOME/Weather_com_conky_script/hourly
    fi
  done


########################################################
# Moonrise/Moonset values from 10days file to now file #
########################################################
echo -e "\nmoonrise\n\n\n" >> $HOME/Weather_com_conky_script/now
tod_ton=$(sed -n 1p $HOME/Weather_com_conky_script/10days|awk '{ print $3 }')
if [[ $tod_ton == $night ]]; then
    sed -i "19s|^.*$|$(sed -n 8p $HOME/Weather_com_conky_script/10days)|" $HOME/Weather_com_conky_script/now
    sed -i '20s/^.*$/moonset/' $HOME/Weather_com_conky_script/now
    sed -i "21s|^.*$|$(sed -n 9p $HOME/Weather_com_conky_script/10days)|" $HOME/Weather_com_conky_script/now
elif [[ $tod_ton != $night ]]; then
    sed -i "19s|^.*$|$(sed -n 17p $HOME/Weather_com_conky_script/10days)|" $HOME/Weather_com_conky_script/now
    sed -i '20s/^.*$/moonset/' $HOME/Weather_com_conky_script/now
    sed -i "21s|^.*$|$(sed -n 18p $HOME/Weather_com_conky_script/10days)|" $HOME/Weather_com_conky_script/now
fi


###############
# Cleaning up #
###############
#
rm $HOME/Weather_com_conky_script/{now_raw,10days_raw,10days_svgs,hourly_raw,hourly_svgs,svg_classes}


########################
# Convert svgs to pngs "
########################
for i in $HOME/.conky/weatherCom/Forecast_Images/*.svg
do
	fn=$(basename "$i")
	n=${fn%.*}
	convert -background none $HOME/.conky/weatherCom/Forecast_Images/"$n".svg $HOME/.conky/weatherCom/Forecast_Images/"$n".png
done
rm $HOME/.conky/weatherCom/Forecast_Images/*.svg


########################
# Resume weather conky #
########################
pkill -CONT -xf "$weather_conky_launch_command"

scrot or it didn't happen...
I8lEwfjt.png

Last edited by ceeslans (2020-10-14 11:41:51)

Offline

Board footer

Powered by FluxBB