Skip to content
This repository was archived by the owner on Jan 13, 2024. It is now read-only.

Commit e5e83a8

Browse files
committed
refacto
1 parent 15e1ac3 commit e5e83a8

File tree

6 files changed

+91
-94
lines changed

6 files changed

+91
-94
lines changed

twootfeed/config.example.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,23 @@
11
twitter:
22
consumerKey: ''
33
consumerSecret: ''
4-
title: 'Recherche Twitter : '
4+
title: 'Twitter Search Feed:'
55
link: 'https://twitter.com/search?q='
6-
description: "Résultat d'une recherche Twitter retournée dans un flux RSS via Tweepy."
6+
description: 'Twitter search results.'
77
mastodon:
88
url: 'https://mastodon.social'
99
client_id_file: 'tootrss_clientcred.txt'
1010
access_token_file: 'tootrss_usercred.txt'
1111
app_name: 'tootrss' # Used to identify authenticated apps
12-
title: 'Recherche Mastodon : '
13-
description: "Résultat d'une recherche Mastodon retournée dans un flux RSS."
12+
title: 'Mastodon Feed:'
13+
description: 'Mastodon generated feed from search.'
1414
feed:
1515
language: 'fr'
1616
author_name: ''
1717
feed_url: 'http://localhost:5000/'
1818
timezone: 'Europe/Paris'
1919
text_length_limit: 100
20-
max_items: 100
20+
max_items: 20
2121
app:
2222
host: '0.0.0.0'
2323
port: '8080'

twootfeed/mastodon/generate_toots_feed.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ def format_toot(toot: Dict, text_length_limit: int) -> Dict:
2727
f"{toot['account']['avatar_static']}\" "
2828
f"alt=\"{toot['account']['display_name']}\""
2929
f" width= 100px\"/> "
30-
f"<strong>{toot['account']['display_name']}: </strong>"
30+
f"<strong>{toot['account']['display_name']} </strong>"
3131
f"{toot['content']}"
3232
),
3333
}
@@ -135,14 +135,18 @@ def generate_xml(
135135
if hashtag:
136136
result = api.timeline_hashtag(hashtag)
137137
result = get_next_toots(api, result, max_items)
138-
feed_title = param['mastodon']['title'] + '"' + hashtag + '"'
138+
feed_title = (
139+
param['mastodon']['title'] + ' search "' + hashtag + '"'
140+
)
139141
feed_link = (
140142
param['mastodon']['url'] + '/web/timelines/tag/' + hashtag
141143
)
142144
else:
143145
search_result = api.search(query, resolve=True)
144146
result = search_result['statuses'][: max_items - 1]
145-
feed_title = param['mastodon']['title'] + '"' + query + '"'
147+
feed_title = (
148+
param['mastodon']['title'] + ' search "' + query + '"'
149+
)
146150
feed_link = param['mastodon']['url'] + '/web/search/'
147151
feed_desc = param['mastodon']['description']
148152
elif target == 'favorites':

0 commit comments

Comments
 (0)