You are not logged in.
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
WOW!!! That's nice. I like it.
{) {)
Nothing happens by chance
Offline
@fvirgola80
Nice job my friend, congratulations!!!
![]()
]:D {) {)
Nothing happens by chance
Offline
@fvirgola80
questo è eccellente! O:)
Grazie unklar
{)
Nothing happens by chance
Offline
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
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
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
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
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
^^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
https://scrot.cloud/images/2020/10/14/2 … _scrot.png
@il.harun,
Your script does not work here either...
Last edited by unklar (2020-10-14 08:16:37)
Offline
^^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...
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 8.(
Offline
^^ 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"
Last edited by ceeslans (2020-10-14 11:41:51)
Offline
I suspect we're getting severely trolled by weather.com...
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
I'll be damned! It works on me as well.
So, from what we've got from all this up until now, is that weather.com is using the same pieces of alternating code all this time, am I correct?
If so, all these updates, all these (endless) months... Have I been chasing my tail?
@ceeslans
Which piece of il-harun's code did you add to the current script to make it work? Was it a piece of a previous version of the script?
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
ANNOUNCEMENT:
Weather.com script updated by... il.harun and ceeslans, both of whom I'd like to thank for their great insight and instict.
When I was watching the trees and not the forest, they managed to see the whole picture and realise what's going on here.
S11 has been right all along: weather.com are changing their layout automatically every now and then according to some predefined templates which are alternating. Practically, it means that I write a script for a specific layout, then the layout is changed, then it appears again and I write a new script for this specific layout, cause it never occurred to me that they might be using something from the past. Even more practically, it means that I'm a moron...
Just pull the new script, which isn't actually new, but a collage from old ones.
Last edited by TeoBigusGeekus (2020-10-16 20:32:21)
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
I'll be damned! It works on me as well.
...
@ceeslans: Which piece of il-harun's code did you add to the current script to make it work? Was it a piece of a previous version of the script?
I downloaded the archive that il_harun offered in post #3872 and extracted the weather_com script. Then I ran that script, and found all details were correctly drawn from the weather.com server - except for the svg/png conversion.
As said, this was easily resolved by replacing conversion code (line 259-269 in il_harun's script) with the correct code (taken from from your latest script version)...
Last edited by ceeslans (2020-10-17 07:36:52)
Offline
Alright, then, thanks.
@il.harun
Where did you find the code you've posted?
Was it an earlier version of the script?
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
ANNOUNCEMENT:
Even more practically, it means that I'm a moron...
ABSOLUTELY DISAGREE!
One person cannot see everything all the time.
Sometimes it takes fresh eyes to see through the smokescreen!
You are the Master Weatherman!
We all need a little help every now and then.
sudo apt install --no-install-recommends artha
and I'm closer than you are - hahahahahaha
And there is actually a University of Moron as well!
Debian 12 Beardog, SoxDog and still a Conky 1.9er
Offline
Hello
Theo great job working good by me with new script
@+
Linuxmint 22.1 Xia xfce & mageia 9 XFCE on ssd hp pavilion g7
Xubuntu 18.04 lts & 24.04 lts on ASUS Rog STRIX
Offline