From e2bcad79aa35843da18f35fba09669789ac2a1db Mon Sep 17 00:00:00 2001 From: Snazzah Date: Mon, 30 Oct 2023 12:14:28 -0500 Subject: [PATCH 1/6] feat: add filename attributes to twitch clips --- src/modules/processing/services/twitch.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/modules/processing/services/twitch.js b/src/modules/processing/services/twitch.js index 6d7e6d94..4a4d5b60 100644 --- a/src/modules/processing/services/twitch.js +++ b/src/modules/processing/services/twitch.js @@ -19,6 +19,7 @@ export default async function (obj) { } durationSeconds id + slug medium: thumbnailURL(width: 480, height: 272) title videoQualities { @@ -70,6 +71,13 @@ export default async function (obj) { title: clipMetadata.title, artist: `Twitch Clip by @${clipMetadata.broadcaster.login}, clipped by @${clipMetadata.curator.login}`, }, + filenameAttributes: { + service: "twitch", + id: clipMetadata.id, + title: fileMetadata.title, + author: `${clipMetadata.broadcaster.login}, clipped by ${clipMetadata.curator.login}`, + qualityLabel: `${format.quality}p` + }, filename: `twitchclip_${clipMetadata.id}_${format.quality}p.mp4`, audioFilename: `twitchclip_${clipMetadata.id}_audio` } From 8ed9b8ad5b05fe51b7730c18b4d2c1b18916beb0 Mon Sep 17 00:00:00 2001 From: Snazzah Date: Mon, 30 Oct 2023 12:31:20 -0500 Subject: [PATCH 2/6] chore: update readme --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 820758a7..16998478 100644 --- a/README.md +++ b/README.md @@ -23,7 +23,7 @@ this list is not final and keeps expanding over time. if support for a service y | streamable | ✅ | ✅ | ✅ | ➖ | ➖ | | tiktok | ✅ | ✅ | ✅ | ❌ | ❌ | | tumblr | ✅ | ✅ | ✅ | ➖ | ➖ | -| twitch clips | ✅ | ✅ | ✅ | ✅ | ❌ | +| twitch clips | ✅ | ✅ | ✅ | ✅ | ✅ | | twitter/x | ✅ | ✅ | ✅ | ➖ | ➖ | | vimeo | ✅ | ✅ | ✅ | ✅ | ✅ | | vine archive | ✅ | ✅ | ✅ | ➖ | ➖ | From 5d87b68f5be7b1bed8de79d44a9961e1a2b744eb Mon Sep 17 00:00:00 2001 From: Snazzah Date: Mon, 30 Oct 2023 12:40:15 -0500 Subject: [PATCH 3/6] chore: twitch cleanup --- src/modules/processing/services/twitch.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/modules/processing/services/twitch.js b/src/modules/processing/services/twitch.js index 4a4d5b60..dcd9db54 100644 --- a/src/modules/processing/services/twitch.js +++ b/src/modules/processing/services/twitch.js @@ -19,7 +19,6 @@ export default async function (obj) { } durationSeconds id - slug medium: thumbnailURL(width: 480, height: 272) title videoQualities { @@ -74,7 +73,7 @@ export default async function (obj) { filenameAttributes: { service: "twitch", id: clipMetadata.id, - title: fileMetadata.title, + title: clipMetadata.title, author: `${clipMetadata.broadcaster.login}, clipped by ${clipMetadata.curator.login}`, qualityLabel: `${format.quality}p` }, From d2e124c7cd46f2538a28a0ce473a8332230c3c1a Mon Sep 17 00:00:00 2001 From: Snazzah Date: Mon, 30 Oct 2023 12:41:53 -0500 Subject: [PATCH 4/6] chore: small fix to ext --- src/modules/processing/services/twitch.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/modules/processing/services/twitch.js b/src/modules/processing/services/twitch.js index dcd9db54..b923509c 100644 --- a/src/modules/processing/services/twitch.js +++ b/src/modules/processing/services/twitch.js @@ -75,7 +75,8 @@ export default async function (obj) { id: clipMetadata.id, title: clipMetadata.title, author: `${clipMetadata.broadcaster.login}, clipped by ${clipMetadata.curator.login}`, - qualityLabel: `${format.quality}p` + qualityLabel: `${format.quality}p`, + extension: 'mp4' }, filename: `twitchclip_${clipMetadata.id}_${format.quality}p.mp4`, audioFilename: `twitchclip_${clipMetadata.id}_audio` From 158361c95e7e1e817c7e1147f70d58b49e73441b Mon Sep 17 00:00:00 2001 From: wukko Date: Thu, 23 Nov 2023 21:43:35 +0600 Subject: [PATCH 5/6] twitch: sanitise video title --- src/modules/processing/services/twitch.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/modules/processing/services/twitch.js b/src/modules/processing/services/twitch.js index b923509c..81212ff6 100644 --- a/src/modules/processing/services/twitch.js +++ b/src/modules/processing/services/twitch.js @@ -67,13 +67,13 @@ export default async function (obj) { token: req_token[0].data.clip.playbackAccessToken.value })}`, fileMetadata: { - title: clipMetadata.title, + title: cleanString(clipMetadata.title.trim()), artist: `Twitch Clip by @${clipMetadata.broadcaster.login}, clipped by @${clipMetadata.curator.login}`, }, filenameAttributes: { service: "twitch", id: clipMetadata.id, - title: clipMetadata.title, + title: cleanString(clipMetadata.title.trim()), author: `${clipMetadata.broadcaster.login}, clipped by ${clipMetadata.curator.login}`, qualityLabel: `${format.quality}p`, extension: 'mp4' From 19ba1178380402fb34c5dde910d80b75333ec889 Mon Sep 17 00:00:00 2001 From: wukko Date: Thu, 23 Nov 2023 21:45:23 +0600 Subject: [PATCH 6/6] twitch (oops): actually import cleanString --- src/modules/processing/services/twitch.js | 1 + 1 file changed, 1 insertion(+) diff --git a/src/modules/processing/services/twitch.js b/src/modules/processing/services/twitch.js index 81212ff6..a23f0139 100644 --- a/src/modules/processing/services/twitch.js +++ b/src/modules/processing/services/twitch.js @@ -1,4 +1,5 @@ import { maxVideoDuration } from "../../config.js"; +import { cleanString } from '../../sub/utils.js'; const gqlURL = "https://gql.twitch.tv/gql"; const clientIdHead = { "client-id": "kimne78kx3ncx6brgo4mv6wki5h1ko" };