Skip to content

Commit 041b19d

Browse files
authored
Merge pull request #39 from hmlendea/monetisation
Implemented configurable ShrinkMe monetisation
2 parents 483ffdb + 3e2e04d commit 041b19d

File tree

3 files changed

+7
-2
lines changed

3 files changed

+7
-2
lines changed

config.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,4 +23,5 @@ def load_config():
2323
INCLUDE_LINK_THUMBNAIL = cfg["include_link_thumbnail"]
2424
USE_PRIVACY_FRONTENDS = cfg["use_privacy_frontends"]
2525
USE_SHORTLINK = cfg["use_shortlink"]
26+
MONETISE_LINKS = cfg.get("monetise_links", True)
2627
MAXIMUM_TOOTS_COUNT = cfg["maximum_toots_count"]

main.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
INCLUDE_LINK_THUMBNAIL,
2222
USE_PRIVACY_FRONTENDS,
2323
USE_SHORTLINK,
24+
MONETISE_LINKS,
2425
MAXIMUM_TOOTS_COUNT,
2526
)
2627

@@ -247,8 +248,10 @@ def parse_args():
247248
feed_entry_link = re.sub('\\?utm.*$', '', feed_entry_link)
248249
feed_entry_link = re.sub('/$', '', feed_entry_link)
249250

250-
toot_body += '\n\n🔗 ' + feed_entry_link
251-
251+
if MONETISE_LINKS:
252+
toot_body += '\n\n🔗 ' + 'https://shrinkme.io/st?api=81ad7e29077269bcae6dc1773d87abbabeaa9aa8&url=' + feed_entry_link
253+
else:
254+
toot_body += '\n\n🔗 ' + feed_entry_link
252255
if INCLUDE_AUTHOR and 'authors' in feed_entry:
253256
toot_body += '\nby ' + feed_entry.authors[0].name
254257

sample.config.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,6 @@
44
"include_link_thumbnail": true,
55
"use_privacy_frontends": true,
66
"use_shortlink": true,
7+
"monetise_links": true,
78
"maximum_toots_count": 1
89
}

0 commit comments

Comments
 (0)