Skip to content

Commit

Permalink
feat: add imge url to getNow()
Browse files Browse the repository at this point in the history
  • Loading branch information
sheverniskiy committed Jun 1, 2022
1 parent 172c1e2 commit da37ab4
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/common/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
1 change: 1 addition & 0 deletions src/common/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ export interface GismeteoNow {
water_temp: number
sunrise: number
sunset: number
image?: string
}

export interface GismeteoTomorrow {
Expand Down
1 change: 1 addition & 0 deletions src/gismeteo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit da37ab4

Please sign in to comment.