|
@@ -3,12 +3,15 @@ import feedparser
|
3
|
3
|
from flask import Flask, render_template
|
4
|
4
|
from bs4 import BeautifulSoup
|
5
|
5
|
|
|
6
|
+# Source: https://lingohub.com/academy/best-practices/rtl-language-list
|
|
7
|
+RTL_LANGS = ['ar', 'arc', 'dv', 'fa', 'ha', 'he', 'khw', 'ks', 'ku', 'ps', 'ur', 'yi']
|
|
8
|
+
|
6
|
9
|
application = Flask(__name__)
|
7
|
10
|
|
8
|
11
|
@application.route('/<string:lang>/<string:instance>/<string:user>/<string:tag>')
|
9
|
12
|
def my_masto_tag(lang, instance, user, tag):
|
10
|
13
|
lang = lang.lower()
|
11
|
|
- is_rtl = lang in ['he', 'ar'] # TODO: A less lame to determine rtl
|
|
14
|
+ is_rtl = lang in RTL_LANGS
|
12
|
15
|
title = f'@{user}@{instance} — #{tag}'
|
13
|
16
|
feed = feedparser.parse(f'https://{instance}/@{user}/tagged/{tag}.rss')
|
14
|
17
|
for e in feed['entries']:
|