Replies to a particular tweet, Twitter API

后端 未结 11 2062
北荒
北荒 2020-11-28 02:19

Is there a way in the Twitter API to get the replies to a particular tweet? Thanks

11条回答
  •  忘掉有多难
    2020-11-28 02:51

    I came across the same issue a few months ago at work, as I was previously using their related_tweets endpoint in REST V1.

    So I had to create a workaround, which I have documented here:
    http://adriancrepaz.com/twitter_conversations_api Mirror - Github fork

    This class should do exactly what you want. It scrapes the HTML of the mobile site, and parses a conversation. I've used it for a while and it seems very reliable.

    To fetch a conversation...

    Request

    fetchConversion(324215761998594048);
    print_r($conversation);
    
    ?>
    

    Response

    Array
    (
        [error] => false
        [tweets] => Array
            (
                [0] => Array
                    (
                        [id] => 324214451756728320
                        [state] => before
                        [username] => facebook
                        [name] => Facebook
                        [content] => Facebook for iOS v6.0 ? Now with chat heads and stickers in private messages, and a more beautiful News Feed on iPad itunes.apple.com/us/app/faceboo?
                        [date] => 16 Apr
                        [images] => Array
                            (
                                [thumbnail] => https://pbs.twimg.com/profile_images/3513354941/24aaffa670e634a7da9a087bfa83abe6_normal.png
                                [large] => https://pbs.twimg.com/profile_images/3513354941/24aaffa670e634a7da9a087bfa83abe6.png
                            )
                    )
    
                [1] => Array
                    (
                        [id] => 324214861728989184
                        [state] => before
                        [username] => michaelschultz
                        [name] => Michael Schultz
                        [content] => @facebook good April Fools joke Facebook?.chat hasn?t changed. No new features.
                        [date] => 16 Apr
                        [images] => Array
                            (
                                [thumbnail] => https://pbs.twimg.com/profile_images/414193649073668096/dbIUerA8_normal.jpeg
                                [large] => https://pbs.twimg.com/profile_images/414193649073668096/dbIUerA8.jpeg
                            )
                    )
                 ....             
            )
    )
    

提交回复
热议问题