From da37ab4550a4caf72f95f9171b6bdd214ef4676f Mon Sep 17 00:00:00 2001 From: sheverniskiy Date: Wed, 1 Jun 2022 08:05:49 +0300 Subject: [PATCH] feat: add imge url to getNow() --- src/common/constants.ts | 1 + src/common/types.ts | 1 + src/gismeteo.ts | 1 + 3 files changed, 3 insertions(+) diff --git a/src/common/constants.ts b/src/common/constants.ts index 8d87d4f..7029de4 100644 --- a/src/common/constants.ts +++ b/src/common/constants.ts @@ -48,6 +48,7 @@ export enum Wildcard { NOW_WATER = 'div.now div.water div.item-value div.UNIT_TEMP', NOW_SUNRISE = 'div.now div.now-astro div.now-astro-sunrise div.time', NOW_SUNSET = 'div.now div.now-astro div.now-astro-sunset div.time', + NOW_IMAGE = 'div.now', TOMORROW_TIME = 'div[data-stat-value*="weather"] div.widget-row-time div.row-item', TOMORROW_TEMP = 'div[data-stat-value*="weather"] div.widget-row-chart-temperature div.value span.UNIT_TEMP', TOMORROW_PRECIPITATION = 'div[data-stat-value*="weather"] div.widget-row-precipitation-bars div.row-item div.item-unit', diff --git a/src/common/types.ts b/src/common/types.ts index f55f47f..615f2c0 100644 --- a/src/common/types.ts +++ b/src/common/types.ts @@ -42,6 +42,7 @@ export interface GismeteoNow { water_temp: number sunrise: number sunset: number + image?: string } export interface GismeteoTomorrow { diff --git a/src/gismeteo.ts b/src/gismeteo.ts index 1f35921..4c666e6 100644 --- a/src/gismeteo.ts +++ b/src/gismeteo.ts @@ -130,6 +130,7 @@ export class Gismeteo { water_temp: this.numberify($(this.unitToWildcard(Wildcard.NOW_WATER)).text()), sunrise: moment(moment().format('DD MMM YYYY') + ' ' + $(Wildcard.NOW_SUNRISE).text(), 'DD MMM YYYY H:mm').unix(), sunset: moment(moment().format('DD MMM YYYY') + ' ' + $(Wildcard.NOW_SUNSET).text(), 'DD MMM YYYY H:mm').unix(), + image: $(Wildcard.NOW_IMAGE).attr('style')?.replace("background-image: url('", '').replace("')", ''), } return out