109 if resp.text.strip() ==
"ddg_spice_forecast();":
112 result = loads(resp.text[resp.text.find(
'\n') + 1 : resp.text.rfind(
'\n') - 2])
114 current = result[
"currentWeather"]
116 title = result[
'location']
118 infobox = f
"<h3>{gettext('Current condition')}</h3><table><tbody>"
122 infobox +=
"</tbody></table>"
126 for time
in result[
'forecastHourly'][
'hours']:
127 current_time = date_parser.parse(time[
'forecastStart'])
129 if last_date != current_time.date():
130 if last_date
is not None:
131 infobox +=
"</tbody></table>"
133 infobox += f
"<h3>{current_time.strftime('%Y-%m-%d')}</h3>"
135 infobox +=
"<table><tbody>"
137 for day
in result[
'forecastDaily'][
'days']:
138 if date_parser.parse(day[
'forecastStart']).date() == current_time.date():
141 infobox +=
"</tbody></table><table><tbody>"
143 last_date = current_time.date()
145 infobox += f
"<tr><td rowspan=\"7\"><b>{current_time.strftime('%H:%M')}</b></td></tr>"
149 infobox +=
"</tbody></table>"