Use id uf url is unavailable

main
Bob Mottram 2020-12-17 19:54:07 +00:00
parent 93e4ab9337
commit 3122b8b3a6
1 changed files with 10 additions and 6 deletions

View File

@ -547,9 +547,11 @@ def getPostsForBlockedDomains(baseDir: str,
if isinstance(item['object']['inReplyTo'], str): if isinstance(item['object']['inReplyTo'], str):
postDomain, postPort = \ postDomain, postPort = \
getDomainFromActor(item['object']['inReplyTo']) getDomainFromActor(item['object']['inReplyTo'])
if isBlockedDomain(baseDir, postDomain) and \ if isBlockedDomain(baseDir, postDomain):
item['object'].get('url'): if item['object'].get('url'):
url = item['object']['url'] url = item['object']['url']
else:
url = item['object']['id']
if not blockedPosts.get(postDomain): if not blockedPosts.get(postDomain):
blockedPosts[postDomain] = [url] blockedPosts[postDomain] = [url]
else: else:
@ -563,9 +565,11 @@ def getPostsForBlockedDomains(baseDir: str,
if tagItem.get('href'): if tagItem.get('href'):
postDomain, postPort = \ postDomain, postPort = \
getDomainFromActor(tagItem['href']) getDomainFromActor(tagItem['href'])
if isBlockedDomain(baseDir, postDomain) and \ if isBlockedDomain(baseDir, postDomain):
item['object'].get('url'): if item['object'].get('url'):
url = item['object']['url'] url = item['object']['url']
else:
url = item['object']['id']
if not blockedPosts.get(postDomain): if not blockedPosts.get(postDomain):
blockedPosts[postDomain] = [url] blockedPosts[postDomain] = [url]
else: else: