all repos — site @ 53ef7e97ed6524d7a8d48671fd4607a085025c9e

source for my site, found at icyphox.sh

openring.py as a submodule

Signed-off-by: Anirudh Oppiliappan <x@icyphox.sh>
Anirudh Oppiliappan x@icyphox.sh
Tue, 26 May 2020 18:42:55 +0530
commit

53ef7e97ed6524d7a8d48671fd4607a085025c9e

parent

406013c1eb247597f0d4911b7be3b1d9572f416d

6 files changed, 26 insertions(+), 69 deletions(-)

jump to
A .gitmodules

@@ -0,0 +1,3 @@

+[submodule "bin/openring"] + path = bin/openring + url = https://github.com/icyphox/openring.py
D bin/openring.py

@@ -1,53 +0,0 @@

-#!/usr/bin/env python3 -# openring.py - generate a webring from rss feeds - -import feedparser -import arrow -import jinja2 -import random -import sys -from lxml import html -from jinja2 import DebugUndefined - -def jinja_render(html, tmpl): - template_loader = jinja2.FileSystemLoader("./") - env = jinja2.Environment(loader=template_loader, undefined=DebugUndefined) - try: - template = env.get_template(tmpl) - except jinja2.exceptions.TemplateNotFound: - print("error: template not found") - - out = template.render(feeds=html) - return out - - -with open("feeds.txt") as f: - feeds = f.readlines() - -html_out = [] - -for f in random.sample(feeds, 3): - fp = feedparser.parse(f) - feed_link = fp.feed.link - feed_title = fp.feed.title - print(feed_title) - full_summ = str(html.fromstring(fp.entries[0].summary).text_content()) - trunc_summ = full_summ[:256] + "…" - pub_date = fp.entries[0].published - pretty_date = arrow.get(pub_date, "ddd, DD MMM YYYY HH:mm:ss Z").format("MMM DD, YYYY") - post_link = fp.entries[0].link - post_title = fp.entries[0].title - - html_out.append(f"""<div class="openring-feed"> - <h4><a href="{post_link}">{post_title}</a></h4> - <p>{trunc_summ}</p> - - <p>via <a href="{feed_link}">{feed_title}</a></p> - {pretty_date} - </div> - """ - ) - -rendered = jinja_render(html_out, "templates/openring.html") -with open("templates/text.html", "w") as t: - t.write(rendered)
M config.pyconfig.py

@@ -54,5 +54,5 @@ </a>

</div> """ template = 'text.html' # default is index.html -pre_build = ['./bin/openring.py'] +pre_build = ['./bin/openring/openring.py'] post_build = ['./bin/rss.py', './bin/update_index.py']
M feeds.txtfeeds.txt

@@ -3,5 +3,4 @@ https://drewdevault.com/feed.xml

https://bellingcat.com/feed/ https://k1ss.org/blog/blog.xml https://jcs.org/rss -https://blog.lukaszolejnik.com/rss/ https://gru.gq/feed/
M templates/openring.htmltemplates/openring.html

@@ -49,6 +49,11 @@ <div class="openring">

{% for f in feeds %} {{ f }} {% endfor %} + <small align="right"> + Generated by <a href="https://github.com/icyphox/openring.py"> + openring.py + </a> + </small> </div> </div> </div>
M templates/text.htmltemplates/text.html

@@ -45,7 +45,17 @@ Send an email to

<a href="mailto:~icyphox/x@lists.sr.ht?Subject=Re: {{ title }}">~icyphox/x@lists.sr.ht</a>—my <a href="https://lists.sr.ht/~icyphox/x">public inbox</a>.</p> <hr> + <h3>Posts from blogs I follow</h3> <div class="openring"> + + <div class="openring-feed"> + <h4><a href="https://www.bellingcat.com/resources/2020/05/25/investigate-tiktok-like-a-pro/">Investigate TikTok Like A Pro!</a></h4> + <p>TikTok videos have grown increasingly popular over the last few years, with short clips showing people dancing, lip syncing, doing viral challenges, and so on. This relatively new platform lets users share short video clips, and can be looped. It is simila…</p> + + <p>via <a href="https://www.bellingcat.com">bellingcat</a></p> + May 25, 2020 + </div> + <div class="openring-feed"> <h4><a href="https://jcs.org/2020/05/15/surface_go2">OpenBSD on the Microsoft Surface Go 2 (notaweblog)</a></h4>

@@ -62,22 +72,15 @@ </div>

<div class="openring-feed"> - <h4><a href="https://www.bellingcat.com/resources/2020/05/25/investigate-tiktok-like-a-pro/">Investigate TikTok Like A Pro!</a></h4> - <p>TikTok videos have grown increasingly popular over the last few years, with short clips showing people dancing, lip syncing, doing viral challenges, and so on. This relatively new platform lets users share short video clips, and can be looped. It is simila…</p> + <h4><a href="https://drewdevault.com/2020/05/15/Status-update.html">Status update, May 2020</a></h4> + <p>Hello, future readers! I am writing to you from one day in the past. I finished +my plans for today early and thought I’d get a head start on writing the status +updates for tomorrow, or rather, for today. From your reference frame, that is. - <p>via <a href="https://www.bellingcat.com">bellingcat</a></p> - May 25, 2020 - </div> - - - <div class="openring-feed"> - <h4><a href="https://k1ss.org/blog/20200525a">25/05/2020: This month in KISS (#2)</a></h4> - <p>Welcome to the second monthly update for KISS. This post will be -quite a long one, we've seen some nice changes this month and some -great work by the Community.…</p> +Let’s start wit…</p> - <p>via <a href="https://k1ss.org">KISS Linux Blog</a></p> - May 25, 2020 + <p>via <a href="https://drewdevault.com">Drew DeVault's Blog</a></p> + May 15, 2020 </div>