This request is an "internal" request, and thus, these are very little to no docs. this is a problem. The most docs I could find: https://blog.fgribreau.com/2012/01/twitter-unofficial-api-getting-tweets.html
(c *fiber.Ctx)
| 803 | // This request is an "internal" request, and thus, these are very little to no docs. this is a problem. |
| 804 | // The most docs I could find: https://blog.fgribreau.com/2012/01/twitter-unofficial-api-getting-tweets.html |
| 805 | func TweetInfo(c *fiber.Ctx) error { |
| 806 | _, pds, _, oauthToken, err := GetAuthFromReq(c) |
| 807 | if err != nil { |
| 808 | return MissingAuth(c, err) |
| 809 | } |
| 810 | |
| 811 | encodedId := c.Params("id") |
| 812 | idBigInt, err := strconv.ParseInt(encodedId, 10, 64) |
| 813 | if err != nil { |
| 814 | return ReturnError(c, "Invalid ID format", 195, 403) |
| 815 | } |
| 816 | // Fetch ID |
| 817 | idPtr, _, _, err := bridge.TwitterMsgIdToBluesky(&idBigInt) |
| 818 | if err != nil { |
| 819 | return ReturnError(c, "ID not found.", 144, fiber.StatusNotFound) |
| 820 | } |
| 821 | id := *idPtr |
| 822 | |
| 823 | thread, err := blueskyapi.GetPost(*pds, *oauthToken, id, 1, 0) |
| 824 | |
| 825 | if err != nil { |
| 826 | return HandleBlueskyError(c, err.Error(), "app.bsky.feed.getPostThread", TweetInfo) |
| 827 | } |
| 828 | |
| 829 | likes, err := blueskyapi.GetPostLikes(*pds, *oauthToken, id, 100) |
| 830 | |
| 831 | if err != nil { |
| 832 | return HandleBlueskyError(c, err.Error(), "app.bsky.feed.getLikes", TweetInfo) |
| 833 | } |
| 834 | |
| 835 | reposters, err := blueskyapi.GetRetweetAuthors(*pds, *oauthToken, id, 100) |
| 836 | |
| 837 | if err != nil { |
| 838 | return HandleBlueskyError(c, err.Error(), "app.bsky.feed.getRepostedBy", TweetInfo) |
| 839 | } |
| 840 | |
| 841 | repliers := []int64{} |
| 842 | favourites := []int64{} |
| 843 | retweeters := []int64{} |
| 844 | |
| 845 | for _, reply := range *thread.Thread.Replies { |
| 846 | repliers = append(repliers, *bridge.BlueSkyToTwitterID(reply.Post.Author.DID)) |
| 847 | } |
| 848 | for _, like := range likes.Likes { |
| 849 | favourites = append(favourites, *bridge.BlueSkyToTwitterID(like.Actor.DID)) |
| 850 | } |
| 851 | for _, reposter := range reposters.RepostedBy { |
| 852 | retweeters = append(retweeters, *bridge.BlueSkyToTwitterID(reposter.DID)) |
| 853 | } |
| 854 | |
| 855 | return EncodeAndSend(c, bridge.TwitterActivitiySummary{ |
| 856 | FavouritesCount: strconv.Itoa(thread.Thread.Post.LikeCount), |
| 857 | RetweetsCount: strconv.Itoa(thread.Thread.Post.RepostCount), |
| 858 | RepliersCount: strconv.Itoa(thread.Thread.Post.ReplyCount), |
| 859 | Favourites: favourites, |
| 860 | Retweets: retweeters, |
| 861 | Repliers: repliers, |
| 862 | }) |
nothing calls this directly
no test coverage detected