Skip to content

best way to save what you love

Merge branch 'current' into feat/twitch

wukkoff9d48740d77
diff --cc README.md
index baa7da2a,0964d5dd..ec91b41e
--- a/README.md
+++ b/README.md
@@@ -16,15 -16,15 +16,16 @@@ Paste the link, get the video, move on
| Service | Video + Audio | Only audio | Only video | Additional notes or features |
| -------- | :---: | :---: | :---: | :----- |
| bilibili.com | ✅ | ✅ | ✅ | |
- | Instagram | ✅ | ✅ | ✅ | Ability to pick what to save from multi-media posts. |
+ | Instagram | ✅ | ✅ | ✅ | Supports photos and videos, lets you pick what to save from multi-media posts. |
| Instagram Reels | ✅ | ✅ | ✅ | |
+ | Pinterest | ✅ | ✅ | ✅ | Support for videos and stories. |
| Reddit | ✅ | ✅ | ✅ | Support for GIFs and videos. |
| SoundCloud | ➖ | ✅ | ➖ | Audio metadata, downloads from private links. |
+ | Streamable | ✅ | ✅ | ✅ | |
| TikTok | ✅ | ✅ | ✅ | Supports downloads of: videos with or without watermark, images from slideshow without watermark, full (original) audios. |
- | Tumblr | ✅ | ✅ | ✅ | |
- | Twitter | ✅ | ✅ | ✅ | Ability to pick what to save from multi-media tweets. |
- | Twitter Spaces | ➖ | ✅ | ➖ | Audio metadata with all participants and other info. |
- | Twitch | ✅ | ✅ | ✅ | |
+ | Tumblr | ✅ | ✅ | ✅ | Support for audio file downloads. |
++| Twitch Clips/VODs | ✅ | ✅ | ✅ | |
+ | Twitter/X * | ✅ | ✅ | ✅ | Ability to pick what to save from multi-media tweets. |
| Vimeo | ✅ | ✅ | ✅ | Audio downloads are only available for dash files. |
| Vine Archive | ✅ | ✅ | ✅ | |
| VK Videos | ✅ | ❌ | ❌ | |
diff --cc src/modules/processing/match.js
index aef1c175,51333829..6425f930
--- a/src/modules/processing/match.js
+++ b/src/modules/processing/match.js
@@@ -17,7 -17,8 +17,9 @@@ import vimeo from "./services/vimeo.js"
import soundcloud from "./services/soundcloud.js";
import instagram from "./services/instagram.js";
import vine from "./services/vine.js";
+ import pinterest from "./services/pinterest.js";
+ import streamable from "./services/streamable.js";
+import twitch from "./services/twitch.js";
export default async function (host, patternMatch, url, lang, obj) {
try {
@@@ -111,15 -112,16 +113,24 @@@
case "vine":
r = await vine({ id: patternMatch["id"] });
break;
+ case "pinterest":
+ r = await pinterest({ id: patternMatch["id"] });
+ break;
+ case "streamable":
+ r = await streamable({
+ id: patternMatch["id"],
+ quality: obj.vQuality,
+ isAudioOnly: isAudioOnly,
+ });
+ break;
+ case "twitch":
+ r = await twitch({
+ vodId: patternMatch["video"] ? patternMatch["video"] : false,
+ clipId: patternMatch["clip"] ? patternMatch["clip"] : false,
+ lang: lang, quality: obj.vQuality,
+ isAudioOnly: obj.isAudioOnly,
+ format: obj.vFormat
+ });
- break;
default:
return apiJSON(0, { t: errorUnsupported(lang) });
}
diff --cc src/modules/processing/servicesConfig.json
index 0318d4e2,29b44894..f904eafe
--- a/src/modules/processing/servicesConfig.json
+++ b/src/modules/processing/servicesConfig.json
@@@ -63,11 -63,15 +63,21 @@@
"patterns": ["v/:id"],
"enabled": true
},
- "twitch": {
+ "pinterest": {
+ "alias": "pinterest videos & stories",
+ "patterns": ["pin/:id"],
+ "enabled": true
+ },
+ "streamable": {
+ "alias": "streamable.com",
+ "patterns": [":id", "o/:id", "e/:id", "s/:id"],
+ "enabled": true
++ },
++ "twitch": {
+ "alias": "twitch vods & videos & clips",
+ "tld": "tv",
+ "patterns": ["videos/:video", ":channel/clip/:clip"],
+ "enabled": true
}
}
}
diff --cc src/modules/processing/servicesPatternTesters.js
index 35eaa902,cd4d4d61..cdc2ca44
--- a/src/modules/processing/servicesPatternTesters.js
+++ b/src/modules/processing/servicesPatternTesters.js
@@@ -29,6 -29,8 +29,10 @@@ export const testers =
"instagram": (patternMatch) => (patternMatch["id"] && patternMatch["id"].length <= 12),
"vine": (patternMatch) => (patternMatch["id"] && patternMatch["id"].length <= 12),
-
+
+ "pinterest": (patternMatch) => (patternMatch["id"] && patternMatch["id"].length <= 128),
+
- "streamable": (patternMatch) => (patternMatch["id"] && patternMatch["id"].length === 6)
++ "streamable": (patternMatch) => (patternMatch["id"] && patternMatch["id"].length === 6),
++
+ "twitch": (patternMatch) => ((patternMatch["channel"] && patternMatch["clip"] && patternMatch["clip"].length <= 100 || patternMatch["video"] && patternMatch["video"].length <= 10)),
}
diff --cc src/modules/sub/utils.js
index 345a7540,0a905110..6f6886c9
--- a/src/modules/sub/utils.js
+++ b/src/modules/sub/utils.js
@@@ -84,11 -73,14 +73,17 @@@ export function cleanURL(url, host)
if (url.includes('youtube.com/shorts/')) {
url = url.split('?')[0].replace('shorts/', 'watch?v=');
}
+ if (url.includes('clips.twitch.tv')) {
+ url = url.split('?')[0].replace('clips.twitch.tv/', 'twitch.tv/_/clip/');
+ }
return url.slice(0, 128)
}
+ export function cleanString(string) {
+ for (let i in forbiddenCharsString) {
+ string = string.replaceAll(forbiddenCharsString[i], '')
+ }
+ return string;
+ }
export function verifyLanguageCode(code) {
return RegExp(/[a-z]{2}/).test(String(code.slice(0, 2).toLowerCase())) ? String(code.slice(0, 2).toLowerCase()) : "en"
}
diff --cc src/test/tests.json
index 5e11f3b1,692e97fa..08d3c9af
--- a/src/test/tests.json
+++ b/src/test/tests.json
@@@ -894,61 -981,94 +981,151 @@@
"status": "stream"
}
}],
+ "pinterest": [{
+ "name": "regular video",
+ "url": "https://www.pinterest.com/pin/70437485604616/",
+ "params": {},
+ "expected": {
+ "code": 200,
+ "status": "redirect"
+ }
+ }, {
+ "name": "regular video (isAudioOnly)",
+ "url": "https://www.pinterest.com/pin/70437485604616/",
+ "params": {
+ "isAudioOnly": true
+ },
+ "expected": {
+ "code": 200,
+ "status": "stream"
+ }
+ }, {
+ "name": "regular video (isAudioMuted)",
+ "url": "https://www.pinterest.com/pin/70437485604616/",
+ "params": {
+ "isAudioMuted": true
+ },
+ "expected": {
+ "code": 200,
+ "status": "stream"
+ }
+ }, {
+ "name": "regular video (.ca TLD)",
+ "url": "https://www.pinterest.ca/pin/70437485604616/",
+ "params": {},
+ "expected": {
+ "code": 200,
+ "status": "redirect"
+ }
+ }, {
+ "name": "story",
+ "url": "https://www.pinterest.com/pin/gadget-cool-products-amazon-product-technology-kitchen-gadgets--1084663891475263837/",
+ "params": {},
+ "expected": {
+ "code": 200,
+ "status": "redirect"
+ }
+ }],
+ "streamable": [{
+ "name": "regular video",
+ "url": "https://streamable.com/03r3c2",
+ "params": {},
+ "expected": {
+ "code": 200,
+ "status": "redirect"
+ }
+ }, {
+ "name": "embedded link",
+ "url": "https://streamable.com/e/rsmo56",
+ "params": {},
+ "expected": {
+ "code": 200,
+ "status": "redirect"
+ }
+ }, {
+ "name": "regular video (isAudioOnly)",
+ "url": "https://streamable.com/03r3c2",
+ "params": {
+ "isAudioOnly": true
+ },
+ "expected": {
+ "code": 200,
+ "status": "stream"
+ }
+ }, {
+ "name": "regular video (isAudioMuted)",
+ "url": "https://streamable.com/03r3c2",
+ "params": {
+ "isAudioMuted": true
+ },
+ "expected": {
+ "code": 200,
+ "status": "stream"
+ }
+ }, {
+ "name": "inexistent video",
+ "url": "https://streamable.com/XXXXXX",
+ "params": {},
+ "expected": {
+ "code": 400,
+ "status": "error"
+ }
++ }],
+ "twitch": [{
+ "name": "clip",
+ "url": "https://twitch.tv/rtgame/clip/TubularInventiveSardineCorgiDerp-PM47mJQQ2vsL5B5G",
+ "params": {},
+ "expected": {
+ "code": 200,
+ "status": "stream"
+ }
+ }, {
+ "name": "clip (isAudioOnly)",
+ "url": "https://twitch.tv/rtgame/clip/TubularInventiveSardineCorgiDerp-PM47mJQQ2vsL5B5G",
+ "params": {
+ "isAudioOnly": true
+ },
+ "expected": {
+ "code": 200,
+ "status": "stream"
+ }
+ }, {
+ "name": "clip (isAudioMuted)",
+ "url": "https://twitch.tv/rtgame/clip/TubularInventiveSardineCorgiDerp-PM47mJQQ2vsL5B5G",
+ "params": {
+ "isAudioMuted": true
+ },
+ "expected": {
+ "code": 200,
+ "status": "stream"
+ }
+ }, {
+ "name": "video",
+ "url": "https://twitch.tv/videos/1315890970",
+ "params": {},
+ "expected": {
+ "code": 200,
+ "status": "stream"
+ }
+ }, {
+ "name": "video (isAudioOnly)",
+ "url": "https://twitch.tv/videos/1315890970",
+ "params": {
+ "isAudioOnly": true
+ },
+ "expected": {
+ "code": 200,
+ "status": "stream"
+ }
+ }, {
+ "name": "video (isAudioMuted)",
+ "url": "https://twitch.tv/videos/1315890970",
+ "params": {
+ "isAudioMuted": true
+ },
+ "expected": {
+ "code": 200,
+ "status": "stream"
+ }
}]
--}
++}