twscrape icon indicating copy to clipboard operation
twscrape copied to clipboard

Question: Check if tweet is pinned

Open FroostySnoowman opened this issue 1 year ago • 2 comments

How would I check to see if a tweet is pinned?

FroostySnoowman avatar Jun 14 '24 00:06 FroostySnoowman

Hi, @FroostySnoowman.

What api method you use? Actually is no flags about it any model now.

If you scrape user profiles, ids should be in chronological order expect 1-3 first which can be pinned. So you can write some code to detect this

vladkens avatar Jun 29 '24 18:06 vladkens

Added in v0.13

import asyncio

from twscrape import API


async def main():
    api = API()

    async for doc in api.user_tweets(2244994945, limit=10):
        print(doc.url, doc.id in doc.user.pinnedIds)


if __name__ == "__main__":
    asyncio.run(main())

vladkens avatar Jun 29 '24 19:06 vladkens