sbertix / Swiftagram

A modern Swift wrapper for Instagram Private API.
Apache License 2.0
249 stars 35 forks source link

Is it possible to get display url and comments? #284

Closed mobiledevgiant closed 2 years ago

mobiledevgiant commented 2 years ago

I am using this framework on my application. Is it possible to get display url and all comments of this post?

https://www.instagram.com/p/CY6dfn4oks5/?utm_source=ig_web_button_share_sheet

If yes, can you please share codes for it? Thanks. Vasyl.

mobiledevgiant commented 2 years ago

I have an alternate framework for this purpose:

package main
import "github.com/89z/mech/instagram"

func main() {
   login, err := instagram.NewLogin("USERNAME", "PASSWORD")
   if err != nil {
      panic(err)
   }
   media, err := login.Media("CY6dfn4oks5")
   if err != nil {
      panic(err)
   }
   println(media.Display_URL)
   for _, edge := range media.Edge_Media_To_Parent_Comment.Edges {
      println(edge.Node.Text)
   }
}

https://github.com/89z/mech

@89z Thank you for your quick help. Is there any Objective-c or Swift codes for this?

Regards Vasyl

sbertix commented 2 years ago

Hey @vasylboy90,

Swiftagram is a Swift client for the Instagram Private API, meaning you need to log in and then find the media you're referring to within the API. Once you have that, let's call identifier, you can then access all comments by using Endpoint.Media.Posts.comments(for:startingAt:), and all media-related info by calling Endpoint.Media.summary(for:).

Also, please make sure to use the Discussions page of the repo next time you're looking for help.