michimani / gotwi

A library for using the Twitter API v2 in the Go language. (It is still under development).
MIT License
126 stars 26 forks source link

feat: support media variants parameter at GET /2/tweets/search/stream #292

Closed cgrinds closed 2 years ago

cgrinds commented 2 years ago

Example response from id 1582843050786623488

{
  "data": {
    "attachments": {
      "media_keys": [
        "13_1582838602551148545"
      ]
    },
    "author_id": "532779460",
    "conversation_id": "1582843050786623488",
    "created_at": "2022-10-19T21:16:05.000Z",
    "edit_history_tweet_ids": [
      "1582843050786623488"
    ],
    "entities": {
      "urls": [
        {
          "start": 257,
          "end": 280,
          "url": "https://t.co/K1BqvDKX6C",
          "expanded_url": "https://twitter.com/snyyankees/status/1582838645240668160/video/1",
          "display_url": "pic.twitter.com/K1BqvDKX6C",
          "media_key": "13_1582838602551148545"
        }
      ]
    },
    "id": "1582843050786623488",
    "text": "Luis Severino, absolute legend.\n\nQ: Is it hard playing in Houston, where the fans hate the Yankees?\n\nA: \"I mean, everywhere we go we're not liked... The only place that they really like us a little bit is Tampa because they don't have a lot of fans there.\"\nhttps://t.co/K1BqvDKX6C"
  },
  "includes": {
    "media": [
      {
        "height": 1080,
        "media_key": "13_1582838602551148545",
        "preview_image_url": "https://pbs.twimg.com/media/FfdfW8GWYBAC3_0.jpg",
        "type": "video",
        "variants": [
          {
            "content_type": "application/x-mpegURL",
            "url": "https://video.twimg.com/amplify_video/1582838602551148545/pl/boQ5Zw3JHyqnd3rD.m3u8?tag=14&container=fmp4"
          },
          {
            "bit_rate": 832000,
            "content_type": "video/mp4",
            "url": "https://video.twimg.com/amplify_video/1582838602551148545/vid/540x540/w5rrF5a3cGJK3pO6.mp4?tag=14"
          },
          {
            "bit_rate": 432000,
            "content_type": "video/mp4",
            "url": "https://video.twimg.com/amplify_video/1582838602551148545/vid/320x320/vbnY71IaiEDtxOJl.mp4?tag=14"
          },
          {
            "bit_rate": 1280000,
            "content_type": "video/mp4",
            "url": "https://video.twimg.com/amplify_video/1582838602551148545/vid/720x720/jJayJVpiTaI2rtw8.mp4?tag=14"
          }
        ],
        "width": 1080
      }
    ],
    "users": [
      {
        "id": "532779460",
        "name": "Yair Rosenberg",
        "profile_image_url": "https://pbs.twimg.com/profile_images/1245175387577073664/pkpiIqTq_normal.jpg",
        "username": "Yair_Rosenberg"
      }
    ],
    "tweets": [
      {
        "attachments": {
          "media_keys": [
            "13_1582838602551148545"
          ]
        },
        "author_id": "532779460",
        "conversation_id": "1582843050786623488",
        "created_at": "2022-10-19T21:16:05.000Z",
        "edit_history_tweet_ids": [
          "1582843050786623488"
        ],
        "entities": {
          "urls": [
            {
              "start": 257,
              "end": 280,
              "url": "https://t.co/K1BqvDKX6C",
              "expanded_url": "https://twitter.com/snyyankees/status/1582838645240668160/video/1",
              "display_url": "pic.twitter.com/K1BqvDKX6C",
              "media_key": "13_1582838602551148545"
            }
          ]
        },
        "id": "1582843050786623488",
        "text": "Luis Severino, absolute legend.\n\nQ: Is it hard playing in Houston, where the fans hate the Yankees?\n\nA: \"I mean, everywhere we go we're not liked... The only place that they really like us a little bit is Tampa because they don't have a lot of fans there.\"\nhttps://t.co/K1BqvDKX6C"
      }
    ]
  },
  "matching_rules": [
    {
      "id": "1582841965435097088",
      "tag": "followers-1"
    }
  ]
}
michimani commented 2 years ago

@cgrinds
Looks good! Thank you for contributing!