twitter: add option to convert .mp4 to .gif

This commit is contained in:
wukko
2024-01-17 11:38:51 +06:00
parent 67329199e8
commit a63a35c74d
10 changed files with 81 additions and 12 deletions

View File

@@ -3,7 +3,7 @@ import { apiJSON } from "../sub/utils.js";
import loc from "../../localization/manager.js";
import createFilename from "./createFilename.js";
export default function(r, host, userFormat, isAudioOnly, lang, isAudioMuted, disableMetadata, filenamePattern) {
export default function(r, host, userFormat, isAudioOnly, lang, isAudioMuted, disableMetadata, filenamePattern, toGif) {
let action,
responseType = 2,
defaultParams = {
@@ -14,13 +14,14 @@ export default function(r, host, userFormat, isAudioOnly, lang, isAudioMuted, di
fileMetadata: !disableMetadata ? r.fileMetadata : false
},
params = {},
audioFormat = String(userFormat)
audioFormat = String(userFormat);
if (r.isPhoto) action = "photo";
else if (r.picker) action = "picker"
else if (isAudioMuted) action = "muteVideo";
else if (isAudioOnly) action = "audio";
else if (r.isM3U8) action = "singleM3U8";
else if (r.isGif && toGif) action = "gif";
else action = "video";
if (action === "picker" || action === "audio") {
@@ -39,6 +40,10 @@ export default function(r, host, userFormat, isAudioOnly, lang, isAudioMuted, di
case "photo":
responseType = 1;
break;
case "gif":
params = { type: "gif" }
break;
case "singleM3U8":
params = { type: "remux" }