Skip to content

Instantly share code, notes, and snippets.

@cheery
Created November 29, 2024 19:15
Show Gist options
  • Save cheery/7f652f2198be90b607d08f4819187bfe to your computer and use it in GitHub Desktop.
Save cheery/7f652f2198be90b607d08f4819187bfe to your computer and use it in GitHub Desktop.
Grifter buster script for bluesky
# Please note that this thing is not complete and grifters will adjust to it.
# I update this from time to time.
# 29.11.2024
# At the moment this script is not a turnkey solution,
# also you're meant to read it through before running it!
"""
Copyright 2024 Henri Tuhola
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS “AS IS” AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
"""
from atproto import Client
from urlextract import URLExtract
extractor = URLExtract()
# add APP_USERNAME string, and APP_PASSWORD,
# note that you can give an app a separate password in your profile.
APP_USERNAME = '.bsky.social'
APP_PASSWORD = 'xxxx-xxxx-xxxx-xxxx'
# logs in to your page.
client = Client()
user = client.login(APP_USERNAME, APP_PASSWORD)
def remove_my_reposts():
# In case you accidentally reposted some links,
# this script will remove any reposts containing gofund and paypal links.
# Note that it does it without prompting you!
data = client.get_author_feed(
actor=user.did,
filter='posts_and_author_threads',
limit=100)
while data:
for item in data.feed:
for link in extractor.find_urls(item.post.record.text):
if 'gofund' in link or 'paypal' in link and item.post.viewer.repost:
client.unrepost(repost_uri=item.post.viewer.repost)
if data.cursor:
data = client.get_author_feed(
actor=user.did,
filter='posts_and_author_threads',
limit=100,
cursor=data.cursor)
else:
data = None
# Use this if you accidentally reposted grifting links.
#remove_my_reposts()
# This remaining code gives a convenient link list that allows you to
# block any follower with grifting links one-by-one.
data = client.get_followers(actor=user.did, limit=100)
while data:
for follower in data.followers:
# On followers, it suffices to check out recent posts.
data = client.get_author_feed(
actor=follower.did,
filter='posts_and_author_threads',
limit=100)
grifting = False
for item in data.feed:
for link in extractor.find_urls(item.post.record.text):
if 'gofund' in link or 'paypal' in link and item.post.viewer.repost:
grifting = True
if grifting:
print('https://' + follower.handle)
if data.cursor:
data = client.get_followers(
actor=user.did,
limit=100,
cursor=data.cursor)
else:
data = None
data = client.get_follows(actor=user.did, limit=100)
while data:
for follow in data.follows:
# On follows, it suffices to check out recent posts.
data = client.get_author_feed(
actor=follower.did,
filter='posts_and_author_threads',
limit=100)
grifting = False
for item in data.feed:
for link in extractor.find_urls(item.post.record.text):
if 'gofund' in link or 'paypal' in link and item.post.viewer.repost:
grifting = True
if grifting:
print('https://' + follower.handle)
if data.cursor:
data = client.get_follows(
actor=user.did,
limit=100,
cursor=data.cursor)
else:
data = None
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment