DEV Community

Bachir Djoukbala
Bachir Djoukbala

Posted on

How to find Bluesky accounts and contact emails for outreach with Python (no login)

Bluesky's public AppView API needs no login for profile data. Here is a small script that searches accounts by keyword, filters by followers, and pulls emails and links out of the bio.

import httpx,re
B="https://public.api.bsky.app/xrpc/"
def find(q,limit=25,min_followers=500):
    r=httpx.get(B+"app.bsky.actor.searchActors",params={"q":q,"limit":limit},timeout=20); r.raise_for_status()
    out=[]
    for a in r.json()["actors"]:
        p=httpx.get(B+"app.bsky.actor.getProfile",params={"actor":a["did"]},timeout=20).json()
        bio=p.get("description","")
        if p.get("followersCount",0)<min_followers: continue
        out.append({"handle":p["handle"],"followers":p["followersCount"],
          "emails":re.findall(r"[\w.+-]+@[\w-]+\.[\w.]+",bio),"links":re.findall(r"https?://\S+",bio)})
    return out
if __name__=="__main__":
    for x in find("marketing agency",10,100): print(x)
Enter fullscreen mode Exit fullscreen mode

Running find("marketing agency", 10, 100) returned real agencies with followers and bio emails, for example one with a contact address in its bio and 271 followers.

Notes

  • Only public profile data. Respect GDPR and CAN-SPAM when you contact anyone.
  • Search is rate limited, so add a short sleep for big lists.
  • getProfile gives followers, post count and creation date; getAuthorFeed gives the last post date so you can drop dead accounts.

If you don't want to maintain it

I built this as an Apify actor (disclosure: I'm the author): Bluesky Profile & Lead Finder. It takes keywords or handles, filters by followers and only-with-contact, adds last-post date, and exports to CSV/JSON. Pay per profile, about $0.002.

Top comments (0)