Coder Social home page Coder Social logo

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 the link in a few minutes.

How this works

Stack

Implementation

There are three Lambda Functions:

  • fetchTweetsToDownload runs every 5 minutes and checks for new mentions. It publishes these new mentions as a new notification on an SNS topic
  • sendDownloadLink is triggered by new SNS messages. It processes the tweets in the message body, retrieves download links and sends to the user.
  • retryFailedTasks runs every 10 minutes and re-publishes failed tasks as a new SNS message

Notes

  • Retrieved video links are cached in Redis
  • Why 10 minute intervals? So as to not hit Twitter's rate limits and minimize AWS Lambda usage time, while being near-realtime. An alternate implementation would be to use Twitter's Streaming API. However, this wouldn't work with AWS Lambda (max runtime of a function is 300 seconds), so I'd need to maintain a dedicated server for that.

Todo

  • Set TTLs for all cached values to ensure more important data is retained longer. (Priority: ⬆️)
  • Add a filter to avoid processing tweets we already replied to (am I overengineering this?) (Priority: ⬇️)
  • Support processing tweets where the referenced tweet is a retweet of a tweet containing a video (I'm not sure, but I think this currently works)
  • Support DMs (DMing the bot with the tweet link) (Priority: ⬇️)
  • I've discovered there are different types of video shared via Twitter. For non-native video, the extended_entities object is not present, so the bot fails. We need to look into supporting other types of video

downloadthisvideo's People

Contributors

shalvah 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.