Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ this project doesn't really have releases (or even versioning, until now), it
is a project that effects Recursers in "real ways". It would be nice to have a
place to quickly see the latest changes that the project has undergone.

## 2025-06

- [#190] Add text from the blog post summary to the Zulip announcement, if present -- @robbielyman

## 2021-09

Expand Down
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,12 @@ already been seen by blaggregator. So, if you published more than 2 posts
between consecutive (hourly) crawls by blaggregator, only the last two posts
will be notified on Zulip.

### My blog post appears on Zulip, but with no summary quote.

The quote is pulled from [feedparser's](https://pypi.org/project/feedparser/) summary field,
which in turn is populated with, e.g. RSS or Atom's "summary" or "description" fields.
Make sure that your feed is generating content for those tags!

### My blog is multi-purpose and not wholly code/Recurse Center specific

No problem! RCers usually enjoy reading non-technical posts by others.
Expand Down
4 changes: 3 additions & 1 deletion home/feedergrabber27.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@

import feedparser

from markdownify import markdownify as md

from .utils import is_medium_comment


Expand Down Expand Up @@ -87,7 +89,7 @@ def feedergrabber(url):
continue

# Post content
content = getattr(entry, "summary", "")
content = md(getattr(entry, "summary", ""))
# Append
post_links_and_titles.append((link, title, post_date, content))
if len(post_links_and_titles) == 0:
Expand Down
6 changes: 5 additions & 1 deletion home/zulip_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@
ZULIP_EMAIL = os.environ.get("ZULIP_EMAIL")
MESSAGES_URL = "https://recurse.zulipchat.com/api/v1/messages"
MEMBERS_URL = "https://recurse.zulipchat.com/api/v1/users"
ANNOUNCE_MESSAGE = "{} has a new blog post: [{}]({})"
ANNOUNCE_MESSAGE = "{} has a new blog post: [{}]({})\n"
QUOTE = "```quote\n{}\n```"
log = logging.getLogger("blaggregator")


Expand Down Expand Up @@ -45,6 +46,9 @@ def announce_posts(posts, debug=True):
path = reverse("view_post", kwargs={"slug": post.slug})
url = "{}/{}".format(settings.ROOT_URL.rstrip("/"), path.lstrip("/"))
content = ANNOUNCE_MESSAGE.format(author, title, url)
if post.content:
summary = post.content if len(post.content) <= 480 else post.content[:477] + "..."
content = content + QUOTE.format(summary)
send_message_zulip(to, subject, content, type_="stream")


Expand Down
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -44,3 +44,4 @@ text-unidecode==1.3; python_version >= "3.6"
urllib3==1.26.6; python_version >= "3.6" and python_full_version < "3.0.0" or python_full_version >= "3.6.0" and python_version < "4" and python_version >= "3.6"
zope.event==4.5.0; python_version >= "2.7" and python_full_version < "3.0.0" or python_version > "3.5"
zope.interface==5.4.0; python_version >= "2.7" and python_full_version < "3.0.0" or python_version > "3.5" and python_full_version < "3.0.0" or python_full_version >= "3.5.0" and python_version > "3.5"
markdownify; python_version >= "3.6"