You are not logged in.

#3751 2020-08-30 05:23:03

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

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

Hi guys.
I accidentally saw that old scripts are working on weather_com

weather_com:

#!/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																				#
#########################################################################################################
today=today
tenday=tenday
hourly=hourbyhour


###############################################################################################################################
# Put your Weather.com address here, add en-GB between weather.com and weather for metric. You can use any language you want. #
###############################################################################################################################
#address="https://weather.com/weather/today/l/USHI0026:1:US"
#address="https://weather.com/en-GB/weather/today/l/44114afd18d51b90206ceecf0e548aa87fe4ccfa9e6e746022ac3bd079d429c5"
#address="https://weather.com/en-GB/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-IE/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-RU/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-cloud)/#fff/g' -e 's/var(--color-star)/#fff/g' -e 's/var(--color-wind)/#fff/g' -e 's/var(--color-fog)/#fff/g' -e 's/var(--color-moon)/#e6e6e6/g' -e 's/var(--color-lightning)/#f2df00/g' -e 's/var(--color-drop)/#6ec4e9/g' -e 's/var(--color-sun)/#f9ed32/g' -e 's/var(--color-snowflake)/#fff/g' -e 's/var(--color-hail)/#fff/g' -e 's/var(--color-sun-center)/#f9ed32/g' -e 's/var(--color-sun-ray)/#f9ed32/g' $1
}


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

sleep 1
#######
# Now #
#######
#wget -o /dev/null -O $HOME/Weather_com_conky_script/now_raw $address
#
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 '/\(<span>as of\)\|\(<\/span><\/td><\/tr><\/tbody><\/table>\)/!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 -e 's/^.*<span>as of//' -e 's/<\/span><\/td><\/tr><\/tbody><\/table>.*$//' $HOME/Weather_com_conky_script/now
sed -i -e 's/^.*<\/svg><\/icon><\/div><div class="today_nowcard-temp"><span class="">//' -e 's/today_nowcard-phrase">/\n/' -e 's/deg-feels">/\n/' -e 's/\(<span class="">\)\|\(<span>\)/\n/g' $HOME/Weather_com_conky_script/now
sed -i 's/<.*$//g' $HOME/Weather_com_conky_script/now
sed -i '/^$/d' $HOME/Weather_com_conky_script/now
sed -i 's/\u002F//g' $HOME/Weather_com_conky_script/now

sed '/"sunrise"/!d' $HOME/Weather_com_conky_script/now_raw > $HOME/Weather_com_conky_script/sun_moon
tr -d '\n' < $HOME/Weather_com_conky_script/sun_moon > $HOME/Weather_com_conky_script/sun_moon_temp
mv $HOME/Weather_com_conky_script/sun_moon_temp $HOME/Weather_com_conky_script/sun_moon
sed -i 's/"sunrise":"/\n"sunrise":"/' $HOME/Weather_com_conky_script/sun_moon
sed -i -e '1d' -e 's/","dayOfWeek":.*$//' $HOME/Weather_com_conky_script/sun_moon
sed -i -e 's/^.*"sunrise":"/sunrise\n/' -e 's/","sunset":"/\nsunset\n/' -e 's/","moonIcon".*"moonPhrase":"/\nmoonphrase\n/' -e 's/","moonrise":"/\nmoonrise\n/' -e 's/","moonset":"/\nmoonset\n/' -e 's/","dayOfWeek.*$//' /$HOME/Weather_com_conky_script/sun_moon
echo "" >> $HOME/Weather_com_conky_script/now
cat $HOME/Weather_com_conky_script/sun_moon >> $HOME/Weather_com_conky_script/now
rm $HOME/Weather_com_conky_script/sun_moon
sed -i -e '13s/^.*T//' -e '13s/:/END/2' -e '13s/END.*$//' -e '15s/^.*T//' -e '15s/:/END/2' -e '15s/END.*$//' -e '19s/^.*T//' -e '19s/:/END/2' -e '19s/END.*$//' -e '21s/^.*T//' -e '21s/:/END/2' -e '21s/END.*$//' $HOME/Weather_com_conky_script/now

sed '/<svg>/!d' $HOME/Weather_com_conky_script/now_raw > $HOME/Weather_com_conky_script/now_svg_classes
sed -i -e 's/^.*<svg>//' -e 's/<\/svg>.*$/<\/svg>/' $HOME/Weather_com_conky_script/now_svg_classes

sed '/<svg xmlns=/,/<\/icon>/!d' $HOME/Weather_com_conky_script/now_raw > $HOME/Weather_com_conky_script/Forecast_Images/now.svg
sed -i -e 's/<\/icon>/\n/g' -e 's/<svg xmlns=/\n<svg xmlns=/g' $HOME/Weather_com_conky_script/Forecast_Images/now.svg
sed -i '/<svg xmlns=/!d' $HOME/Weather_com_conky_script/Forecast_Images/now.svg
sed -i '/<\/svg>$/!d' $HOME/Weather_com_conky_script/Forecast_Images/now.svg
sed -i '2,$d' $HOME/Weather_com_conky_script/Forecast_Images/now.svg
sed -i 's/<\/svg>//' $HOME/Weather_com_conky_script/Forecast_Images/now.svg
cat $HOME/Weather_com_conky_script/now_svg_classes >> $HOME/Weather_com_conky_script/Forecast_Images/now.svg
colorize_svg $HOME/Weather_com_conky_script/Forecast_Images/now.svg
rm $HOME/Weather_com_conky_script/now_svg_classes

sleep 1
###########
# 10 Days #
###########
address10=$(echo $address|sed s/$today/$tenday/)
#wget -o /dev/null -O $HOME/Weather_com_conky_script/10days_raw $address10
#
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 '/{"dayPartName"/!d' $HOME/Weather_com_conky_script/10days_raw > $HOME/Weather_com_conky_script/10days
sed -i 's/{"dayPartName"/\n{"dayPartName"/g' $HOME/Weather_com_conky_script/10days
sed -i -e '/{"dayPartName"/!d' -e '/{"dayPartName":null/d' $HOME/Weather_com_conky_script/10days
sed -i 's/\(validDate.*}}]}\).*$/\1/' $HOME/Weather_com_conky_script/10days
sed -i 's/\("humidityPct":.*\),"qualifier".*$/\1/g' $HOME/Weather_com_conky_script/10days
sed -i -e 's/\(":"\)\|\(","\)\|\(":\)\|\(\,"\)\|\("}},{"\)/\n/g' -e 's/"}//g' -e 's/}]}//g' $HOME/Weather_com_conky_script/10days
sed -i '/{"dayPartName/d' $HOME/Weather_com_conky_script/10days
sed -i 's/\u002F//g' $HOME/Weather_com_conky_script/10days

sed '/<svg>/!d' $HOME/Weather_com_conky_script/10days_raw > $HOME/Weather_com_conky_script/10days_svg_classes
sed -i -e 's/^.*<svg>//' -e 's/<\/svg>.*$/<\/svg>/' $HOME/Weather_com_conky_script/10days_svg_classes

sed '/<svg xmlns=/,/<\/icon>/!d' $HOME/Weather_com_conky_script/10days_raw > $HOME/Weather_com_conky_script/10days_svgs
sed -i -e 's/<\/icon>/\n/g' -e 's/<svg xmlns=/\n<svg xmlns=/g' $HOME/Weather_com_conky_script/10days_svgs
sed -i '/<svg xmlns=/!d' $HOME/Weather_com_conky_script/10days_svgs
sed -i '/<\/svg>$/!d' $HOME/Weather_com_conky_script/10days_svgs
for (( i=1; i<=15; i++ ))
	do
		sed -n ${i}p $HOME/Weather_com_conky_script/10days_svgs > $HOME/Weather_com_conky_script/Forecast_Images/d$i.svg
		sed -i 's/<\/svg>//' $HOME/Weather_com_conky_script/Forecast_Images/d$i.svg
		cat $HOME/Weather_com_conky_script/10days_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
rm $HOME/Weather_com_conky_script/{10days_svgs,10days_svg_classes}

sleep 1
##########
# Hourly #
##########
addressH=$(echo $address|sed s/$today/$hourly/)
#wget -o /dev/null -O $HOME/Weather_com_conky_script/hourly_raw $addressH
#
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 '/\[{"processTime"/!d' $HOME/Weather_com_conky_script/hourly_raw > $HOME/Weather_com_conky_script/hourly
sed -i 's/^.*\[{"processTime"/{"processTime"/' $HOME/Weather_com_conky_script/hourly
sed -i 's/{"processTime":"/\n/g' $HOME/Weather_com_conky_script/hourly
sed -i '$d' $HOME/Weather_com_conky_script/hourly
sed -i 's/\(,"\)\|\(":\)/\n/g' $HOME/Weather_com_conky_script/hourly
sed -i 's/\("\)\|\(},\)//g' $HOME/Weather_com_conky_script/hourly
sed -i '/^$/d' $HOME/Weather_com_conky_script/hourly
for (( i=1; i<=1335; i+=29 ))
	do
		sed -i -e ${i}s/^.*T// -e ${i}s/:/END/2 -e ${i}s/END.*$// $HOME/Weather_com_conky_script/hourly
	done
sed -i 's/\u002F//g' $HOME/Weather_com_conky_script/hourly

sed '/<svg>/!d' $HOME/Weather_com_conky_script/hourly_raw > $HOME/Weather_com_conky_script/hourly_svg_classes
sed -i -e 's/^.*<svg>//' -e 's/<\/svg>.*$/<\/svg>/' $HOME/Weather_com_conky_script/hourly_svg_classes

sed '/<svg xmlns=/,/<\/icon>/!d' $HOME/Weather_com_conky_script/hourly_raw > $HOME/Weather_com_conky_script/hourly_svgs
sed -i 's/^.*main-HourlyForecast//' $HOME/Weather_com_conky_script/hourly_svgs
sed -i -e 's/<\/icon>/\n/g' -e 's/<svg xmlns=/\n<svg xmlns=/g' $HOME/Weather_com_conky_script/hourly_svgs
sed -i '/<svg xmlns=/!d' $HOME/Weather_com_conky_script/hourly_svgs
sed -i '/<\/svg>$/!d' $HOME/Weather_com_conky_script/hourly_svgs
for (( i=1; i<=16; i++ ))
	do
		sed -n ${i}p $HOME/Weather_com_conky_script/hourly_svgs > $HOME/Weather_com_conky_script/Forecast_Images/h$i.svg
		sed -i 's/<\/svg>//' $HOME/Weather_com_conky_script/Forecast_Images/h$i.svg
		cat $HOME/Weather_com_conky_script/hourly_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
rm $HOME/Weather_com_conky_script/{hourly_svgs,hourly_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"

Working addresses:
address="https://weather.com/ru-IE/weather/today/l/RSXX0063:1:RS"
address="https://weather.com/ru-IE/weather/today/l/aad6cfff41f8ff8ba6f7f704388aca9ef8ec099f20666c32d00f240a6f1b9d9f"
address="https://weather.com/en-RU/weather/today/l/RSXX0063:1:RS"

weather_com_conkyrc_horizontal_ru:

conky.config = {
--[[# -- Conky start -- #
##sh -c "cd $HOME/Weather_com_conky_script && sleep 2 && conky -c ./weather_com_conkyrc_horizontal_ru"
##cd $HOME/Weather_com_conky_script && conky -p 2 -c ./weather_com_conkyrc_horizontal_ru
#
#
#sh -c "sleep 2 && conky -c /home/ilia/.conkyrc1 && conky -c /home/ilia/.conkyrc2"#
#sh -c "sleep 2 && conky -c /home/ilia/conkyrc"#
#
#Ubuntu 2004 convert svg to png   install librsvg2-bin
#
]]--
-- Create own window instead of using desktop (required in nautilus)
	own_window = true,
--	own_window_type = 'override',
--
	own_window_argb_visual = true,
--
	own_window_argb_value = 200,

--
	own_window_transparent = true,

--	own_window_transparent = false,
--	own_window_colour = '000000',

	own_window_hints = 'undecorated,below,skip_taskbar,skip_pager,sticky',



-- Use double buffering (reduces flicker, may not work for everyone)
	double_buffer = true,

-- fiddle with window
	use_spacer = 'right',
	use_xft = true,

-- Update interval in seconds
	update_interval = 5,

-- Minimum size of text area
	minimum_width = 830, minimum_height = 300,
	maximum_width = 830,

	override_utf8_locale = true,

-- Draw shades?
--	draw_shades = true,
--
	draw_shades = false,
	draw_outline = false,

-- Text stuff
--	draw_outline = true,-- amplifies text if yes
--
	draw_borders = false,
--	draw_borders = true,

	font = 'Arial:size=10',
	uppercase = false,-- set to yes if you want all text to be in uppercase

-- Stippled borders?
	stippled_borders = 1,

-- border margins
	border_inner_margin = 9,

-- border width
	border_width = 1,

-- Default colors and also border colors, grey90 == #e5e5e5
	default_color = '#FFFFFF',
	color1 = '#949494',


-- Text alignment, other possible values are commented
--alignment top_left
	alignment = 'top_right',
--alignment bottom_left
--alignment bottom_right

-- Gap between borders of screen and text
	gap_x = 500,
	gap_y = 40,

	max_user_text = 38000,
	text_buffer_size = 4096,
	imlib_cache_size = 0,

--   Lua load --
--
--
	lua_load = './conkyconfig/LUA/bg.lua',


};

conky.text = [[
${voffset -5}${color1}${font Liberation Mono:bold:size=7}${alignc 2}Обновлено: ${execpi 100 ls -lt $HOME/Weather_com_conky_script/now | awk '{print $7, $6, $8}'}${font}${color}${voffset -12}
${color1}${font Arial:size=12}ПОГОДА ${hr 2}$color
#
${execi 1800 bash $HOME/Weather_com_conky_script/weather_com}#
#
${image $HOME/Weather_com_conky_script/Forecast_Images/now.png -p 0,10 -s 130x130}#
#${image $HOME/Weather_com_conky_script/Forecast_Images/moon_0.png -p 665,45 -s 80x80}#
#${image $HOME/Weather_com_conky_script/Forecast_Images/wind_0.png -p 580,30 -s 75x75}#
#
#
${goto 190}${font Arial:size=16}${execpi 100 sed -n '2p' $HOME/Weather_com_conky_script/now}$color1  |  $color${execpi 100 sed -n '1p' $HOME/Weather_com_conky_script/now}°(${execpi 100 sed -n '3p' $HOME/Weather_com_conky_script/now}°)
${goto 190}$color1${font Arial:size=12}Луна: $color${execpi 100 sed -n '17p' $HOME/Weather_com_conky_script/now}
${goto 190}$color1${font}Макс / Мин:$color ${execpi 100 sed -n '4p' $HOME/Weather_com_conky_script/now}° / ${execpi 100 sed -n '5p' $HOME/Weather_com_conky_script/now}°$color1  ${goto 320}| Ветер:$color ${execpi 100 sed -n '7p' $HOME/Weather_com_conky_script/now}$color1  ${goto 470}| УФ индекс:$color ${execpi 100 sed -n '6p' $HOME/Weather_com_conky_script/now}
#
${goto 190}${color1}Восход:$color ${execpi 100 sed -n '13p' $HOME/Weather_com_conky_script/now}$color1  ${goto 320}| Закат:$color ${execpi 100 sed -n '15p' $HOME/Weather_com_conky_script/now}$color1  ${goto 470}| Видимость:$color ${execpi 100 sed -n '11p' $HOME/Weather_com_conky_script/now}
#
${goto 190}${color1}Восход луны:$color ${execpi 100 sed -n '19p' $HOME/Weather_com_conky_script/now}$color1  ${goto 320}| Заход луны:$color ${execpi 100 sed -n '21p' $HOME/Weather_com_conky_script/now}$color1  ${goto 470}| Давл.:${execpi 100 sed -n '10p' $HOME/Weather_com_conky_script/now} $color ${execpi 100 sed -n '10p' $HOME/Weather_com_conky_script/now | cut -c -6 | sed 's/,//' | tr -cd "[:graph:]" | awk '{print ($1*0.7500637-12)}' | cut -c -3 } mmHg
#
#today ru
#
${if_match "${execpi 100 sed -n '1p' $HOME/Weather_com_conky_script/10days}" == "Сегодня"}
#today en
#${if_match "${execpi 100 sed -n '1p' $HOME/Weather_com_conky_script/10days}" == "Today"}
#
${lua conky_draw_bg 10 0 0 850 330 0x111111 0,7}#
#
${image $HOME/Weather_com_conky_script/Forecast_Images/d1.png -p 0,120 -s 70x70}${image $HOME/Weather_com_conky_script/Forecast_Images/d2.png -p 120,120 -s 70x70}${image $HOME/Weather_com_conky_script/Forecast_Images/d3.png -p 240,120 -s 70x70}${image $HOME/Weather_com_conky_script/Forecast_Images/d4.png -p 360,120 -s 70x70}${image $HOME/Weather_com_conky_script/Forecast_Images/d5.png -p 480,120 -s 70x70}${image $HOME/Weather_com_conky_script/Forecast_Images/d6.png -p 600,120 -s 70x70}${image $HOME/Weather_com_conky_script/Forecast_Images/d7.png -p 720,120 -s 70x70}${font Arial:size=10}


${color1}${goto 20}${font}${execpi 100 sed -n '1p' $HOME/Weather_com_conky_script/10days|cut -c1-14}${goto 140}${execpi 100 sed -n '63p' $HOME/Weather_com_conky_script/10days|cut -c1-12}${goto 260}${execpi 100 sed -n '125p' $HOME/Weather_com_conky_script/10days|cut -c1-6}${goto 380}${execpi 100 sed -n '187p' $HOME/Weather_com_conky_script/10days|cut -c1-6}${goto 500}${execpi 100 sed -n '249p' $HOME/Weather_com_conky_script/10days|cut -c1-6}${goto 620}${execpi 100 sed -n '311p' $HOME/Weather_com_conky_script/10days|cut -c1-6}${goto 740}${execpi 100 sed -n '373p' $HOME/Weather_com_conky_script/10days|cut -c1-6}$font$color
${goto 30}${execpi 100 sed -n '9p' $HOME/Weather_com_conky_script/10days}°/${execpi 100 sed -n '40p' $HOME/Weather_com_conky_script/10days}°${goto 150}${execpi 100 sed -n '71p' $HOME/Weather_com_conky_script/10days}°/${execpi 100 sed -n '102p' $HOME/Weather_com_conky_script/10days}°${goto 270}${execpi 100 sed -n '133p' $HOME/Weather_com_conky_script/10days}°/${execpi 100 sed -n '164p' $HOME/Weather_com_conky_script/10days}°${goto 390}${execpi 100 sed -n '195p' $HOME/Weather_com_conky_script/10days}°/${execpi 100 sed -n '226p' $HOME/Weather_com_conky_script/10days}°${goto 510}${execpi 100 sed -n '257p' $HOME/Weather_com_conky_script/10days}°/${execpi 100 sed -n '288p' $HOME/Weather_com_conky_script/10days}°${goto 630}${execpi 100 sed -n '319p' $HOME/Weather_com_conky_script/10days}°/${execpi 100 sed -n '350p' $HOME/Weather_com_conky_script/10days}°${goto 750}${execpi 100 sed -n '381p' $HOME/Weather_com_conky_script/10days}°/${execpi 100 sed -n '412p' $HOME/Weather_com_conky_script/10days}°
${else}
#
#tonight
#
${lua conky_draw_bg 10 0 0 850 330 0x000000 0,7}#
${image $HOME/Weather_com_conky_script/Forecast_Images/d1.png -p 0,120 -s 70x70}${image $HOME/Weather_com_conky_script/Forecast_Images/d2.png -p 120,120 -s 70x70}${image $HOME/Weather_com_conky_script/Forecast_Images/d3.png -p 240,120 -s 70x70}${image $HOME/Weather_com_conky_script/Forecast_Images/d4.png -p 360,120 -s 70x70}${image $HOME/Weather_com_conky_script/Forecast_Images/d5.png -p 480,120 -s 70x70}${image $HOME/Weather_com_conky_script/Forecast_Images/d6.png -p 600,120 -s 70x70}${image $HOME/Weather_com_conky_script/Forecast_Images/d7.png -p 720,120 -s 70x70}${font Arial:size=10}


${color1}${goto 20}${font}${execpi 100 sed -n '1p' $HOME/Weather_com_conky_script/10days|cut -c1-22}.${goto 140}${execpi 100 sed -n '32p' $HOME/Weather_com_conky_script/10days|cut -c1-12}${goto 260}${execpi 100 sed -n '94p' $HOME/Weather_com_conky_script/10days|cut -c1-6}${goto 380}${execpi 100 sed -n '156p' $HOME/Weather_com_conky_script/10days|cut -c1-6}${goto 500}${execpi 100 sed -n '218p' $HOME/Weather_com_conky_script/10days|cut -c1-6}${goto 620}${execpi 100 sed -n '280p' $HOME/Weather_com_conky_script/10days|cut -c1-6}${goto 740}${execpi 100 sed -n '342p' $HOME/Weather_com_conky_script/10days|cut -c1-6}$font$color
#
${goto 30}--°/${execpi 100 sed -n '9p' $HOME/Weather_com_conky_script/10days}°${goto 150}${execpi 100 sed -n '40p' $HOME/Weather_com_conky_script/10days}°/${execpi 100 sed -n '71p' $HOME/Weather_com_conky_script/10days}°${goto 270}${execpi 100 sed -n '102p' $HOME/Weather_com_conky_script/10days}°/${execpi 100 sed -n '133p' $HOME/Weather_com_conky_script/10days}°${goto 390}${execpi 100 sed -n '164p' $HOME/Weather_com_conky_script/10days}°/${execpi 100 sed -n '195p' $HOME/Weather_com_conky_script/10days}°${goto 510}${execpi 100 sed -n '226p' $HOME/Weather_com_conky_script/10days}°/${execpi 100 sed -n '257p' $HOME/Weather_com_conky_script/10days}°${goto 630}${execpi 100 sed -n '288p' $HOME/Weather_com_conky_script/10days}°/${execpi 100 sed -n '319p' $HOME/Weather_com_conky_script/10days}°${goto 750}${execpi 100 sed -n '350p' $HOME/Weather_com_conky_script/10days}°/${execpi 100 sed -n '381p' $HOME/Weather_com_conky_script/10days}°
${voffset -20}
${endif}
#hourly
${image $HOME/Weather_com_conky_script/Forecast_Images/h1.png -p 5,220 -s 45x45}${image $HOME/Weather_com_conky_script/Forecast_Images/h2.png -p 80,220 -s 45x45}${image $HOME/Weather_com_conky_script/Forecast_Images/h3.png -p 155,220 -s 45x45}${image $HOME/Weather_com_conky_script/Forecast_Images/h4.png -p 230,220 -s 45x45}${image $HOME/Weather_com_conky_script/Forecast_Images/h5.png -p 305,220 -s 45x45}${image $HOME/Weather_com_conky_script/Forecast_Images/h6.png -p 380,220 -s 45x45}${image $HOME/Weather_com_conky_script/Forecast_Images/h7.png -p 455,220 -s 45x45}${image $HOME/Weather_com_conky_script/Forecast_Images/h8.png -p 530,220 -s 45x45}${image $HOME/Weather_com_conky_script/Forecast_Images/h9.png -p 605,220 -s 45x45}${image $HOME/Weather_com_conky_script/Forecast_Images/h10.png -p 680,220 -s 45x45}${image $HOME/Weather_com_conky_script/Forecast_Images/h11.png -p 755,220 -s 45x45}

${voffset 3}${goto 25}${font Arial:size=8}${color1}${execpi 100 sed -n '1p' $HOME/Weather_com_conky_script/hourly}${goto 100}${execpi 100 sed -n '30p' $HOME/Weather_com_conky_script/hourly}${goto 175}${execpi 100 sed -n '59p' $HOME/Weather_com_conky_script/hourly}${goto 250}${execpi 100 sed -n '88p' $HOME/Weather_com_conky_script/hourly}${goto 325}${execpi 100 sed -n '117p' $HOME/Weather_com_conky_script/hourly}${goto 400}${execpi 100 sed -n '146p' $HOME/Weather_com_conky_script/hourly}${goto 475}${execpi 100 sed -n '175p' $HOME/Weather_com_conky_script/hourly}${goto 550}${execpi 100 sed -n '204p' $HOME/Weather_com_conky_script/hourly}${goto 620}${execpi 100 sed -n '233p' $HOME/Weather_com_conky_script/hourly}${goto 695}${execpi 100 sed -n '262p' $HOME/Weather_com_conky_script/hourly}${goto 775}${execpi 100 sed -n '291p' $HOME/Weather_com_conky_script/hourly}$color
${goto 35}${execpi 100 sed -n '3p' $HOME/Weather_com_conky_script/hourly}°${goto 110}${execpi 100 sed -n '32p' $HOME/Weather_com_conky_script/hourly}°${goto 185}${execpi 100 sed -n '61p' $HOME/Weather_com_conky_script/hourly}°${goto 260}${execpi 100 sed -n '90p' $HOME/Weather_com_conky_script/hourly}°${goto 335}${execpi 100 sed -n '119p' $HOME/Weather_com_conky_script/hourly}°${goto 410}${execpi 100 sed -n '148p' $HOME/Weather_com_conky_script/hourly}°${goto 485}${execpi 100 sed -n '177p' $HOME/Weather_com_conky_script/hourly}°${goto 560}${execpi 100 sed -n '206p' $HOME/Weather_com_conky_script/hourly}°${goto 635}${execpi 100 sed -n '235p' $HOME/Weather_com_conky_script/hourly}°${goto 710}${execpi 100 sed -n '264p' $HOME/Weather_com_conky_script/hourly}°${goto 785}${execpi 100 sed -n '293p' $HOME/Weather_com_conky_script/hourly}°
${color1}${hr 2}
]];

Xubuntu 2004

Upd.
In new script works only en:
address="https://weather.com/en-IE/weather/today/l/aad6cfff41f8ff8ba6f7f704388aca9ef8ec099f20666c32d00f240a6f1b9d9f"

Last edited by il.harun (2020-08-30 06:31:06)

Offline

#3752 2020-08-30 07:00:27

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

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

TeoBigusGeekus wrote:

Candidate for the new weather.com script

NL Rotterdam (English) flawless

Offline

#3753 2020-08-30 07:23:20

loutch
Member
Registered: 2015-12-12
Posts: 471

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

Hello

@ Théo

Work great in french to

GREAT JOB as usual

@+


Linuxmint 19.1 Tessa cinnamon & mageia 8 Plasma5 & XFCE on ssd hp pavilion g7
Xubuntu 18.04 lts & 21.04 lts on ASUS Rog STRIX

Offline

#3754 2020-08-30 12:18:42

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

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

Italy @ Gorlago(BG) - English - Perfect.

Thank @Teo

Offline

#3755 2020-08-30 13:47:40

manuel-909
Member
Registered: 2017-10-09
Posts: 94

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

weather.com working english thanks teo.....

Offline

#3756 2020-08-30 14:30:11

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

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

Hi Teo.
For me there are still problems.
Conky's go to pieces.
I don't know it's a server problem, or whatever, duckduckgo is having a tantrum today.
Thank

Offline

#3757 2020-08-30 16:02:04

arof
Member
Registered: 2020-08-09
Posts: 6

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

il.harun wrote:

In new script works only en

It's not true. In PL works perfect.

Offline

#3758 2020-08-30 18:10:08

unklar
Back to the roots 1.9
From: #! BL
Registered: 2015-10-31
Posts: 1,546

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

^Saxony @ DE - german - wonderful
Many thanks Teo   smile

Offline

#3759 2020-08-30 19:03:39

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

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

Yes work:
address="https://weather.com/ru-RU/weather/today/l/RSXX0063:1:RS"
address="https://weather.com/ru-RU/weather/today/l/aad6cfff41f8ff8ba6f7f704388aca9ef8ec099f20666c32d00f240a6f1b9d9f"

  fine

Offline

#3760 2020-08-30 20:59:32

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

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

Thanks a lot guys, it really helps me.
And apparently il.harun is right; that very old version of the script works (!!!!)
Maybe S11 is right, they're indeed changing their pages' layouts based on a schedule.
The problem is that I only keep a very recent archive of the scripts (because my pc was full with old versions of every kind of script, some 9 or 10 years old, and I decided to delete everything apart from only the recent ones sad).
We'll see...

@ector1935
For the Italian forecast pay attention to the variables.

Last edited by TeoBigusGeekus (2020-08-30 21:05:33)


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!

Online

#3761 2020-08-31 03:03:56

seatommyboy
Member
Registered: 2016-09-12
Posts: 40

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

TeoBigusGeekus wrote:

Candidate for the new weather.com script:

#!/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
night=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/USHI0026:1:US"
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"


##########################
# 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

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="_-_-node_modules--wxu-components-src-molecule-DaypartDetails-DailyContent-DailyContent--Condition--3fAIb">/\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="_-_-node_modules--wxu-components-src-molecule-DaypartDetails-DetailsSummary-DetailsSummary--extendedData--aaFeV">/\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="_-_-node_modules--wxu-components-src-molecule-DaypartDetails-DailyContent-DailyContent--value--3Xvjn">/\n/g' -e 's/windWrapper--1Va1P _-_-node_modules--wxu-components-src-molecule-DaypartDetails-DailyContent-DailyContent--value--3Xvjn">/\n/g' -e 's/DailyContent-DailyContent--narrative--3AcXd">/\n/g' -e 's/"PercentageValue" class="_-_-node_modules--wxu-components-src-molecule-DaypartDetails-DetailsTable-DetailsTable--value--1F3Ze">/\n/g' -e 's/"UVIndexValue" class="_-_-node_modules--wxu-components-src-molecule-DaypartDetails-DetailsTable-DetailsTable--value--1F3Ze">/\n/g' -e 's/"SunriseTime" class="_-_-node_modules--wxu-components-src-molecule-DaypartDetails-DetailsTable-DetailsTable--value--1F3Ze">/\n/g' -e 's/"SunsetTime" class="_-_-node_modules--wxu-components-src-molecule-DaypartDetails-DetailsTable-DetailsTable--value--1F3Ze">/\n/g' -e 's/"MoonriseTime" class="_-_-node_modules--wxu-components-src-molecule-DaypartDetails-DetailsTable-DetailsTable--value--1F3Ze">/\n/g' -e 's/"MoonsetTime" class="_-_-node_modules--wxu-components-src-molecule-DaypartDetails-DetailsTable-DetailsTable--value--1F3Ze">/\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
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-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
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
done
rm $HOME/Weather_com_conky_script/Forecast_Images/*.svg


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

I've only tested for Kastoria in English for a couple of minutes. Be some good sports and report back about other places/languages on this world.

The Accuweather change is a really nasty one, though...

It mostly worked here Hutto TX

But I get errors like this:

convert-im6.q16: delegate failed `'rsvg-convert' -o '%o' '%i'' @ error/delegate.c/InvokeDelegate/1919.
convert-im6.q16: unable to open file `/tmp/magick-9003oU8PF8YxHqZT': No such file or directory @ error/constitute.c/ReadImage/544.
convert-im6.q16: no images defined `/home/thomas/Weather_com_conky_script/Forecast_Images/d1.png' @ error/convert.c/ConvertImageCommand/3258.

Also, it is pulling the everything in metric and not imperial. I'm an old american not smart enough to learn the metric system...lol

I would also like to note that I do not have my .conkyrc setup for weather.com. I am running the script manually and looking at the output files. I will write an updated conky when I get more time.
Great work

Offline

#3762 2020-08-31 06:37:21

morfik
Member
From: Europe/Poland
Registered: 2016-09-08
Posts: 152
Website

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

It looks like accuweather changed again. smile

Offline

#3763 2020-08-31 07:56:57

unklar
Back to the roots 1.9
From: #! BL
Registered: 2015-10-31
Posts: 1,546

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

TeoBigusGeekus wrote:

Thanks a lot guys, it really helps me.
And apparently il.harun is right; that very old version of the script works (!!!!)
Maybe S11 is right, they're indeed changing their pages' layouts based on a schedule.
The problem is that I only keep a very recent archive of the scripts (because my pc was full with old versions of every kind of script, some 9 or 10 years old, and I decided to delete everything apart from only the recent ones sad).
We'll see...

Snip

^Is there a date so that I can look in my archive? wink

Offline

#3764 2020-08-31 08:10:06

unklar
Back to the roots 1.9
From: #! BL
Registered: 2015-10-31
Posts: 1,546

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

seatommyboy wrote:

It mostly worked here Hutto TX
...
Also, it is pulling the everything in metric and not imperial. I'm an old american not smart enough to learn the metric system

Paste en-US into the browser address line. So:

https://weather.com/en-US/weather/today/l/5eb7863a969f80e5f3fd3cdd2d46eeb2f35ab9547cc13a3c0df1e5fc8269d1a9
seatommyboy wrote:

But I get errors like this:
...

Please check if the package inkscape is installed.

Offline

#3765 2020-08-31 08:12:06

unklar
Back to the roots 1.9
From: #! BL
Registered: 2015-10-31
Posts: 1,546

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

morfik wrote:

It looks like accuweather changed again. smile


https://forums.bunsenlabs.org/viewtopic … 19#p105719

Offline

#3766 2020-08-31 09:05:11

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

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

Hi TeoBigusGeekus
Thanks for the support
Who interesting:
In a week I will update conky Weather_com on google disk
see ReadMe.txt
https://drive.google.com/drive/folders/ … sp=sharing

Offline

#3767 2020-08-31 17:30:35

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

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

unklar wrote:
seatommyboy wrote:

It mostly worked here Hutto TX
...
Also, it is pulling the everything in metric and not imperial. I'm an old american not smart enough to learn the metric system

Paste en-US into the browser address line. So:

https://weather.com/en-US/weather/today/l/5eb7863a969f80e5f3fd3cdd2d46eeb2f35ab9547cc13a3c0df1e5fc8269d1a9
seatommyboy wrote:

But I get errors like this:
...

Please check if the package inkscape is installed.

+1
or use simply

https://weather.com/weather/today/l/d3e4167b6d899b0052a00ed051f449d51c5fc10e852f659680f3b6e0ed2c638b
morfik wrote:

It looks like accuweather changed again. smile

I know  cry


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!

Online

#3768 2020-08-31 19:49:49

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

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

Hey Teo

What about this site for something simple: DarkSky (formerly Forecast.io)

Aridaiou, Kastoria, West Macedonia
https://darksky.net/forecast/40.524,21.2689/ca12/en

Espinosa, Buenos Aires, Autonomous City of Buenos Aires (English)
https://darksky.net/forecast/-34.6074,-58.4546/ca12/en

español
https://darksky.net/forecast/-34.6074,-58.4546/ca12/es

Alert, Nunavut, Canada (Northern tip of Ellesmere Island)
https://darksky.net/forecast/82.503,-62.3575/ca12/en

Lichtentaler Straße, Baden, Baden-Württemberg Region (in German)
https://darksky.net/forecast/48.7553,8.2438/ca12/de

It looks simple - maybe ......

Last edited by Sector11 (2020-08-31 19:53:41)


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

Offline

#3769 2020-08-31 20:06:09

arof
Member
Registered: 2020-08-09
Posts: 6

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

There is not funny. Weather com is changed again at least in pl. 10days has a different structure than before. Conkyrc for remake again.

Offline

#3770 2020-08-31 21:44:13

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

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

arof wrote:

There is not funny. Weather com is changed again at least in pl. 10days has a different structure than before. Conkyrc for remake again.

SON OF A GUN - HERE TOO!


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

Offline

#3771 2020-08-31 22:25:49

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

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

New candidate for the weather.com script

#!/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
night=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"


##########################
# 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

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="[^>]*-DaypartDetails-DetailsSummary-DetailsSummary[^>]*>/\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-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
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-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
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
done
rm $HOME/Weather_com_conky_script/Forecast_Images/*.svg


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

PS: I think I'm gonna start smoking again.

Last edited by TeoBigusGeekus (2020-08-31 22:28:25)


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!

Online

#3772 2020-09-01 00:01:03

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

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

TeoBigusGeekus wrote:

New candidate for the weather.com script

PS: I think I'm gonna start smoking again.

Well, it's working again.

Can you give is an idea of what the heck they are doing?

PS: I hope not!  Not worth it, sip on an Ούζο  big_smile
roll Like that's better   glasses


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

Offline

#3773 2020-09-01 06:42:00

loutch
Member
Registered: 2015-12-12
Posts: 471

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

hello

@ théo


work great in french

@+


Linuxmint 19.1 Tessa cinnamon & mageia 8 Plasma5 & XFCE on ssd hp pavilion g7
Xubuntu 18.04 lts & 21.04 lts on ASUS Rog STRIX

Offline

#3774 2020-09-01 07:05:05

unklar
Back to the roots 1.9
From: #! BL
Registered: 2015-10-31
Posts: 1,546

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

@Teo,
also here the weather is fine with the latest script.   big_smile

Offline

#3775 2020-09-01 11:59:32

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

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

@Teo,
from Italy also here the weather is fine with the latest script.
Cheers

Offline

Board footer

Powered by FluxBB