mirror of
https://codeberg.org/rimu/pyfedi
synced 2025-01-23 19:36:56 -08:00
ignore Lemmy's superfluous hashtags
This commit is contained in:
parent
4cf4bb45fe
commit
f90d07f470
2 changed files with 5 additions and 5 deletions
|
@ -1539,6 +1539,7 @@ def create_post(activity_log: ActivityPubLog, community: Community, request_json
|
|||
if 'tag' in request_json['object'] and isinstance(request_json['object']['tag'], list):
|
||||
for json_tag in request_json['object']['tag']:
|
||||
if json_tag['type'] == 'Hashtag':
|
||||
if json_tag['name'][1:].lower() != post.community.name.lower(): # Lemmy adds the community slug as a hashtag on every post in the community, which we want to ignore
|
||||
hashtag = find_hashtag_or_create(json_tag['name'])
|
||||
if hashtag:
|
||||
post.tags.append(hashtag)
|
||||
|
|
|
@ -259,10 +259,9 @@ def markdown_to_text(markdown_text) -> str:
|
|||
|
||||
|
||||
def microblog_content_to_title(html: str) -> str:
|
||||
title = ''
|
||||
if '<p>' in html:
|
||||
soup = BeautifulSoup(html, 'html.parser')
|
||||
|
||||
title = ''
|
||||
for tag in soup.find_all('p'):
|
||||
title = tag.get_text(separator=" ")
|
||||
if title and title.strip() != '' and len(title.strip()) >= 5:
|
||||
|
|
Loading…
Reference in a new issue