Compare commits
10 Commits
2261e753d5
...
main
Author | SHA1 | Date | |
---|---|---|---|
8461afd08f | |||
30d4c41eee | |||
fadc678ac3 | |||
9b06a629f0 | |||
bb96bcde61 | |||
15416e3728 | |||
feccbc05e6 | |||
7d16552d65 | |||
268bbdf9b7 | |||
8ab6b9d986 |
36
.gitea/workflows/build.yml
Normal file
36
.gitea/workflows/build.yml
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
# .gitea/workflows/build.yaml
|
||||||
|
name: Publish Docker image
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches: [main]
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
push_to_registry:
|
||||||
|
name: Push Docker image to registries
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Check out the repo
|
||||||
|
uses: actions/checkout@v3
|
||||||
|
with:
|
||||||
|
token: ${{ secrets.GITEA_TOKEN }}
|
||||||
|
|
||||||
|
- name: Login to DockerHub
|
||||||
|
uses: https://github.com/docker/login-action@v2
|
||||||
|
with:
|
||||||
|
username: ${{ secrets.DOCKER_USER }}
|
||||||
|
password: ${{ secrets.DOCKER_TOKEN }}
|
||||||
|
|
||||||
|
- name: Login to Gitea registry
|
||||||
|
uses: https://github.com/docker/login-action@v2
|
||||||
|
with:
|
||||||
|
registry: git.kizaing.ca
|
||||||
|
username: ${{ gitea.actor }}
|
||||||
|
password: ${{ secrets.GITEA_TOKEN }}
|
||||||
|
|
||||||
|
- name: Build and push Docker image
|
||||||
|
uses: https://github.com/docker/build-push-action@v4
|
||||||
|
with:
|
||||||
|
context: .
|
||||||
|
push: true
|
||||||
|
tags: git.kizaing.ca/kizaing/teletok:latest, kizaing
|
2
.gitignore
vendored
2
.gitignore
vendored
@ -1,2 +1,4 @@
|
|||||||
bin
|
bin
|
||||||
obj
|
obj
|
||||||
|
.vscode
|
||||||
|
config.Dev.json
|
20
Program.cs
20
Program.cs
@ -15,12 +15,22 @@ namespace TeleTok
|
|||||||
|
|
||||||
static async Task Main(string[] args)
|
static async Task Main(string[] args)
|
||||||
{
|
{
|
||||||
|
//Checks if the config json data is valid
|
||||||
|
if(token == "" || token == null || token == "INSERT TOKEN HERE")
|
||||||
|
{
|
||||||
|
LogMessage("Telegram bot token is invalid! Exiting...");
|
||||||
|
}
|
||||||
|
else if(ptInstance == "" || ptInstance == null || ptInstance == "PROXITOK INSTANCE URL")
|
||||||
|
{
|
||||||
|
LogMessage("Proxitok instance is invalid! Exiting...");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
TelegramListener listener = new TelegramListener();
|
||||||
|
LogMessage("Now listening...");
|
||||||
|
|
||||||
TelegramListener listener = new TelegramListener();
|
listener.RunListener();
|
||||||
Console.WriteLine("Now listening...");
|
}
|
||||||
|
|
||||||
listener.RunListener();
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void LogMessage(string text)
|
public static void LogMessage(string text)
|
||||||
|
32
README.md
32
README.md
@ -1,5 +1,31 @@
|
|||||||
[](https://ci.kizaing.ca/kizaing/TeleTok)
|
|
||||||
|
|
||||||
# TeleTok Telegram Bot
|
# TeleTok Telegram Bot
|
||||||
|
This bot will monitor any chats for TikTok links that are posted, and then will run the link through a [ProxiTok](https://github.com/pablouser1/ProxiTok) instance to generate a download link. The resulting video file will then get directly uploaded directly to your chat.
|
||||||
|
|
||||||
This bot is in early development, but the end goal is to have this bot automatically convert all tiktok links in a chat into a videofile that can be re-uploaded to the telegram chat
|
## Building
|
||||||
|
Requirements: Dotnet SDK 6.0
|
||||||
|
|
||||||
|
Run `dotnet build` for a Debug instance
|
||||||
|
Run `dotnet publish` for a full release
|
||||||
|
|
||||||
|
## Installation
|
||||||
|
### Requirements
|
||||||
|
* A telegram bot token
|
||||||
|
* A working [ProxiTok](https://github.com/pablouser1/ProxiTok) instance, either public or hosted yourself. (Please be kind and take bandwidth into account when using a public instance)
|
||||||
|
|
||||||
|
### Binary
|
||||||
|
1. Either build the application or download a release zip for your OS/architecture
|
||||||
|
2. Edit the config.json and put your telegram bot token in the "token" field, and your chosen ProxiTok instance in the "ptInstance" field
|
||||||
|
3. Run the TeleTok.exe/TeleTok executable
|
||||||
|
|
||||||
|
### Docker
|
||||||
|
1. You can build an image for yourself with `docker build teletok .` or you can pull a prebuilt image with `docker pull kizaing/teletok:latest`
|
||||||
|
2. Copy the placeholder config.json from the repo to a location of your choosing
|
||||||
|
3. Edit the config.json and put your telegram bot token in the "token" field, and your chosen ProxiTok instance in the "ptInstance" field
|
||||||
|
4. Run the container with `docker run -v ${PWD}/config.json:/app/teletok/config.json -d kizaing/teletok:latest`
|
||||||
|
|
||||||
|
|
||||||
|
## To Do
|
||||||
|
- [x] Add better error and link handling
|
||||||
|
- [x] Process videos into telegram
|
||||||
|
- [ ] Add [Matrix](https://matrix.org) support
|
||||||
|
- [ ] Automate binary release publishing
|
@ -21,7 +21,7 @@ namespace TeleTok
|
|||||||
|
|
||||||
proxyUrl = CreateDownloadLink(url);
|
proxyUrl = CreateDownloadLink(url);
|
||||||
|
|
||||||
TeleTok.LogMessage("");
|
TeleTok.LogMessage("Sending video link for " + proxyUrl);
|
||||||
|
|
||||||
return proxyUrl;
|
return proxyUrl;
|
||||||
}
|
}
|
||||||
@ -47,7 +47,7 @@ namespace TeleTok
|
|||||||
videoUser = videoUser.Replace(@"/", "");
|
videoUser = videoUser.Replace(@"/", "");
|
||||||
string videoID = segmentedUri.Segments[3];
|
string videoID = segmentedUri.Segments[3];
|
||||||
|
|
||||||
string fixedUrl = "https://www.tiktok.com/" + videoUser + "/video/" + videoID + @"&id=" + videoID + @"&user=" + videoUser.Remove(0);
|
string fixedUrl = "https://www.tiktok.com/" + videoUser + "/video/" + videoID + @"&id=" + videoID + @"&user=" + videoUser.Remove(0, 1);
|
||||||
|
|
||||||
string proxyLink = TeleTok.ptInstance + "/download?url=" + fixedUrl;
|
string proxyLink = TeleTok.ptInstance + "/download?url=" + fixedUrl;
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user