mirror of
https://gitlab.com/octospacc/bottocto
synced 2025-02-02 11:46:55 +01:00
Add README, commit Config
This commit is contained in:
parent
8348704406
commit
adb0909297
30
MastodonFeedHTML/Example.Config.py
Normal file
30
MastodonFeedHTML/Example.Config.py
Normal file
@ -0,0 +1,30 @@
|
||||
# Feeds configuration.
|
||||
Feeds = [
|
||||
{
|
||||
"URLs": ["https://mastodon.social/@Mastodon", "https://botsin.space/@sitoctt"], # List of Mastodon profile URLs to scrape.
|
||||
"IncludeRetoots": True,
|
||||
"IncludeReplies": True,
|
||||
"LocalSave": True, # Whether or not to save posts as HTML files locally.
|
||||
"SendMail": False, # Whether or not to send posts via email.
|
||||
"MailTo": ["example@example.com"] # List of email recipients.
|
||||
}
|
||||
]
|
||||
|
||||
# SMTP configuration (only required for sending mail).
|
||||
MailUsername = "example@example.com"
|
||||
MailPassword = "Example"
|
||||
MailServer = "smtp.example.com"
|
||||
MailPort = 465
|
||||
|
||||
# How often to refresh the feeds (in seconds). Set to 0 for a single run, instead of having the program sleep.
|
||||
LoopTime = 300
|
||||
|
||||
# Additional time (in seconds) to sleep between every mail sent, to prevent spam.
|
||||
MailSleep = 10
|
||||
|
||||
# Whether or not to allow spaces in file names.
|
||||
SpacesInFiles = True
|
||||
|
||||
# Other advanced settings.
|
||||
AppName = "MastodonFeedHTML"
|
||||
UserAgent = AppName
|
@ -20,7 +20,7 @@ def SureList(Item):
|
||||
def MakePathStr(Str):
|
||||
for c in ('<>:"/\\|?*'):
|
||||
Str = Str.replace(c, '_')
|
||||
if NoSpacesFile:
|
||||
if not SpacesInFiles:
|
||||
Str = Str.replace(' ', '_')
|
||||
return Str
|
||||
|
||||
@ -77,7 +77,7 @@ def HandleFeed(URLs, IncludeRetoots, IncludeReplies, LocalSave, SendMail, MailTo
|
||||
|
||||
<br><hr><br>
|
||||
|
||||
<p><i>Via <a href="https://gitlab.com/-/snippets/2388397">https://gitlab.com/-/snippets/2388397</a></i></p>
|
||||
<p><i>Via <a href="https://gitlab.com/octospacc/bottocto/-/tree/main/MastodonFeedHTML">https://gitlab.com/octospacc/bottocto/-/tree/main/MastodonFeedHTML</a></i></p>
|
||||
"""
|
||||
if SendMail:
|
||||
Message = MIMEMultipart()
|
||||
@ -136,7 +136,7 @@ def HandleFeed(URLs, IncludeRetoots, IncludeReplies, LocalSave, SendMail, MailTo
|
||||
|
||||
def HandleFeedList(List):
|
||||
for Feed in List:
|
||||
print(f"[I] Handling item ->\n: {Feed}")
|
||||
print(f"[I] Handling Feed ->\n: {Feed}")
|
||||
HandleFeed(
|
||||
URLs=SureList(Feed['URLs']),
|
||||
IncludeRetoots=Feed['IncludeRetoots'] if 'IncludeRetoots' in Feed else True,
|
||||
|
10
MastodonFeedHTML/README.md
Normal file
10
MastodonFeedHTML/README.md
Normal file
@ -0,0 +1,10 @@
|
||||
Python script that scapes public posts from lists of Mastodon profile URLs, and:
|
||||
- Sends them to lists of email addresses;
|
||||
- Saves them as HTML files on your machine.
|
||||
|
||||
It works with any type of post, be it text or media. Retoots and replies are also supported.
|
||||
|
||||
_Note: This script only sees the last 20 posts on a profile page. Multi-page scraping is not yet supported. If you post or share a lot, you may want to set the refresh time at a very low number._
|
||||
|
||||
Useful for archiving your own posts, or whatever.
|
||||
Protip: you can repost your content on <https://blogger.com> via email with this tool!
|
Loading…
x
Reference in New Issue
Block a user