Closed Rgwww closed 1 day ago
get_tweet_comments
return TweetComments object, has attribute tweets
which are basically the list of ConversationThread.
Iterating over this list will give you ConversationThread objects has attribute of tweets
which are the list of Tweets
Iterating over ConversationThread will give you Tweet object. On this object you get text
attribute to get the text.
comments = client.get_tweet_comments("1798731573723815974", 1, get_hidden=True)
for _thread in comments:
print(_thread) # This is ConversationThread
for comment in _thread:
print(comment) # This is Tweet
print(comment.text)
print(comment.media)
get_tweet_comments
返回TweetComments对象,其属性tweets
基本上是 ConversationThread 的列表。迭代此列表将为你提供ConversationThread对象
tweets
,该对象具有 Tweets 列表的属性迭代 ConversationThread 将为您提供Tweet对象。在此对象上,您可以获得
text
属性来获取文本。comments = client.get_tweet_comments("1798731573723815974", 1, get_hidden=True) for _thread in comments: print(_thread) # This is ConversationThread for comment in _thread: print(comment) # This is Tweet print(comment.text) print(comment.media)
Just like this post, there are 3 comments in the web post of tweets[0], and only 2 comments in the iterative access. Although there is a cursor, I also tried to use the cursor to obtain the third comment, but it still couldn't be obtained. Is it that the api of this project can't support more levels of comment data
You can call .expand()
method on ConversationThread
if you want to get all tweets of that thread
I'll try again. Thank you very much
I'm using your project interface to get comment data from a user's post, But when I use the app.get_tweet_comments method, getting the comments doesn't match what I get on the page.
app.get_tweet_comments("1798731573723815974", 1, cursor = 'PAAAAPAtPBwcFr7E1vGNnr32MRUCAAAYJmNvbnZlcnNhdGlvbnRocmVhZC0xNzk4NzQ3MDk4MTU1OTgzMjc0IgAA', get_hidden = True)
I read the documentation and couldn't find a way to fix it,