-
-
Save olegp/82eb6b54da56a2cf87cacde437328a12 to your computer and use it in GitHub Desktop.
Bluesky contact finder
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import fs from "fs"; | |
import { AtpAgent } from "@atproto/api"; | |
const agent = new AtpAgent({ | |
service: "https://bsky.social", | |
}); | |
await agent.login({ | |
identifier: "ID.bsky.social", | |
password: "PASS", | |
}); | |
const filePath = "connections.tsv"; | |
const fileContent = fs.readFileSync(filePath, "utf8"); | |
const lines = fileContent.split("\n"); | |
for (let i = 1; i < lines.length; i++) { | |
const row = lines[i].trim(); | |
if (!row) continue; | |
const fields = row.split("\t"); | |
const name = fields[0], | |
url = fields[1], | |
company = fields[2], | |
position = fields[3]; | |
if (!name) { | |
continue; | |
} | |
try { | |
const response = await agent.searchActors({ term: `"${name}"` }); | |
const users = response.data.actors; | |
if (users.length === 0) { | |
console.warn(name); | |
} else { | |
users.forEach((user) => { | |
console.log( | |
`${name}\t${url}\t${company}\t${position}\thttps://bsky.app/profile/${ | |
user.handle | |
}\t${user.description ? user.description.replace(/\s+/g, " ") : ""}` | |
); | |
}); | |
} | |
} catch (error) { | |
console.error(`${i}\t${error.message}`); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This script tries to find your LinkedIn connections (or any other lists of names) on Bluesky by searching for them by name. For common names a lot of irrelevant results are returned, so the data needs to be post-processed manually. This might be a good thing, since there could be some LinkedIn connections you don't actually want to follow on Bluesky.