neynarxyz / nodejs-sdk

Typescript SDK for Neynar APIs
https://neynar.com
MIT License
50 stars 10 forks source link

feat: fetch feed based on embed types #166

Closed valerierose closed 3 weeks ago

valerierose commented 1 month ago

Overview

This adds the option to retrieve a feed based on the content type of the embedding. The content type can be a broad category such as image or a specific file type such as image/gif.

The full list of options are defined in src/neynar-api/v2/openapi-farcaster/models/embed-type.ts.

Example

# index.js
const result = await client.fetchFeed("filter", {limit: 3, filterType: "embed_types", embedTypes: ["image"]});
console.log(JSON.stringify(result));
$ node index.js | jq '{casts: [.casts[] | {text: .text, timestamp: .timestamp, embed_url: .embeds[0].url, embed_type: .embeds[0].metadata.content_type}]}'

{
  "casts": [
    {
      "text": "Hav nice day RARE fams πŸ’Ž\n\n",
      "timestamp": "2024-08-29T18:00:15.000Z",
      "embed_url": "https://media.tenor.com/hzrZb_3tie4AAAAM/karen.gif",
      "embed_type": "image/gif"
    },
    {
      "text": "What’s the biggest threat for a creator?\nDeplatforming  https://ik.imagekit.io/lens/media-snapshot/769e76d012e77c2b84158f8964a58f7a5abf892d228f83649eb1f201d500f993.jpg",
      "timestamp": "2024-08-29T18:00:15.000Z",
      "embed_url": "https://ik.imagekit.io/lens/media-snapshot/769e76d012e77c2b84158f8964a58f7a5abf892d228f83649eb1f201d500f993.jpg",
      "embed_type": "image/jpeg"
    },
    {
      "text": "Hav nice day πŸ’ŽπŸ’ŽπŸ’Ž",
      "timestamp": "2024-08-29T18:00:14.000Z",
      "embed_url": "https://media.tenor.com/tOldnV-a_3IAAAAM/have-a-good-day-have-a-nice-day.gif",
      "embed_type": "image/gif"
    }
  ]
}
manan19 commented 4 weeks ago

talked with @valerierose about this