{Type}>"
- Attached += f"""{Opening} style="max-width:100%;max-height:100vh;" src="data:{Mime};base64,{base64.b64encode(Data).decode()}"{Closing}\n"""
Entry.find('img', class_='u-photo account__avatar')['style'] = 'max-height:2em;'#'display:none; visibility:hidden;'
Entry.find('div', class_='status__action-bar').replace_with('')
- if os.path.isfile('MastodonFeedToHTML.db'):
- with open('MastodonFeedToHTML.db', 'r') as Db:
- if GlobalId in Db.read().splitlines():
- pass #continue
-
print(f"-> {LocalId} - {Title}")
HTML = f"""\
{Title}
@@ -100,38 +98,50 @@ def Main():
Via https://gitlab.com/-/snippets/2388397
"""
- #print(HTML)
-
- if MailSend:
+ if SendMail:
Message = MIMEMultipart()
- Message['From'] = Sender
- Message['To'] = ', '.join(Receivers)
- Message['Subject'] = Entry['title']
+ Message['From'] = MailUsername
+ Message['To'] = ', '.join(MailTo)
+ Message['Subject'] = Title
Message.attach(MIMEText(HTML.replace('{ Replace:Attached }', ''), 'html'))
- for Link in []:#Entry['links']:
- if Link['type'].startswith(('audio/', 'image/', 'video/')):
- Response = urllib.request.urlopen(Link['href'])
- Data = Response.read()
- Type = 'img' if Link['type'].startswith('image/') else Link['type'].split('/')[0]
- Opening = f"<{Type}" if Type == 'img' else f"<{Type} controls"
- Closing = '>' if Type == 'img' else f">{Type}>"
- Attached += f"""{Opening} style="max-width:100%;max-height:100vh;" src="data:{Link['type']};base64,{base64.b64encode(Data).decode()}"{Closing}\n"""
+ Attachments = Entry.find('ul', class_='attachment-list__list')
+ if Attachments:
+ for Attachment in Attachments:
+ Href, Alt = '', ''
+ Attachment = str(Attachment).strip(StripWS).replace("'",'"').split('"')
+ for i,e in enumerate(Attachment):
+ if e.endswith('