Update icons and fix cover
Before Width: | Height: | Size: 214 KiB After Width: | Height: | Size: 90 KiB |
Before Width: | Height: | Size: 155 KiB After Width: | Height: | Size: 109 KiB |
After Width: | Height: | Size: 71 KiB |
|
@ -44,7 +44,7 @@
|
||||||
{% if article.cover %}
|
{% if article.cover %}
|
||||||
<img loading="lazy" src="{{ article.cover }}" alt="{{ article.title }}">
|
<img loading="lazy" src="{{ article.cover }}" alt="{{ article.title }}">
|
||||||
{% else %}
|
{% else %}
|
||||||
<canvas class="article__random-background"></canvas>
|
<img loading="lazy" src="static/img/newsreader-not-cover.png" alt="Not cover">
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</a>
|
</a>
|
||||||
</p>
|
</p>
|
||||||
|
|
|
@ -85,8 +85,8 @@ pre {
|
||||||
|
|
||||||
.article__header-img > a > img {
|
.article__header-img > a > img {
|
||||||
height: var(--height-img);
|
height: var(--height-img);
|
||||||
object-position: center;
|
object-position: top;
|
||||||
object-fit: contain;
|
object-fit: cover;
|
||||||
}
|
}
|
||||||
.article__random-background {
|
.article__random-background {
|
||||||
height: 100%;
|
height: 100%;
|
||||||
|
|
|
@ -5,3 +5,9 @@
|
||||||
.subtitle {
|
.subtitle {
|
||||||
font-size: 1rem;
|
font-size: 1rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.article__header-img > a > img {
|
||||||
|
height: initial;
|
||||||
|
object-position: initial;
|
||||||
|
object-fit: initial;
|
||||||
|
}
|
Before Width: | Height: | Size: 57 KiB After Width: | Height: | Size: 13 KiB |
Before Width: | Height: | Size: 28 KiB After Width: | Height: | Size: 2.6 KiB |
Before Width: | Height: | Size: 61 KiB After Width: | Height: | Size: 13 KiB |
Before Width: | Height: | Size: 206 KiB After Width: | Height: | Size: 48 KiB |
After Width: | Height: | Size: 71 KiB |
|
@ -40,10 +40,13 @@
|
||||||
;; Add cover to article search first image in description
|
;; Add cover to article search first image in description
|
||||||
;; Iterate every blog
|
;; Iterate every blog
|
||||||
(map (fn [article]
|
(map (fn [article]
|
||||||
(let [url-article (get-in article [:feed :link])
|
; User feedback
|
||||||
|
(prn (str "Looking for cover image for article > " (:link article)))
|
||||||
|
; Search cover image
|
||||||
|
(let [url-article (:link article)
|
||||||
html (:body (client/get url-article {:insecure? true}))
|
html (:body (client/get url-article {:insecure? true}))
|
||||||
url-og-image (second (re-find #"<meta[^>].*?property=\"og:image(?::url)?\".*?content=\"(.*?)\".*?>|<meta[^>].*?content=\"(.*?)\".*?property=\"og:image(?::url)?\".*?>" html))
|
url-og-image (second (re-find #"<meta[^>].*?property=\"og:image(?::url)?\".*?content=\"(.*?)\".*?>|<meta[^>].*?content=\"(.*?)\".*?property=\"og:image(?::url)?\".*?>" html))
|
||||||
url-first-image (second (re-find #"<main.*>[\s\S]*<img[^>]+src=\"([^\"\'|>]+)\"|id=[\'\"] ?main ?[\'\"]>[\s\S]*<img[^>]+src=\"([^\"\'|>]+)\"|class=[\'\"] ?main ?[\'\"]>[\s\S]*<img[^>]+src=\"([^\"\'|>]+)\"" html))
|
url-first-image (second (re-find #"<main.*>[\s\S]+<img[^>]+src=\"([^\">]+)\"|id=['\"] ?main ?['\"]>[\s\S]+<img[^>]+src=\"([^\">]+)\"|class=['\"] ?main ?[\'\"]>[\s\S]+<img[^>]+src=\"([^\">]+)\"" html))
|
||||||
images [url-og-image url-first-image]
|
images [url-og-image url-first-image]
|
||||||
url-final-image (first (filter (fn [item] (not (nil? item))) images))]
|
url-final-image (first (filter (fn [item] (not (nil? item))) images))]
|
||||||
(assoc article :cover url-final-image))) articles))
|
(assoc article :cover url-final-image))) articles))
|
||||||
|
@ -61,6 +64,8 @@
|
||||||
(fn [feeds feed-url]
|
(fn [feeds feed-url]
|
||||||
; Read feed
|
; Read feed
|
||||||
(let [feed (parse-url feed-url {:insecure? true :throw-exceptions false})]
|
(let [feed (parse-url feed-url {:insecure? true :throw-exceptions false})]
|
||||||
|
; User feedback
|
||||||
|
(prn (str "Reading RSS > " feed-url))
|
||||||
; Check is not null
|
; Check is not null
|
||||||
(if-not (nil? feed)
|
(if-not (nil? feed)
|
||||||
; Add feed
|
; Add feed
|
||||||
|
|