https://github.com/iurysza/twitter-telegram-bot
A simple bot to download videos from twitter and send them to telegram
https://github.com/iurysza/twitter-telegram-bot
bot telegram twitter
Last synced: 8 months ago
JSON representation
A simple bot to download videos from twitter and send them to telegram
- Host: GitHub
- URL: https://github.com/iurysza/twitter-telegram-bot
- Owner: iurysza
- Created: 2020-07-06T12:38:26.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2020-07-09T18:04:40.000Z (almost 6 years ago)
- Last Synced: 2025-02-06T10:53:25.680Z (over 1 year ago)
- Topics: bot, telegram, twitter
- Language: Kotlin
- Homepage:
- Size: 68.4 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
## Twitter video downloader bot
A simple bot to download videos from twitter and send them to telegram
```kotlin
fun main() {
val authData = AuthLoader.getAuthDataFrom("auth_data.json")
val filterParams = FilterParams(listOf(authData.twitterUserId),listOf("@MandaProZap"))
val twitterClient = TwitterClient(authData)
val telegramBot = bot { token = authData.telegramToken }
FilteredStatusStream(authData, filterParams) { newStatus ->
twitterClient.getStatusById(newStatus.inReplyToStatusId)
?.mediaEntities
?.mapNotNull { it.videoVariants.firstOrNull()?.url }
?.forEach { url ->
GlobalScope.launch {
FileDownloader.downloadAndWriteToFile(url)?.let { videoFile ->
telegramBot.sendVideo(authData.telegramUserId, videoFile)
}
}
}
}.start()
}
```