Advert generator from web feeds
Project description
fead
This is a tool for advertising other blogs you like on your own by embedding the summary of their latest post(s) extracted from their web feed. It is a rewrite of openring with (rejected) concurrency support in Python without any third-party library.
Installation
On POSIX systems, run the usual make install
with configurable PREFIX
.
The following programs are needed for building and installation:
- make
- help2man
- install
Python 3.11+ is also required, both for generating the manual and at runtime.
On other systems, a package installer specific for Python might be preferred.
Usage
$ fead --help
Usage: fead [OPTION]...
Generate adverts from web feeds.
Options:
-h, --help show this help message and exit
-v, --version show program's version number and exit
-F PATH, --feeds PATH
file containing newline-separated web feed URLs
-f URL, --feed URL addtional web feed URL (multiple use)
-s, --strict abort when fail to fetch or parse a web feed
-n N, --count N maximum number of ads in total (default to 3)
-p N, --per-feed N maximum number of ads per feed (default to 1)
-l N, --length N maximum summary length (default to 256)
-t PATH, --template PATH
template file (default to stdin)
-o PATH, --output PATH
output file (default to stdout)
Any use of -f before -F is ignored.
Template
The template is used by Python str.format
to generate each advert.
It can contain the following fields, delimited by braces ({
and }
).
source_title
: title of the web feedsource_link
: URL to the feed's websitetitle
: title of the feed itemlink
: URL to the itemtime
: publication timesummary
: truncated content or description
The publication time is a Python datetime.datetime
object,
which supports at least C89 format codes, e.g. {time:%Y-%m-%d}
.
Examples
Given the these URLs in a feeds
file:
https://adol.pw/index.xml
https://cnx.gdn/feed.xml
https://xrvs.net/index.xml
Advertisement of the two latest blogs among them, along with articles by Drew DeVault, can be generated via the following command.
echo "<article>
<h3><a href='{link}'>{title}</a></h3>
{summary}—<a href='{source_link}'>{source_title}</a>, {time:%F}
</article>" | fead -F feeds -f https://drewdevault.com/blog/index.xml -n 2
Contributing
Patches should be sent to ~cnx/misc@lists.sr.ht using git send-email with the following configurations:
git config sendemail.to '~cnx/misc@lists.sr.ht'
git config format.subjectPrefix 'PATCH fead'
Bug reports and feedbacks should be sent to the same list, with the program's name mention in the subject.
Copying
This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file fead-1.0.0.tar.gz
.
File metadata
- Download URL: fead-1.0.0.tar.gz
- Upload date:
- Size: 17.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: python-requests/2.31.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9ba51ca4b7bb57e12d2aeb7814954ca6c073e228c4e32ca5593c92c45249239b |
|
MD5 | 0e9ba265ba5891d30ce97a96e9bf8f0e |
|
BLAKE2b-256 | 2d84f021fa36d2bfd0d12f73d09c85c4379896946af357f58f3632f7b261e112 |
File details
Details for the file fead-1.0.0-py3-none-any.whl
.
File metadata
- Download URL: fead-1.0.0-py3-none-any.whl
- Upload date:
- Size: 18.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: python-requests/2.31.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a6fb80f234a087043f4061bbb884c5d99ba38a5e05b0cf47dbff571fe6c704ac |
|
MD5 | b26f9c73bc4fde8bd434120c73b3fad4 |
|
BLAKE2b-256 | 93d8664ee89fffaeca90313ad96504a12eaca46a95f2f13eb3db45a9f3161356 |