Giter Site home page Giter Site logo

h0m3brew / downloadthisvideo Goto Github PK

View Code? Open in Web Editor NEW

This project forked from shalvah/downloadthisvideo

0.0 0.0 0.0 466 KB

Twitter bot for easily downloading videos/GIFs off tweets

Home Page: http://download-this.video

JavaScript 63.80% HTML 35.63% PowerShell 0.57%

downloadthisvideo's Introduction

DownloadThisVideo

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.

How this works

Stack

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.

Supporters

These folks help to keep this running. If you've benefited from this work and would like to help keep it running, consider supporting me on Patreon.

  • Sharee
  • Luca Turgut
  • Xavier Brown

downloadthisvideo's People

Contributors

shalvah avatar notpushkin avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.