Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/shalvah/DownloadThisVideo
Twitter bot for easily downloading videos/GIFs off tweets
https://github.com/shalvah/DownloadThisVideo
aws-lambda bot lambda-functions nodejs serverless twitter
Last synced: 3 months ago
JSON representation
Twitter bot for easily downloading videos/GIFs off tweets
- Host: GitHub
- URL: https://github.com/shalvah/DownloadThisVideo
- Owner: shalvah
- License: gpl-3.0
- Archived: true
- Created: 2018-05-16T14:52:04.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2023-09-05T19:30:27.000Z (about 1 year ago)
- Last Synced: 2024-05-29T00:28:44.676Z (5 months ago)
- Topics: aws-lambda, bot, lambda-functions, nodejs, serverless, twitter
- Language: JavaScript
- Homepage: http://download-this.video
- Size: 672 KB
- Stars: 667
- Watchers: 17
- Forks: 80
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# DownloadThisVideo
> On April 4, 2023, Twitter suspended @this_vid, after nearly 5 years and millions of users. 😢
Easily download videos/GIFs off Twitter. Mention the bot (@this_vid) in a reply to the tweet containing the video, and it'll reply with a download link in a few minutes.
[![License: GPL v3](https://img.shields.io/badge/License-GPLv3-blue.svg)](https://www.gnu.org/licenses/gpl-3.0)
![](./this-vid.png)
## How this works
## Stack
- [AWS Lambda](https://aws.amazon.com/lambda/) with the [Serverless Framework](http://serverless.com)
- [AWS SNS](http://aws.amazon.com/sns)
- [Redis](http://redis.io)
- Node.js### Implementation
The bot consists of several AWS Lambda functions that work in tandem:#### fetchTweetsToDownload
This function runs every 4 minutes and checks for new mentions. It publishes these new mentions as a new notification on an SNS topic. The 4-minute interval is so as to not hit Twitter's rate limits and minimize AWS Lambda usage time, while being near-realtime.#### sendDownloadLink
This is triggered by new notifications on the SNS topic. It:
- processes the tweets in the message body,
- calls Twitter's API to retrieve media links. Any video links retrieved for a tweet are stored in Redis for faster repeated access (other users requesting the same video).
- adds the download details to the user's store in Redis. The _user's store_ is an entry in Redis where all downloads requested by a user are cached for a certain period (48 hours).
- attempts to reply to the user with a link to the user's download page (see section below). "Attempts" because Twitter enforces tweet limits (2400 per day, counted in 15-minute periods). If the API limits have been reached, the bot will "cool down" (not send any replies) for 10 minutes.#### getDownloads
This is triggered by a HTTP request to the / (for instance, http://thisvid.space/jack). It renders a page showing a list of the user's recent downloads.#### getHomePage
Renders the homepage 😁. See http://thisvid.space.#### retryFailedTasks
This re-publishes failed tasks (stored in Redis) as a new SNS message. For now, it can only be triggered manually.