Skip to content

Commit

Permalink
Merge pull request #131 from nanos/no-bot
Browse files Browse the repository at this point in the history
Do not backfill users that have opted out
nanos authored Jun 27, 2024

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
2 parents 3651d02 + d2a14f6 commit 009fbe5
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions find_posts.py
Original file line number Diff line number Diff line change
@@ -112,7 +112,20 @@ def add_post_with_context(post, server, access_token, seen_urls, seen_hosts):

return False

def user_has_opted_out(user):
if 'note' in user and isinstance(user['note'], str) and (' nobot' in user['note'].lower() or '/tags/nobot' in user['note'].lower()):
return True
if 'indexable' in user and not user['indexable']:
return True
if 'discoverable' in user and not user['discoverable']:
return True
return False


def get_user_posts(user, known_followings, server, seen_hosts):
if user_has_opted_out(user):
logger.debug(f"User {user} has opted out of backfilling")
return None
parsed_url = parse_user_url(user['url'])

if parsed_url == None:

0 comments on commit 009fbe5

Please sign in to comment.