Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged

Conversation

cgrinds
Copy link
Contributor

@cgrinds cgrinds commented Oct 19, 2022

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"
    }
  ]
}

Example response from id `1582843050786623488`

```json
{
  "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 michimani self-assigned this Oct 19, 2022
@michimani michimani self-requested a review October 19, 2022 22:59
@michimani
Copy link
Owner

@cgrinds
Looks good! Thank you for contributing!

@michimani michimani merged commit b453dc2 into michimani:main Oct 19, 2022
@michimani michimani added the enhancement New feature or request label Oct 19, 2022
@cgrinds cgrinds deleted the feature/support-media-variants-api branch October 20, 2022 03:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants