Fetch Farcaster Feeds
Casts by Embed in Farcaster
Fetch User Information
- User by Wallet Address
- Mutual Follows/Followers
- Username Search
- Mutes, Blocks, and Bans
Build Farcaster Mini Apps / Frames
- Create Farcaster Mini App (v2 frame) in < 60s
- Send Notifications to Frame Users
- Create Transaction Frames
- Cast Actions
- v1 Frames (Maintenance Mode)
Build Bots and Agents
- Create Farcaster Bot or Agent
- Listen for @bot Mentions
- Make Agents Prompt Transactions
Fetch Farcaster Feeds
- Trending Feed on Farcaster
- Fetch & Display Farcaster Feeds with Neynar API
- Feed of Given Farcaster FID
- Farcaster Feed of NFT Owners
- Casts by Embed in Farcaster
- How to Use the Neynar Feed API
Onboard New Users
- Create New Farcaster Account
- SIWN: Connect Farcaster Accounts
- Fetch Signers
Write Data to Farcaster
- Choose the Right Signer
- Write Data with Managed Signers
- Like & Recast
Filter Spam, Low Quality Data
Run Queries on FC Data
- Choose Among Data Products
- Ingest Farcaster Data
- Indexer Service
- Hosted SQL
Render Farcaster in React
Fetch Cast Information
Get Events Via Webhooks
Get Farcaster Data on Base
Fetch Notifications
Create Onchain Transactions
Intersect Onchain & Social Data
Write Direct Casts
Get Hypersub Subscriptions
Get Farcaster Storage Data
Publish Actions on FC Apps
Contribute To Development
Fetch Farcaster Feeds
Casts by Embed in Farcaster
Show Farcaster casts that have attachments with Neynar
This guide demonstrates how to use the Neynar SDK to casts that contain a specific embed (eg. cast linking to github.com or youtube.com).
Check out this Getting started guide to learn how to set up your environment and get an API key.
First, initialize Neynar client:
Copy
// npm i @neynar/nodejs-sdk
import { NeynarAPIClient, Configuration } from "@neynar/nodejs-sdk";
import { FeedType } from "@neynar/nodejs-sdk/build/api/index.js";
// make sure to set your NEYNAR_API_KEY .env
// don't have an API key yet? get one at neynar.com
const config = new Configuration({
apiKey:process.env.NEYNAR_API_KEY,
});
const client = new NeynarAPIClient(config);
Then fetch casts linking to github.com:
Copy
const feedType = FeedType.Filter;
const filterType= "embed_url";
const embedUrl= "github.com";
const result = await client.fetchFeed({feedType,
filterType,
embedUrl
});
console.log(result);
Replace github.com
with any other embed url to fetch casts linking to that url.
To fetch casts linking to youtube.com:
Copy
const feedType = FeedType.Filter;
const filterType= "embed_url";
const embedUrl= "youtube.com";
const result = await client.fetchFeed({feedType,
filterType,
embedUrl
});
console.log(result);
And… Spotify:
Copy
const feedType = FeedType.Filter;
const filterType= "embed_url";
const embedUrl= "open.spotify.com";
const result = await client.fetchFeed({feedType,
filterType,
embedUrl
});
console.log(result);
Example output:
Copy
{
casts: [
{
object: "cast_hydrated",
hash: "0x9f617c43f00308cdb46b7b72f067b01557d53733",
thread_hash: "0x9f617c43f00308cdb46b7b72f067b01557d53733",
parent_hash: null,
parent_url: "chain://eip155:7777777/erc721:0xe96c21b136a477a6a97332694f0caae9fbb05634",
parent_author: [Object ...],
author: [Object ...],
text: "Yo, we got kids to raise and bills to pay, enemies to lay down when they stand in our way, it's only us \n\nhttps://open.spotify.com/track/0SlljMy4uEgoVPCyavtcHH",
timestamp: "2023-12-11T04:06:57.000Z",
embeds: [
[Object ...]
],
reactions: [Object ...],
replies: [Object ...],
mentioned_profiles: []
}, {
object: "cast_hydrated",
hash: "0xe70d9d52c5019b247fa93f76779296322676a4e5",
thread_hash: "0xe70d9d52c5019b247fa93f76779296322676a4e5",
parent_hash: null,
parent_url: null,
parent_author: [Object ...],
author: [Object ...],
text: "For the Intuitives (Part 1)",
timestamp: "2023-12-11T02:11:27.000Z",
embeds: [
[Object ...]
],
reactions: [Object ...],
replies: [Object ...],
mentioned_profiles: []
}, {
object: "cast_hydrated",
hash: "0xee6719ac805758be5bd54744bec63b7ec0bc4d3e",
thread_hash: "0xee6719ac805758be5bd54744bec63b7ec0bc4d3e",
parent_hash: null,
parent_url: null,
parent_author: [Object ...],
author: [Object ...],
text: "EP 214 Douglas Rushkoff on Leaving Social Media",
timestamp: "2023-12-11T02:11:18.000Z",
embeds: [
[Object ...]
],
reactions: [Object ...],
replies: [Object ...],
mentioned_profiles: []
}, {
object: "cast_hydrated",
hash: "0xebe7e89b1a3e91c96f99ecf3ce7d2797e3b118b6",
thread_hash: "0xebe7e89b1a3e91c96f99ecf3ce7d2797e3b118b6",
parent_hash: null,
parent_url: null,
parent_author: [Object ...],
author: [Object ...],
text: "#64 AI & the Global Brain: Peter Russell",
timestamp: "2023-12-11T02:11:04.000Z",
embeds: [
[Object ...]
],
reactions: [Object ...],
replies: [Object ...],
mentioned_profiles: []
}, {
object: "cast_hydrated",
hash: "0x93276da072a2902a3568da21203588995e4ba752",
thread_hash: "0x93276da072a2902a3568da21203588995e4ba752",
parent_hash: null,
parent_url: null,
parent_author: [Object ...],
author: [Object ...],
text: "Systems Thinking - Tomas Bjorkman - Consciousness",
timestamp: "2023-12-11T02:10:26.000Z",
embeds: [
[Object ...]
],
reactions: [Object ...],
replies: [Object ...],
mentioned_profiles: []
}
],
next: {
cursor: "eyJ0aW1lc3RhbXAiOiIyMDIzLTEyLTExIDAyOjEwOjI2LjAwMDAwMDAifQ=="
}
}
To fetch the next page:
Copy
const filter= "filter";
const filterType= "embed_url";
const cursor= result.next.cursor
const nextResult = await client.fetchFeed({filter,
filterType,
embedUrl,
cursor
});
There you go, fetching casts with specific embeds in Farcaster with Neynar SDK!
Ready to start building?
Get your subscription at neynar.com and reach out to us on Telegram with any questions!
Was this page helpful?