|
1 | | - |
2 | | -# Threads CLI |
3 | | - |
4 | | -This CLI tool allows you to interact with the Threads API to perform various actions like creating posts, |
5 | | -getting profile information, retrieving recent posts, scheduling posts, and managing drafts. |
6 | | -The tool is built using Python and leverages the `typer` library for command-line interface creation and the `rich` |
7 | | -library for pretty-printing tables. |
8 | | - |
9 | | -## Installation |
10 | | - |
11 | | -1. **Clone the repository:** |
12 | | - ```bash |
13 | | - git clone https://github.com/your-repo/threads-cli.git |
14 | | - cd threads-cli |
15 | | - ``` |
16 | | - |
17 | | -2. **Set up a virtual environment:** |
18 | | - ```bash |
19 | | - python3 -m venv .venv |
20 | | - source .venv/bin/activate |
21 | | - ``` |
22 | | - |
23 | | -3. **Install the dependencies:** |
24 | | - ```bash |
25 | | - pip install -r requirements.txt |
26 | | - ``` |
27 | | - |
28 | | -4. **Set up environment variables:** |
29 | | - Create a `.env` file in the root directory with the following content: |
30 | | - ```env |
31 | | - ACCESS_TOKEN=your_access_token |
32 | | - ``` |
| 1 | +# Threads Command-Line Interface (CLI) Tool |
| 2 | +The Threads CLI Tool is a powerful and efficient command-line application designed to provide another way to interact |
| 3 | +with Threads. Developed using Python and leveraging the `typer` library for a user-friendly interface and the `rich` |
| 4 | +library for visual output, this tool can do a range of actions, including creating posts, retrieving |
| 5 | +profile information, managing drafts, and more. |
| 6 | + |
| 7 | +## Key Features |
| 8 | +- User Profile: Retrieve and display comprehensive user profile information, including the user's last post. |
| 9 | +- Recent Posts: Fetch and showcase the most recent posts made by the user. |
| 10 | +- Top Liked Posts: Retrieve the top liked posts of all time or within a specific time range. |
| 11 | +- Post Creation: Create text posts and image posts. |
| 12 | +- Replies: Get the latest replies for a specific media post and send replies to engage with the community. |
| 13 | +- Scheduling: Schedule posts to be automatically published at a specified future date and time. |
| 14 | +- Drafts: Create, manage, and send drafts, providing flexibility in your content creation workflow. |
| 15 | + |
| 16 | +## Getting Started |
| 17 | +To get started with the Threads CLI Tool, follow these steps: |
| 18 | + |
| 19 | +Clone the repository: |
| 20 | +``` |
| 21 | +git clone https://github.com/your-repo/threads-cli.git |
| 22 | +cd threads-cli |
| 23 | +``` |
| 24 | + |
| 25 | +Set up a virtual environment: |
| 26 | +``` |
| 27 | +python3 -m venv .venv |
| 28 | +source .venv/bin/activate |
| 29 | +``` |
| 30 | + |
| 31 | +Install the required dependencies: |
| 32 | +``` |
| 33 | +pip install -r requirements.txt |
| 34 | +``` |
| 35 | + |
| 36 | +Configure environment variables: |
| 37 | +Create a `.env` file in the project's root directory and add the following: |
| 38 | + |
| 39 | + |
| 40 | +``` |
| 41 | +ACCESS_TOKEN=your_access_token |
| 42 | +``` |
33 | 43 |
|
34 | 44 | ## Usage |
35 | | - |
36 | | -### Commands |
37 | | -If any of these example commands are incorrect, if you do `python main.py --help` you will see the list of commands and their descriptions. |
38 | | - |
39 | | - |
40 | | -1. **Get Profile Information:** |
41 | | - Retrieve and display user profile information, including the last post made by the user. |
42 | | - ```bash |
43 | | - python main.py get-profile |
44 | | - ``` |
45 | | - |
46 | | -2. **Get Recent Posts:** |
47 | | - Retrieve the most recent posts. |
48 | | - ```bash |
49 | | - python main.py get-recent-posts --limit 5 |
50 | | - ``` |
51 | | - |
52 | | -3. **Get Top Liked Posts:** |
53 | | - Retrieve the top liked posts of all time or within a specific time range. |
54 | | - ```bash |
55 | | - python main.py get-top-liked-posts --limit 5 --time-range 2w |
56 | | - ``` |
57 | | - |
58 | | -4. **Create a Text Post:** |
59 | | - Create a post with text. |
60 | | - ```bash |
61 | | - python main.py create-text-post "This is a text post." |
62 | | - ``` |
63 | | - |
64 | | -5. **Create an Image Post:** |
65 | | - Create a post with an image. |
66 | | - ```bash |
67 | | - python main.py create-image_post "This is an image post." "https://example.com/image.jpg" |
68 | | - ``` |
69 | | - |
70 | | -6. **Get Latest Replies:** |
71 | | - Retrieve the latest replies for a specific media post. |
72 | | - ```bash |
73 | | - python main.py get-latest-replies --media-id <media_id> --limit 5 |
74 | | - ``` |
75 | | - |
76 | | -7. **Send a Reply:** |
77 | | - Send a reply to a specific media post. |
78 | | - ```bash |
79 | | - python main.py send-reply --media-id <media_id> --text "This is a reply." |
80 | | - ``` |
81 | | - |
82 | | -8. **Schedule a Post:** |
83 | | - Schedule a post with text at a specific time. |
84 | | - ```bash |
85 | | - python main.py schedule-post --text "This is a scheduled post." --post-time "2024-06-22 23:22:00" |
86 | | - ``` |
87 | | - |
88 | | -9. **Create a Draft:** |
89 | | - Create a draft with text. |
90 | | - ```bash |
91 | | - python main.py create-draft "This is a draft." |
92 | | - ``` |
93 | | - |
94 | | -10. **Get Drafts:** |
95 | | - Retrieve all drafts. |
96 | | - ```bash |
97 | | - python main.py get-drafts |
98 | | - ``` |
99 | | - |
100 | | -11. **Send a Draft:** |
101 | | - Send a draft with a specific ID and remove it from drafts. |
102 | | - ```bash |
103 | | - python main.py send-draft --draft-id 1 |
104 | | - ``` |
105 | | - |
106 | | -## Additional Information |
107 | | - |
108 | | -### Dependencies |
109 | | -- `typer` |
110 | | -- `requests` |
111 | | -- `rich` |
112 | | -- `python-dotenv` |
113 | | - |
114 | | -### Environment Variables |
115 | | -- `ACCESS_TOKEN`: Your Threads API access token. |
116 | | - |
117 | | -## Development |
118 | | - |
119 | | -Feel free to contribute to this project by creating pull requests. Make sure to follow the standard coding guidelines and thoroughly test your changes. |
120 | | - |
121 | | -### Things to do |
122 | | -- [ ] Add tests for the CLI commands. |
123 | | -- [ ] Add support for creating polls. |
124 | | -- [ ] Validate that creating videos/image posts works |
125 | | - |
| 45 | +The Threads CLI Tool provides a wide range of commands to interact with the Threads API. Here are a few examples: |
| 46 | + |
| 47 | +Retrieve user profile: |
| 48 | +``` |
| 49 | +python main.py get-profile |
| 50 | +``` |
| 51 | + |
| 52 | +Get recent posts: |
| 53 | +``` |
| 54 | +python main.py get-recent-posts --limit 10 |
| 55 | +``` |
| 56 | + |
| 57 | +Create a text post: |
| 58 | +``` |
| 59 | +python main.py create-text-post "Hello, Threads!" |
| 60 | +``` |
| 61 | + |
| 62 | +Schedule a post: |
| 63 | +``` |
| 64 | +python main.py schedule-post "Scheduled post" "2024-06-22 09:00:00" |
| 65 | +``` |
| 66 | + |
| 67 | +For a complete list of available commands and their descriptions, run: |
| 68 | +``` |
| 69 | +python main.py --help |
| 70 | +``` |
0 commit comments