Skip to content

Latest commit

Β 

History

History
340 lines (244 loc) Β· 13.5 KB

README.md

File metadata and controls

340 lines (244 loc) Β· 13.5 KB

μ—¬λ³΄μ„Έμš”

Yeoboseyo home page

Description

From your favorite RSS feeds, spread/share those news to services of your choice

Services covered

  • RSS
  • Mastodon
  • Mattermost
  • Slack
  • Discord
  • Telegram
  • Wallabag
  • Local Markdown files
  • Any services using a Webhook to push data

used cases:

  • With Yeoboseyo you set an RSS URL and the "local storage" (the folder where to store news in markdown) then you synchronize those files with syncthing on any of your devices and read them with Espilon Notes, Notable, markor. Any markdown editor/reader can open/import those files. This use case can be extended to any application that is able to import markdown file, use file manager or has import function, like TagSpaces

  • You want to publish news from your favorite news websites to Mastodon, Yeoboseyo will do that without any problem

  • You need to spread news from your project on Mattermost/Slack/Discord, just set the URL of the Webhook of one of those services and the news will be published as expected on the channel of your choice

  • If you prefer to publish that on Telegram, set the TELEGRAM_CHAT_ID of the group or channel

Let see how to setup all of that below

πŸ“¦ Installation

pre requisistes

Installation

create a virtualenv

python3 -m venv yeoboseyo
cd yeoboseyo
source bin/activate

then

pip install -r requirements.txt

or

pip install yeoboseyo

πŸ”§ Settings

copy or rename the config file

mv env.sample .env

set the correct values for your own environment

DATABASE_URL=sqlite:///db.sqlite3
TIME_ZONE=Europe/Paris
FORMAT_FROM=markdown_github
FORMAT_TO=html
BYPASS_BOZO=False   # if you don't want to get the malformed RSS Feeds set it to False
LOG_LEVEL=logging.INFO
MASTODON_USERNAME=your username@<domain instance of mastodon> 
MASTODON_PASSWORD=your pass
MASTODON_INSTANCE=https://<domain instance of mastodon>
MASTODON_VISIBILITY=unlisted  # default is 'public', can be 'unlisted', 'private', 'direct'
TOKEN=''
TELEGRAM_TOKEN=0123456789:AZERTYUIOPQSDFGHJKLMWXCVBN123456789
TELEGRAM_CHAT_ID=-NNNNNNNNN
WALLABAG_URL=http://wallabag/
WALLABAG_CLIENTID=your id
WALLABAG_CLIENTSECRET=your secret
WALLABAG_PASSWORD=wallabag
WALLABAG_USERNAME=wallabag

Mastodon

to create the app on mastodon :

on https://yourmastoinstance/settings/applications/new

  • Application name : Yeoboseyo
  • Scopes : check : read / write / push / follow
  • then submit

then select Yeoboseyo again to retreive the access token, and fill the file yeoboseyo_clientcred.secret put on the first line the value of "Your access token" and on the second line the https url of your masto instance eg

Azdfghy5678hefdsgghjuju09knb
https://framapiaf.org

this file will be read each time something will be posted on masto

Slack/Mattermost/Discord: Webhook

in the 'integrations' page set an "incoming webhooks" (eg from https://mattermost/teamname/integrations) and copy the URL into the field 'webhook' of the Yeoboseyo form

Telegram

you will need to create a Telegram Bot by invoking @BotFather. Once the bot is created, create a group / channel, and invite your bot on that group/channel and give it admin rights.

Now you need to get the ID of the group / channel where the bot can "speak"

for that : access to your bot history url

https://api.telegram.org/botXXXXX:YYYYY/getUpdates

and spot this kind of data

chat:
  id: -NNNNNN
  title: "my group name"  

pick up the -NNNNNN and put it as the TELEGRAM_CHAT_ID in the .env config file

Wallabag

Create a client API like explain here https://doc.wallabag.org/fr/developer/api/oauth.html

this will give you something like this

Wallabag

Then replace the client_id / client_secret / login / pass in the .env file

WALLABAG_URL=http://wallabag/
WALLABAG_CLIENTID=your id
WALLABAG_CLIENTSECRET=your secret
WALLABAG_PASSWORD=wallabag
WALLABAG_USERNAME=wallabag

πŸ“€ Database

create the database (to execute only once)

python models.py

πŸ“£ Running the Web application

start the application

cd yeoboseyo
python app.py &
μ—¬λ³΄μ„Έμš” !
INFO: Started server process [13588]
INFO: Waiting for application startup.
INFO: Uvicorn running on http://0.0.0.0:8000 (Press CTRL+C to quit)

πŸ‘€ Adding some Feeds to track

Go on http://0.0.0.0:8000 and fill the form to add new Feeds to track

  • If you plan to publish RSS Feeds
    • into a local folder, fill the local storage field with the complet path of that folder, if not leave it empty.
    • on your Mastodon account, tick the checkbox Publish on Mastodon?, if not, leave it unchecked
    • on your Telegram group/channel tick the checkbox Publish on Telegram?, if not, leave it unchecked
    • on your Mattermost/Slack/Discord group/channel, just set the URL of the Webhook of one of those services, if not, leave it empty.

πŸ’« Running the engine

now that you fill settings, and form, launch the command and see how many feeds are comming

μ—¬λ³΄μ„Έμš” !
usage: python run.py [-h] -a {report,go,switch} [-trigger_id TRIGGER_ID]

Yeoboseyo

optional arguments:
  -h, --help            show this help message and exit
  -a {report,go,switch}
                        choose -a report or -a go or -a swtch -trigger_id <id>
  -trigger_id TRIGGER_ID
                        trigger id to switch of status


python run.py -a go

μ—¬λ³΄μ„Έμš” ! RUN and GO
Trigger FoxMasK blog
 Entries created 1 / Read 1

get the list

get the list of your feeds to check which one provided articles or not

$ python run.py -a report
μ—¬λ³΄μ„Έμš” !
 Report
┏━━━━┳━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━┳━━━━━━━━━┳━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
┃ ID ┃ Name                ┃ Md Folder ┃ Tags    ┃ Status ┃ Triggered                  ┃
┑━━━━╇━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━╇━━━━━━━━━╇━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━━━━┩
β”‚ 1  β”‚ Mon Blog            β”‚ test      β”‚ News    β”‚ Ok     β”‚ 2021-03-18 22:35:21        β”‚
β”‚ 2  β”‚ KBS Culture         β”‚ test      β”‚ News    β”‚ Ok     β”‚ 2021-04-05 09:59:03        β”‚
β”‚ 3  β”‚ KBS journal du jour β”‚ test      β”‚ News    β”‚ Ok     β”‚ 2021-04-05 09:59:05        β”‚
β”‚ 4  β”‚ KBS Show biz        β”‚ test      β”‚ News    β”‚ Ok     β”‚ 2021-04-05 09:59:06        β”‚
β”‚ 5  β”‚ Jux Video           β”‚ test      β”‚ jeux    β”‚ Ok     β”‚ 2021-04-01 22:22:15.113871 β”‚
β”‚ 6  β”‚ PlayStation Blog    β”‚ test      β”‚ jeux    β”‚ Ok     β”‚ 2021-04-01 22:22:57.189312 β”‚
β”‚ 7  β”‚ GameKult            β”‚ test      β”‚ jeux    β”‚ Ok     β”‚ 2021-04-01 22:23:21.049307 β”‚
β”‚ 8  β”‚ Gameblog            β”‚ test      β”‚ jeux    β”‚ Ok     β”‚ 2021-04-01 22:23:48.350934 β”‚
β”‚ 9  β”‚ NoFrag              β”‚ test      β”‚ jeux    β”‚ Ok     β”‚ 2021-04-01 22:24:15.721174 β”‚
β”‚ 10 β”‚ Frandroid           β”‚ test      β”‚ android β”‚ Ok     β”‚ 2021-04-01 22:24:47.324475 β”‚
β”‚ 11 β”‚ Les Numeriques      β”‚ test      β”‚ android β”‚ Ok     β”‚ 2021-04-01 22:25:09.740677 β”‚
β”‚ 12 β”‚ VueJS News          β”‚ test      β”‚ vuejs   β”‚ Ok     β”‚ 2021-04-01 22:25:34.307735 β”‚
β”‚ 13 β”‚ Cacktus Blog        β”‚ test      β”‚ python  β”‚ Ok     β”‚ 2021-04-01 22:26:02.412688 β”‚
β”‚ 14 β”‚ Python News         β”‚ test      β”‚ python  β”‚ Ok     β”‚ 2021-04-01 22:26:41.975564 β”‚
β”‚ 15 β”‚ nedbatchelder       β”‚ test      β”‚ python  β”‚ Ok     β”‚ 2021-04-01 22:28:21.838166 β”‚
β”‚ 16 β”‚ Django News         β”‚ test      β”‚ Python  β”‚ Ok     β”‚ 2021-04-01 22:28:47.804644 β”‚
β”‚ 17 β”‚ Python Insider      β”‚ test      β”‚ Python  β”‚ Ok     β”‚ 2021-04-01 22:29:18.791661 β”‚
β”‚ 18 β”‚ PyCharm Blog        β”‚ test      β”‚ Python  β”‚ Ok     β”‚ 2021-04-01 22:29:44.568828 β”‚
β”‚ 19 β”‚ Real Python         β”‚ test      β”‚ Python  β”‚ Ok     β”‚ 2021-04-01 22:30:10.952486 β”‚
β”‚ 20 β”‚ VueJS               β”‚ test      β”‚ VueJS   β”‚ Ok     β”‚ 2021-04-01 22:30:34.507337 β”‚
β”‚ 21 β”‚ Odieux Connard      β”‚ test      β”‚ Humour  β”‚ Ok     β”‚ 2021-04-01 22:31:03.458147 β”‚
β””β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

switch the status of a trigger

switch the status of trigger to on/off

python run.py -a switch -trigger_id 1

μ—¬λ³΄μ„Έμš” ! Switch
Successfully disabled Trigger 'Mon Blog'

and check it again to see the status moving

09:00 $ python run.py -a report
μ—¬λ³΄μ„Έμš” !
 Report
┏━━━━┳━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━┳━━━━━━━━━┳━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
┃ ID ┃ Name                ┃ Md Folder ┃ Tags    ┃ Status   ┃ Triggered                  ┃
┑━━━━╇━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━╇━━━━━━━━━╇━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━━━━┩
β”‚ 1  β”‚ Mon Blog            β”‚ test      β”‚ News    β”‚ Disabled β”‚ 2021-05-15 09:00:27        β”‚
β”‚ 2  β”‚ KBS Culture         β”‚ test      β”‚ News    β”‚ Ok       β”‚ 2021-04-05 09:59:03        β”‚
β”‚ 3  β”‚ KBS journal du jour β”‚ test      β”‚ News    β”‚ Ok       β”‚ 2021-04-05 09:59:05        β”‚
β”‚ 4  β”‚ KBS Show biz        β”‚ test      β”‚ News    β”‚ Ok       β”‚ 2021-04-05 09:59:06        β”‚
β”‚ 5  β”‚ Jux Video           β”‚ test      β”‚ jeux    β”‚ Ok       β”‚ 2021-04-01 22:22:15.113871 β”‚
β”‚ 6  β”‚ PlayStation Blog    β”‚ test      β”‚ jeux    β”‚ Ok       β”‚ 2021-04-01 22:22:57.189312 β”‚
β”‚ 7  β”‚ GameKult            β”‚ test      β”‚ jeux    β”‚ Ok       β”‚ 2021-04-01 22:23:21.049307 β”‚
β”‚ 8  β”‚ Gameblog            β”‚ test      β”‚ jeux    β”‚ Ok       β”‚ 2021-04-01 22:23:48.350934 β”‚
β”‚ 9  β”‚ NoFrag              β”‚ test      β”‚ jeux    β”‚ Ok       β”‚ 2021-04-01 22:24:15.721174 β”‚
β”‚ 10 β”‚ Frandroid           β”‚ test      β”‚ android β”‚ Ok       β”‚ 2021-04-01 22:24:47.324475 β”‚
β”‚ 11 β”‚ Les Numeriques      β”‚ test      β”‚ android β”‚ Ok       β”‚ 2021-04-01 22:25:09.740677 β”‚
β”‚ 12 β”‚ VueJS News          β”‚ test      β”‚ vuejs   β”‚ Ok       β”‚ 2021-04-01 22:25:34.307735 β”‚
β”‚ 13 β”‚ Cacktus Blog        β”‚ test      β”‚ python  β”‚ Ok       β”‚ 2021-04-01 22:26:02.412688 β”‚
β”‚ 14 β”‚ Python News         β”‚ test      β”‚ python  β”‚ Ok       β”‚ 2021-04-01 22:26:41.975564 β”‚
β”‚ 15 β”‚ nedbatchelder       β”‚ test      β”‚ python  β”‚ Ok       β”‚ 2021-04-01 22:28:21.838166 β”‚
β”‚ 16 β”‚ Django News         β”‚ test      β”‚ Python  β”‚ Ok       β”‚ 2021-04-01 22:28:47.804644 β”‚
β”‚ 17 β”‚ Python Insider      β”‚ test      β”‚ Python  β”‚ Ok       β”‚ 2021-04-01 22:29:18.791661 β”‚
β”‚ 18 β”‚ PyCharm Blog        β”‚ test      β”‚ Python  β”‚ Ok       β”‚ 2021-04-01 22:29:44.568828 β”‚
β”‚ 19 β”‚ Real Python         β”‚ test      β”‚ Python  β”‚ Ok       β”‚ 2021-04-01 22:30:10.952486 β”‚
β”‚ 20 β”‚ VueJS               β”‚ test      β”‚ VueJS   β”‚ Ok       β”‚ 2021-04-01 22:30:34.507337 β”‚
β”‚ 21 β”‚ Odieux Connard      β”‚ test      β”‚ Humour  β”‚ Ok       β”‚ 2021-04-01 22:31:03.458147 β”‚
β””β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Migrations

if you had the version 0.5.0:

run

migrations/alter_table_trigger_add_telegram.sql
migrations/alter_table_trigger_add_wallabag.sql

if you had the version 0.4.0:

run

migrations/alter_table_trigger_add_webhook.sql

(Image credits to Emojipedia)

Test

export TEST_DATABASE_URL=sqlite:///db_test.sqlite3
pytest
[...]
yeoboseyo/tests/test_models.py ..                                                                                                                      [ 66%]
yeoboseyo/tests/test_settings.py .                                                                                                                     [100%]

===================================================================== 3 passed in 0.52s ======================================================================

or

coverage run --source='.' -m pytest
coverage report -m