Skip to content

Add a way to get the uploaded media from a comment #234

@Jiralite

Description

@Jiralite

If a subreddit enables media in comments and you upload an image, you get this on the comment create trigger:

{
  id: 't1_nuhy413',
  parentId: 't1_nuhxzxy',
  body: 'test\n\n![img](g1td0ezv7r7g1)',
  author: 't2_hjp31',
  numReports: 0,
  collapsedBecauseCrowdControl: false,
  spam: false,
  deleted: false,
  createdAt: 1765972827314,
  upvotes: 1,
  downvotes: 0,
  languageCode: 'und',
  lastModifiedAt: -1,
  gilded: false,
  score: 1,
  permalink: '/r/sky_elder_dev/comments/1poehvw/comment/nuhy413',
  hasMedia: false,
  postId: 't3_1poehvw',
  subredditId: 't5_g3e97a',
  elementTypes: [ 'img', 'text' ],
  mediaUrls: []
}

I was expecting hasMedia to be true and mediaUrls to not be empty. The body contains the media with presumably an id of g1td0ezv7r7g1. This is not enough information to work with–we have to guess the extension. In this case, it's PNG, so that'd be https://i.redd.it/g1td0ezv7r7g1.png.

Please provide a drink link to possible media in comments or alike! Or if there is a way to do this, please let me know!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions