diff options
| author | Omar Roth <omarroth@hotmail.com> | 2018-02-05 17:57:03 -0600 |
|---|---|---|
| committer | Omar Roth <omarroth@hotmail.com> | 2018-02-05 17:57:03 -0600 |
| commit | 25434c676c449ca4748baa06e75fa973f78cfd23 (patch) | |
| tree | 5181e9ba95355a10e1d0e0dc6871321b9e6a4fe8 | |
| parent | a9cea62d5b4faf92ba66cdfa94270b545b157999 (diff) | |
| download | invidious-25434c676c449ca4748baa06e75fa973f78cfd23.tar.gz invidious-25434c676c449ca4748baa06e75fa973f78cfd23.tar.bz2 invidious-25434c676c449ca4748baa06e75fa973f78cfd23.zip | |
Run 'crystal tool format'
| -rw-r--r-- | src/helpers.cr | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/helpers.cr b/src/helpers.cr index 8106cb4f..23cab087 100644 --- a/src/helpers.cr +++ b/src/helpers.cr @@ -119,19 +119,19 @@ def fetch_video(id, client) published = published.lchop("Started streaming ") published = published.lchop("on ") published = published.lchop("Scheduled for ") - if !published.includes?("ago") - published = Time.parse(published, "%b %-d, %Y") - else - # Time matches format "20 hours ago", "40 minutes ago"... + if !published.includes?("ago") + published = Time.parse(published, "%b %-d, %Y") + else + # Time matches format "20 hours ago", "40 minutes ago"... delta = published.split(" ")[0].to_i case published when .includes? "minute" published = Time.now - delta.minutes when .includes? "hour" published = Time.now - delta.hours - else + else raise "Could not parse #{published}" - end + end end video = Video.new(id, info, html, Time.now, title, views, likes, dislikes, wilson_score, published) |
