A simple Go application for downloading video content from Twitter. This project allows you to input a tweet URL, extract the tweet ID, and download any available video content in MP4 format.
- Extract tweet ID from a tweet URL.
- Download video from tweet URLs with video content in MP4 format.
- Save videos with bitrate information as the file name.
- Handles video resolution by selecting the highest available quality.
- Go 1.18+ (for the Go tools and libraries).
huh
library for building terminal-based forms.- Internet connection to fetch video content.
-
Clone this repository:
git clone https://github.com/onihani/go-tweet.git
-
Change into the project directory:
cd go-tweet
-
Install dependencies:
go mod tidy
-
Build the project:
go build
-
Run the application:
./go-tweet
When you run the application, it will prompt you to enter a tweet URL. Once the URL is entered, the program will:
- Extract the tweet ID from the URL.
- Fetch tweet data from the Twitter API.
- Display the available video resolutions.
- Download the highest quality MP4 video.
Enter Tweet URL: https://x.com/xghana_/status/1853065799977537588
Available videos: [320x562, 364x640]
Downloading video_632kbps.mp4 to ./downloads...
Download complete!
main.go
: The main application logic for fetching tweet data and handling user input.tweet/tweet.go
: Defines theTweet
struct and methods to extract video URLs.util/util.go
: Utility functions like extracting the tweet ID from the URL.
- huh: Simple library for building terminal forms.