Improve CSS colors for fresh articles

This commit is contained in:
vas3k
2020-01-05 22:46:33 +01:00
parent 9f8372edf7
commit 69657de858
4 changed files with 22 additions and 10 deletions

View File

@@ -125,7 +125,7 @@ boards:
- name: Следим за скидками и распродажами
slug: sales
feeds:
- name: PeritoBurrito
- name: Perito Burrito
url: https://perito-burrito.com
rss: http://perito-burrito.com/feed
- name: Путешествуем

View File

@@ -96,7 +96,8 @@ def refresh_feed(item):
feed_id=item["id"],
uniq_id=entry.id if hasattr(entry, "id") else entry.link,
defaults=dict(
url=entry.link,
url=entry.link[:2000],
domain=parse_domain(entry.link)[:256],
created_at=parse_datetime(entry),
updated_at=datetime.utcnow(),
title=entry.title[:256]
@@ -107,15 +108,12 @@ def refresh_feed(item):
# parse heavy info
try:
real_url = resolve_real_url(entry)
except ConnectionError:
log.warning(f"Failed to parse URL: {entry.link}")
real_url = None
if real_url:
article.url = real_url[:2000]
article.domain = parse_domain(real_url)[:256]
except ConnectionError:
log.warning(f"Failed to resolve real URL: {entry.link}")
summary, lead_image = parse_text_and_lead_image(entry)
summary, lead_image = parse_entry_text_and_image(entry)
if summary:
article.description = summary[:1000]
@@ -163,7 +161,7 @@ def parse_datetime(entry):
return datetime.utcnow()
def parse_text_and_lead_image(entry):
def parse_entry_text_and_image(entry):
bs = BeautifulSoup(entry.summary, features="lxml")
text = re.sub(r"\s\s+", " ", bs.text or "").strip()
@@ -176,5 +174,9 @@ def parse_text_and_lead_image(entry):
return text, ""
def load_and_parse_full_article_text_and_image(url):
pass
if __name__ == '__main__':
update()

View File

@@ -278,24 +278,26 @@
.article-tooltip-title {
display: block;
font-weight: bold;
font-size: 90%;
}
.article-tooltip-description {
display: block;
font-weight: normal;
font-size: 70%;
margin-top: 10px;
}
.article-tooltip-info {
display: block;
font-weight: normal;
font-size: 70%;
margin-top: 10px;
}
.is-article-fresh {
font-weight: 600;
color: var(--brighter-text-color);
}
.message-popup {

View File

@@ -8,10 +8,14 @@ body {
.light-theme {
--bg-color: #FFF;
--opposite-bg-color: #282c35;
--text-color: #333;
--brighter-text-color: #000;
--opposite-text-color: #DDD;
--link-color: #333;
--visited-link-color: #afafaf;
color: var(--text-color);
background-color: var(--bg-color);
}
@@ -19,10 +23,14 @@ body {
.dark-theme {
--bg-color: #282c35;
--opposite-bg-color: #FFF;
--text-color: #DDD;
--brighter-text-color: #FFF;
--opposite-text-color: #333;
--link-color: #DDD;
--visited-link-color: #737373;
color: var(--text-color);
background-color: var(--bg-color);
}