Unofficial, Reverse-Engineered Python client for Meta's Threads.
pip install threads-py
from threadspy import ThreadsAPI
api = ThreadsAPI()
username = "{username}"
# get a user id
user_id = api.get_user_id_from_username(username)
print(user_id)
# get a profile info
profile = api.get_user_profile(username, user_id=user_id)
print(profile)
# get a profile's threads tab
threads = api.get_user_profile_threads(username, user_id=user_id)
print(threads)
# get a profile's replies tab
replies = api.get_user_profile_replies(username, user_id=user_id)
print(replies)
# 3-ways to get the {post_id}
thread_id = "CuX_UYABrr7"
post_id = api.get_post_id_from_thread_id(thread_id)
print(post_id)
post_url = "https://www.threads.net/t/CuX_UYABrr7/?igshid=MzRlODBiNWFlZA=="
post_id = api.get_post_id_from_url(post_url)
print(post_id)
thread_id = "CuX_UYABrr7"
post_id = api.get_post_id_from_thread_id(thread_id)
print(post_id)
# get threads info
thread = api.get_threads(post_id)
print(thread)
# get who liked a thread
linkers = api.get_thread_likers(post_id)
print(linkers)
from threadspy import ThreadsAPI
api = ThreadsAPI(username="username", password="password")
api.publish(caption="🤖 Hello World!")
api.publish(caption= '🤖 Threads with Link Image', image_path="https://github.com/junhoyeo/threads-py/raw/main/.github/logo.jpg")
api.publish(caption= '🤖 Threads with Link Attachment', url="https://github.com/junhoyeo/threads-py)")
parent_post_url = 'https://www.threads.net/t/CugF-EjhQ3r'
parent_post_id = api.get_post_id_from_url(parent_post_url) # or use `get_post_id_from_thread_id`
api.publish({
text: '🤖 Beep',
link: 'https://github.com/junhoyeo/threads-py',
parent_post_id: parent_post_id,
})
post_url = 'https://www.threads.net/t/CugF-EjhQ3r'
post_id = api.get_post_id_from_url(post_url) # or use `get_post_id_from_thread_id`
# 💡 Uses current credentials
api.like(postIDToLike)
api.unlike(postIDToLike)
user_id_to_follow = api.get_user_id_from_username('junhoyeo')
# 💡 Uses current credentials
api.follow(user_id_to_follow)
api.unfollow(user_id_to_follow)
- ✅ Read public data
- ✅ Fetch UserID(
314216
) via username(zuck
) - ✅ Read User Profile Info
- ✅ Read list of User Threads
- ✅ Read list of User Repiles
- ✅ Fetch PostID(
3140957200974444958
) via PostURL(https://www.threads.net/t/CuW6-7KyXme
) - ✅ Read Threads via PostID
- ✅ Read Likers in Thread via PostID
- ✅ Fetch UserID(
- 🚧 LangChain Agent
- 🚧 Link Threads & LLaMa
- 🚧 Provide statistical analysis of posts in Threads
- 🚧 Read private data
- ✅ Write data (i.e. write automated Threads)
- ✅ Create new Thread with text
- 🚧 Make link previews to get shown
- ✅ Create new Thread with media
- 🚧 Create new Thread with a multiple images
- ✅ Reply to existing Thread
- ✅ Create new Thread with text
- ✅ Friendships
- ✅ Follow User
- ✅ Unfollow User
- ✅ Interactions
- ✅ Like Thread
- ✅ Unike Thread
- 🏴☠️ Restructure project as an monorepo
- 🏴☠️ Cool CLI App to run Threads in the Terminal
MIT © Junho Yeo
If you find this project intriguing, please consider starring it(⭐) or following me on GitHub (I wouldn't say Threads).