Compare commits

..
57 Commits
Author SHA1 Message Date
Brahim Hadriche 03bb19522d Release v0.41.21 (#746) 2025-09-28 12:07:31 -04:00
Brahim Hadriche 75d92d3800 [skip ci] Track login errors and drm errors better 2025-09-28 12:05:31 -04:00
Brahim Hadriche 974ff39c09 [skip ci] configurable invidious port in tools 2025-09-28 09:48:50 -04:00
Brahim Hadriche 15ba5f1704 update dependencies (#745) 2025-09-27 17:50:33 -04:00
Brahim Hadriche 3982909801 [skip ci] tweak context 2025-09-27 11:01:34 -04:00
Brahim Hadriche 85b5c615b9 [skip ci] skip reporting drm errors 2025-09-27 10:57:53 -04:00
Brahim Hadriche 3227bf38b4 [skip ci] yt_premiere_broadcast is considered live stream 2025-09-22 11:02:19 -04:00
Brahim Hadriche ba2fbaa0da [skip ci] move node type to right parser function 2025-09-22 07:57:44 -04:00
Brahim Hadriche c12436f464 dash gen bug 2025-09-21 19:26:04 -04:00
Brahim Hadriche e029d24061 Release v0.41.20 (#743) 2025-09-21 17:19:18 -04:00
Brahim Hadriche ff663b6787 Capture missing init-range fields - 2 2025-09-21 17:17:43 -04:00
Brahim Hadriche 5acfe91944 Release v0.41.19 (#742) 2025-09-21 11:48:17 -04:00
Brahim Hadriche 7d217e49de Capture missing init-range fields 2025-09-21 11:45:19 -04:00
Brahim Hadriche a67080be61 [skip ci] update rale tracker 2025-09-21 11:08:05 -04:00
Brahim Hadriche 21128d525d [skip ci] ignore TILE_CONTENT_TYPE_CHANNEL for now 2025-09-21 09:44:49 -04:00
Brahim Hadriche 305905328d [skip ci] expose companion port 2025-09-20 17:01:27 -04:00
Brahim Hadriche 2e9594274e [skip ci] tools - add an invidious testing instance 2025-09-20 16:31:29 -04:00
Brahim Hadriche 091d5d3c45 [skip ci] ignore nodes 2025-09-20 13:29:48 -04:00
Brahim Hadriche 3a5cf0d3d7 update dependencies (#739) 2025-09-20 09:07:13 -04:00
Brahim Hadriche ace3c6009a [skip ci] changelog entry 2025-09-20 09:07:02 -04:00
Brahim Hadriche 807c528086 Release v0.41.18 (#741) 2025-09-20 08:52:23 -04:00
Brahim Hadriche 2c22e97dbe Fix crash due to bad type casting 2025-09-20 08:52:01 -04:00
Brahim Hadriche 840866ce06 [skip ci] Ignore compactRadioRenderer 2025-09-19 22:38:55 -04:00
Brahim Hadriche 007607e21c [skip ci] req id tripping 2025-09-19 21:20:47 -04:00
Brahim Hadriche b4a4a688ca [skip ci] do not log STS_MISMATCH errors 2025-09-19 16:38:04 -04:00
Brahim Hadriche 688206ef91 Release v0.41.17 (#738) 2025-09-19 16:14:51 -04:00
Brahim Hadriche 3acc1bf9c9 syslog events tweak 2025-09-19 16:08:31 -04:00
Brahim Hadriche 21b1a9ea81 Release v0.41.16 (#735) 2025-09-19 13:32:33 -04:00
Brahim Hadriche 3f252a9b11 Small tweak 2025-09-19 13:30:11 -04:00
Brahim Hadriche c5146017a8 [skip ci] tweak player response parsing 2025-09-19 13:07:40 -04:00
Brahim Hadriche 7f58809737 Release v0.41.15 (#734) 2025-09-19 09:20:50 -04:00
Brahim Hadriche 6748390ac4 Comment 2025-09-19 09:17:45 -04:00
Brahim Hadriche d2fac255ed Improve session data error handling 2025-09-19 09:17:19 -04:00
Brahim Hadriche dbcfc46dad Improve fingerprinting for requests 2025-09-19 09:04:05 -04:00
Brahim Hadriche 671719905b keep last dash/hls in tracking 2025-09-19 08:56:07 -04:00
Brahim Hadriche 5417f5d61d Add retry on getting session data 2025-09-19 08:55:40 -04:00
Brahim Hadriche ee0abc9891 refactor 2025-09-19 08:55:24 -04:00
Brahim Hadriche bb7407f75f [skip ci] Fix rare crash when loading video feed 2025-09-18 21:37:09 -04:00
Brahim Hadriche b101872906 Release v0.41.14 (#733) 2025-09-18 19:00:29 -04:00
Brahim Hadriche 8f42bfa675 [skip ci] Better handling for lounge lost sessions 2025-09-18 18:59:47 -04:00
Brahim Hadriche b8d2008b98 Regression for Attempt to play the next video when errors occur 2025-09-18 18:51:05 -04:00
Brahim Hadriche 36910ab5cf Try fetching multiple pages in the search, in case results are filtered out (e.g. shorts) 2025-09-18 18:38:38 -04:00
Brahim Hadriche ae09f711df [skip ci] small tweak 2025-09-18 17:45:54 -04:00
Brahim Hadriche 6401a93420 Release v0.41.13 (#732) 2025-09-18 17:21:24 -04:00
Brahim Hadriche 3039c00fdb [skip ci] adjust thread count 2025-09-18 16:56:19 -04:00
Brahim Hadriche 8010765c8e Various fixes 2025-09-18 16:35:36 -04:00
Brahim Hadriche 62f96dea5e Release v0.41.12 (#731) 2025-09-17 18:25:09 -04:00
Brahim Hadriche 15a0177083 Fallback to 360p when dash streams are missing 2025-09-17 18:23:18 -04:00
Brahim Hadriche 9f83391e37 [skip ci] tweak 2025-09-17 16:37:54 -04:00
Brahim Hadriche f742826b8d [skip ci] tweak 2025-09-17 16:27:50 -04:00
Brahim Hadriche 763d7e1309 Release v0.41.11 (#730) 2025-09-17 09:08:03 -04:00
Brahim Hadriche 9ae59a1bd7 [skip ci] changelog 2025-09-17 09:00:30 -04:00
Brahim Hadriche ae64f73c67 [skip ci] Fingerprint validation 2025-09-16 21:48:21 -04:00
Brahim Hadriche 8329fef6c1 [skip ci] changelog 2025-09-16 20:12:02 -04:00
Brahim Hadriche 0c5aa6895a Release v0.41.10 (#729) 2025-09-16 19:49:26 -04:00
Brahim Hadriche 6a770b90b4 [skip ci] tweak event 2025-09-16 19:48:29 -04:00
Brahim Hadriche 08a71b3699 Disable event batching 2025-09-16 19:31:17 -04:00
66 changed files with 1128 additions and 446 deletions

No files matched your search

+80
View File
@@ -5,6 +5,86 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [0.41.21] - 2025-09-28
### Fixed
- Dash generation bug
- Track login errors and drm errors better
## [0.41.20] - 2025-09-21
### Fixed
- Capturing diagnostic events related to playback errors to further investigate
## [0.41.19] - 2025-09-21
### Fixed
- Capturing diagnostic events related to playback errors to further investigate
## [0.41.18] - 2025-09-20
### Fixed
- Various fixes and improvements
- Crash due to bad type casting
## [0.41.17] - 2025-09-19
### Fixed
- Various fixes and improvements
## [0.41.16] - 2025-09-19
### Fixed
- Various fixes and improvements
## [0.41.15] - 2025-09-19
### Fixed
- Rare crash when loading video feed
- Improve session data error handling
## [0.41.14] - 2025-09-18
### Fixed
- Try fetching multiple pages in the search, in case results are filtered out (e.g. shorts)
- Regression for `Attempt to play the next video when errors occur`
- Better handling for lounge lost sessions
## [0.41.13] - 2025-09-18
### Fixed
- Issue with `credentialTransferToken`s which caused "Login to confirm you're not a bot" even when logged in
- Adjust live video detection to reduce error rate happening on iOS client (another attempt)
- Attempt to play the next video when errors occur
- Remove manual video cache for Invidious to avoid stale streams
## [0.41.12] - 2025-09-17
### Fixed
- Fallback to 360p when dash streams are missing
## [0.41.11] - 2025-09-17
### Fixed
- Small fixes related to events
## [0.41.10] - 2025-09-16
### Fixed
- Disabled event batching
## [0.41.9] - 2025-09-16 ## [0.41.9] - 2025-09-16
### Added ### Added
+45 -45
View File
@@ -1,18 +1,18 @@
{ {
"name": "playlet", "name": "playlet",
"version": "0.41.9", "version": "0.41.21",
"lockfileVersion": 3, "lockfileVersion": 3,
"requires": true, "requires": true,
"packages": { "packages": {
"": { "": {
"name": "playlet", "name": "playlet",
"version": "0.41.9", "version": "0.41.21",
"hasInstallScript": true, "hasInstallScript": true,
"devDependencies": { "devDependencies": {
"@rokucommunity/bslint": "^0.8.35", "@rokucommunity/bslint": "^0.8.35",
"@types/crypto-js": "^4.2.2", "@types/crypto-js": "^4.2.2",
"@types/fs-extra": "^11.0.4", "@types/fs-extra": "^11.0.4",
"@types/node": "^24.3.3", "@types/node": "^24.5.2",
"@types/xml2js": "^0.4.14", "@types/xml2js": "^0.4.14",
"argparse": "^2.0.1", "argparse": "^2.0.1",
"brighterscript": "0.70.1", "brighterscript": "0.70.1",
@@ -20,14 +20,14 @@
"convert-svg-to-png": "^0.7.1", "convert-svg-to-png": "^0.7.1",
"crypto-js": "^4.2.0", "crypto-js": "^4.2.0",
"dotenv": "^17.2.2", "dotenv": "^17.2.2",
"fs-extra": "^11.3.1", "fs-extra": "^11.3.2",
"glob": "^11.0.3", "glob": "^11.0.3",
"imap": "^0.8.19", "imap": "^0.8.19",
"ip": "^2.0.1", "ip": "^2.0.1",
"json5": "^2.2.3", "json5": "^2.2.3",
"mailparser": "^3.7.4", "mailparser": "^3.7.4",
"protocol-buffers-schema": "^3.6.0", "protocol-buffers-schema": "^3.6.0",
"puppeteer": "^24.20.0", "puppeteer": "^24.22.3",
"roku-deploy": "^3.13.0", "roku-deploy": "^3.13.0",
"roku-test-automation": "^2.2.1", "roku-test-automation": "^2.2.1",
"rooibos-roku": "5.15.5", "rooibos-roku": "5.15.5",
@@ -43,7 +43,7 @@
"node": "22" "node": "22"
}, },
"optionalDependencies": { "optionalDependencies": {
"@rollup/rollup-linux-x64-gnu": "^4.50.1" "@rollup/rollup-linux-x64-gnu": "^4.52.2"
} }
}, },
"node_modules/@babel/code-frame": { "node_modules/@babel/code-frame": {
@@ -573,9 +573,9 @@
} }
}, },
"node_modules/@rollup/rollup-linux-x64-gnu": { "node_modules/@rollup/rollup-linux-x64-gnu": {
"version": "4.50.1", "version": "4.52.2",
"resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-gnu/-/rollup-linux-x64-gnu-4.50.1.tgz", "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-gnu/-/rollup-linux-x64-gnu-4.52.2.tgz",
"integrity": "sha512-MCgtFB2+SVNuQmmjHf+wfI4CMxy3Tk8XjA5Z//A0AKD7QXUYFMQcns91K6dEHBvZPCnhJSyDWLApk40Iq/H3tA==", "integrity": "sha512-opH8GSUuVcCSSyHHcl5hELrmnk4waZoVpgn/4FDao9iyE4WpQhyWJ5ryl5M3ocp4qkRuHfyXnGqg8M9oKCEKRA==",
"cpu": [ "cpu": [
"x64" "x64"
], ],
@@ -736,13 +736,13 @@
"license": "MIT" "license": "MIT"
}, },
"node_modules/@types/node": { "node_modules/@types/node": {
"version": "24.3.3", "version": "24.5.2",
"resolved": "https://registry.npmjs.org/@types/node/-/node-24.3.3.tgz", "resolved": "https://registry.npmjs.org/@types/node/-/node-24.5.2.tgz",
"integrity": "sha512-GKBNHjoNw3Kra1Qg5UXttsY5kiWMEfoHq2TmXb+b1rcm6N7B3wTrFYIf/oSZ1xNQ+hVVijgLkiDZh7jRRsh+Gw==", "integrity": "sha512-FYxk1I7wPv3K2XBaoyH2cTnocQEu8AOZ60hPbsyukMPLv5/5qr7V1i8PLHdl6Zf87I+xZXFvPCXYjiTFq+YSDQ==",
"dev": true, "dev": true,
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"undici-types": "~7.10.0" "undici-types": "~7.12.0"
} }
}, },
"node_modules/@types/qs": { "node_modules/@types/qs": {
@@ -2538,9 +2538,9 @@
"dev": true "dev": true
}, },
"node_modules/debug": { "node_modules/debug": {
"version": "4.4.1", "version": "4.4.3",
"resolved": "https://registry.npmjs.org/debug/-/debug-4.4.1.tgz", "resolved": "https://registry.npmjs.org/debug/-/debug-4.4.3.tgz",
"integrity": "sha512-KcKCqiftBJcZr++7ykoDIEwSa3XWowTfNPo92BYxjXiyYEVrUQh2aLyhxBCwww+heortUFxEJYcRzosstTEBYQ==", "integrity": "sha512-RGwwWnwQvkVfavKVt22FGLw+xYSdzARwm0ru6DhTVA3umU5hZc28V3kO4stgYryrTlLpuvgI9GiijltAjNbcqA==",
"dev": true, "dev": true,
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
@@ -3355,9 +3355,9 @@
} }
}, },
"node_modules/fs-extra": { "node_modules/fs-extra": {
"version": "11.3.1", "version": "11.3.2",
"resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-11.3.1.tgz", "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-11.3.2.tgz",
"integrity": "sha512-eXvGGwZ5CL17ZSwHWd3bbgk7UUpF6IFHtP57NYYakPvHOs8GDgDe5KJI36jIJzDkJ6eJjuzRA8eBQb6SkKue0g==", "integrity": "sha512-Xr9F6z6up6Ws+NjzMCZc6WXg2YFRlrLP9NQDO3VQrWrfiojdhS56TzueT88ze0uBdCTwEIhQ3ptnmKeWGFAe0A==",
"dev": true, "dev": true,
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
@@ -5300,18 +5300,18 @@
} }
}, },
"node_modules/puppeteer": { "node_modules/puppeteer": {
"version": "24.20.0", "version": "24.22.3",
"resolved": "https://registry.npmjs.org/puppeteer/-/puppeteer-24.20.0.tgz", "resolved": "https://registry.npmjs.org/puppeteer/-/puppeteer-24.22.3.tgz",
"integrity": "sha512-iLnLV9oHKKAujmxiSxRWKfcT1q2COu0g1N9iU2TCp1MlmsyjgNAkcBOR3cAOqKb5UTiVPIGG4z5PO5yfpYZ6jA==", "integrity": "sha512-mnhXzIqSYSJ1SMv1RYH07YMzWP81xCmmQj91Q8iQMZqnf97eVzeHgsGL6kpywiGCi+nQafta/+NkwM4URMy/XQ==",
"dev": true, "dev": true,
"hasInstallScript": true, "hasInstallScript": true,
"license": "Apache-2.0", "license": "Apache-2.0",
"dependencies": { "dependencies": {
"@puppeteer/browsers": "2.10.9", "@puppeteer/browsers": "2.10.10",
"chromium-bidi": "8.0.0", "chromium-bidi": "9.1.0",
"cosmiconfig": "^9.0.0", "cosmiconfig": "^9.0.0",
"devtools-protocol": "0.0.1495869", "devtools-protocol": "0.0.1495869",
"puppeteer-core": "24.20.0", "puppeteer-core": "24.22.3",
"typed-query-selector": "^2.12.0" "typed-query-selector": "^2.12.0"
}, },
"bin": { "bin": {
@@ -5345,13 +5345,13 @@
"dev": true "dev": true
}, },
"node_modules/puppeteer/node_modules/@puppeteer/browsers": { "node_modules/puppeteer/node_modules/@puppeteer/browsers": {
"version": "2.10.9", "version": "2.10.10",
"resolved": "https://registry.npmjs.org/@puppeteer/browsers/-/browsers-2.10.9.tgz", "resolved": "https://registry.npmjs.org/@puppeteer/browsers/-/browsers-2.10.10.tgz",
"integrity": "sha512-kUGHwABarVhvMP+zhW5zvDA7LmGcd4TwrTEBwcTQic5EebUqaK5NjC0UXLJepIFVGsr2N/Z8NJQz2JYGo1ZwxA==", "integrity": "sha512-3ZG500+ZeLql8rE0hjfhkycJjDj0pI/btEh3L9IkWUYcOrgP0xCNRq3HbtbqOPbvDhFaAWD88pDFtlLv8ns8gA==",
"dev": true, "dev": true,
"license": "Apache-2.0", "license": "Apache-2.0",
"dependencies": { "dependencies": {
"debug": "^4.4.1", "debug": "^4.4.3",
"extract-zip": "^2.0.1", "extract-zip": "^2.0.1",
"progress": "^2.0.3", "progress": "^2.0.3",
"proxy-agent": "^6.5.0", "proxy-agent": "^6.5.0",
@@ -5393,9 +5393,9 @@
} }
}, },
"node_modules/puppeteer/node_modules/chromium-bidi": { "node_modules/puppeteer/node_modules/chromium-bidi": {
"version": "8.0.0", "version": "9.1.0",
"resolved": "https://registry.npmjs.org/chromium-bidi/-/chromium-bidi-8.0.0.tgz", "resolved": "https://registry.npmjs.org/chromium-bidi/-/chromium-bidi-9.1.0.tgz",
"integrity": "sha512-d1VmE0FD7lxZQHzcDUCKZSNRtRwISXDsdg4HjdTR5+Ll5nQ/vzU12JeNmupD6VWffrPSlrnGhEWlLESKH3VO+g==", "integrity": "sha512-rlUzQ4WzIAWdIbY/viPShhZU2n21CxDUgazXVbw4Hu1MwaeUSEksSeM6DqPgpRjCLXRk702AVRxJxoOz0dw4OA==",
"dev": true, "dev": true,
"license": "Apache-2.0", "license": "Apache-2.0",
"dependencies": { "dependencies": {
@@ -5456,18 +5456,18 @@
"license": "MIT" "license": "MIT"
}, },
"node_modules/puppeteer/node_modules/puppeteer-core": { "node_modules/puppeteer/node_modules/puppeteer-core": {
"version": "24.20.0", "version": "24.22.3",
"resolved": "https://registry.npmjs.org/puppeteer-core/-/puppeteer-core-24.20.0.tgz", "resolved": "https://registry.npmjs.org/puppeteer-core/-/puppeteer-core-24.22.3.tgz",
"integrity": "sha512-n0y/f8EYyZt4yEJkjP3Vrqf9A4qa3uYpKYdsiedIY4bxIfTw1aAJSpSVPmWBPlr1LO4cNq2hGNIBWKPhvBF68w==", "integrity": "sha512-M/Jhg4PWRANSbL/C9im//Yb55wsWBS5wdp+h59iwM+EPicVQQCNs56iC5aEAO7avfDPRfxs4MM16wHjOYHNJEw==",
"dev": true, "dev": true,
"license": "Apache-2.0", "license": "Apache-2.0",
"dependencies": { "dependencies": {
"@puppeteer/browsers": "2.10.9", "@puppeteer/browsers": "2.10.10",
"chromium-bidi": "8.0.0", "chromium-bidi": "9.1.0",
"debug": "^4.4.1", "debug": "^4.4.3",
"devtools-protocol": "0.0.1495869", "devtools-protocol": "0.0.1495869",
"typed-query-selector": "^2.12.0", "typed-query-selector": "^2.12.0",
"webdriver-bidi-protocol": "0.2.8", "webdriver-bidi-protocol": "0.2.11",
"ws": "^8.18.3" "ws": "^8.18.3"
}, },
"engines": { "engines": {
@@ -7502,9 +7502,9 @@
} }
}, },
"node_modules/undici-types": { "node_modules/undici-types": {
"version": "7.10.0", "version": "7.12.0",
"resolved": "https://registry.npmjs.org/undici-types/-/undici-types-7.10.0.tgz", "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-7.12.0.tgz",
"integrity": "sha512-t5Fy/nfn+14LuOc2KNYg75vZqClpAiqscVvMygNnlsHBFpSXdJaYtXMcdNLpl/Qvc3P2cB3s6lOV51nqsFq4ag==", "integrity": "sha512-goOacqME2GYyOZZfb5Lgtu+1IDmAlAEu5xnD3+xTzS10hT0vzpf0SPjkXwAw9Jm+4n/mQGDP3LO8CPbYROeBfQ==",
"dev": true, "dev": true,
"license": "MIT" "license": "MIT"
}, },
@@ -7696,9 +7696,9 @@
"dev": true "dev": true
}, },
"node_modules/webdriver-bidi-protocol": { "node_modules/webdriver-bidi-protocol": {
"version": "0.2.8", "version": "0.2.11",
"resolved": "https://registry.npmjs.org/webdriver-bidi-protocol/-/webdriver-bidi-protocol-0.2.8.tgz", "resolved": "https://registry.npmjs.org/webdriver-bidi-protocol/-/webdriver-bidi-protocol-0.2.11.tgz",
"integrity": "sha512-KPvtVAIX8VHjLZH1KHT5GXoOaPeb0Ju+JlAcdshw6Z/gsmRtLoxt0Hw99PgJwZta7zUQaAUIHHWDRkzrPHsQTQ==", "integrity": "sha512-Y9E1/oi4XMxcR8AT0ZC4OvYntl34SPgwjmELH+owjBr0korAX4jKgZULBWILGCVGdVCQ0dodTToIETozhG8zvA==",
"dev": true, "dev": true,
"license": "Apache-2.0" "license": "Apache-2.0"
}, },
+5 -5
View File
@@ -1,12 +1,12 @@
{ {
"name": "playlet", "name": "playlet",
"version": "0.41.9", "version": "0.41.21",
"description": "Unofficial YouTube client for Roku", "description": "Unofficial YouTube client for Roku",
"devDependencies": { "devDependencies": {
"@rokucommunity/bslint": "^0.8.35", "@rokucommunity/bslint": "^0.8.35",
"@types/crypto-js": "^4.2.2", "@types/crypto-js": "^4.2.2",
"@types/fs-extra": "^11.0.4", "@types/fs-extra": "^11.0.4",
"@types/node": "^24.3.3", "@types/node": "^24.5.2",
"@types/xml2js": "^0.4.14", "@types/xml2js": "^0.4.14",
"argparse": "^2.0.1", "argparse": "^2.0.1",
"brighterscript": "0.70.1", "brighterscript": "0.70.1",
@@ -14,14 +14,14 @@
"convert-svg-to-png": "^0.7.1", "convert-svg-to-png": "^0.7.1",
"crypto-js": "^4.2.0", "crypto-js": "^4.2.0",
"dotenv": "^17.2.2", "dotenv": "^17.2.2",
"fs-extra": "^11.3.1", "fs-extra": "^11.3.2",
"glob": "^11.0.3", "glob": "^11.0.3",
"imap": "^0.8.19", "imap": "^0.8.19",
"ip": "^2.0.1", "ip": "^2.0.1",
"json5": "^2.2.3", "json5": "^2.2.3",
"mailparser": "^3.7.4", "mailparser": "^3.7.4",
"protocol-buffers-schema": "^3.6.0", "protocol-buffers-schema": "^3.6.0",
"puppeteer": "^24.20.0", "puppeteer": "^24.22.3",
"roku-deploy": "^3.13.0", "roku-deploy": "^3.13.0",
"roku-test-automation": "^2.2.1", "roku-test-automation": "^2.2.1",
"rooibos-roku": "5.15.5", "rooibos-roku": "5.15.5",
@@ -74,6 +74,6 @@
"shutdown": "node tools/shutdown.js" "shutdown": "node tools/shutdown.js"
}, },
"optionalDependencies": { "optionalDependencies": {
"@rollup/rollup-linux-x64-gnu": "^4.50.1" "@rollup/rollup-linux-x64-gnu": "^4.52.2"
} }
} }
+2 -2
View File
@@ -1,12 +1,12 @@
{ {
"name": "playlet-app", "name": "playlet-app",
"version": "0.41.9", "version": "0.41.21",
"lockfileVersion": 2, "lockfileVersion": 2,
"requires": true, "requires": true,
"packages": { "packages": {
"": { "": {
"name": "playlet-app", "name": "playlet-app",
"version": "0.41.9" "version": "0.41.21"
} }
} }
} }
+1 -1
View File
@@ -1,6 +1,6 @@
{ {
"name": "playlet-app", "name": "playlet-app",
"version": "0.41.9", "version": "0.41.21",
"description": "Unofficial YouTube client for Roku", "description": "Unofficial YouTube client for Roku",
"scripts": { "scripts": {
"prebuild": "rm -rf ../build/playlet-app", "prebuild": "rm -rf ../build/playlet-app",
+1 -1
View File
@@ -3,7 +3,7 @@ title=Playlet
# Do not update version manually, it is auto updated from package.json # Do not update version manually, it is auto updated from package.json
major_version=0 major_version=0
minor_version=41 minor_version=41
build_version=00009 build_version=00021
ui_resolutions=hd ui_resolutions=hd
uri_resolution_autosub=$$RES$$,480p,720p,1080p uri_resolution_autosub=$$RES$$,480p,720p,1080p
+2 -2
View File
@@ -1,12 +1,12 @@
{ {
"name": "playlet-lib", "name": "playlet-lib",
"version": "0.41.9", "version": "0.41.21",
"lockfileVersion": 2, "lockfileVersion": 2,
"requires": true, "requires": true,
"packages": { "packages": {
"": { "": {
"name": "playlet-lib", "name": "playlet-lib",
"version": "0.41.9" "version": "0.41.21"
} }
} }
} }
+1 -1
View File
@@ -1,6 +1,6 @@
{ {
"name": "playlet-lib", "name": "playlet-lib",
"version": "0.41.9", "version": "0.41.21",
"description": "Unofficial YouTube client for Roku", "description": "Unofficial YouTube client for Roku",
"scripts": { "scripts": {
"prebuild": "rm -rf ../build/playlet-lib", "prebuild": "rm -rf ../build/playlet-lib",
@@ -16,7 +16,7 @@ function ExecuteJob() as void
return return
end if end if
cancellation = CancellationUtils.CreateCancellation(JobGetCallbackNode(), "cancel", true) cancellation = JobGetCancellation()
isInnertubeProfile = authToken.profileNode.type = "youtube" isInnertubeProfile = authToken.profileNode.type = "youtube"
if isInnertubeProfile if isInnertubeProfile
subscriptionStatus = InnertubeService.GetSubscriptionStatusForChannel(ucid, { subscriptionStatus = InnertubeService.GetSubscriptionStatusForChannel(ucid, {
@@ -14,7 +14,7 @@ function ExecuteJob() as void
return return
end if end if
cancellation = CancellationUtils.CreateCancellation(JobGetCallbackNode(), "cancel", true) cancellation = JobGetCancellation()
service = new Invidious.InvidiousService(invidiousNode) service = new Invidious.InvidiousService(invidiousNode)
if subscribe if subscribe
@@ -14,7 +14,7 @@ function ExecuteJob() as void
end if end if
service = new Invidious.InvidiousService(invidiousNode) service = new Invidious.InvidiousService(invidiousNode)
cancellation = CancellationUtils.CreateCancellation(JobGetCallbackNode(), "cancel", true) cancellation = JobGetCancellation()
response = service.GetChannel(contentNode.authorId, cancellation) response = service.GetChannel(contentNode.authorId, cancellation)
if JobIsCancelled() if JobIsCancelled()
@@ -17,7 +17,7 @@ function ExecuteJob() as void
service = new Invidious.InvidiousService(invidiousNode) service = new Invidious.InvidiousService(invidiousNode)
instance = service.GetInstance() instance = service.GetInstance()
cancellation = CancellationUtils.CreateCancellation(JobGetCallbackNode(), "cancel", true) cancellation = JobGetCancellation()
while true while true
playlistId = contentNode.playlistId playlistId = contentNode.playlistId
@@ -8,7 +8,7 @@ function ExecuteJob() as void
accessTokenObject = input.accessTokenObject accessTokenObject = input.accessTokenObject
profilesService = input.profilesService profilesService = input.profilesService
try try
cancellation = CancellationUtils.CreateCancellation(JobGetCallbackNode(), "cancel", true) cancellation = JobGetCancellation()
if InnertubeService.AuthRefreshAccessToken(accessTokenObject, cancellation) if InnertubeService.AuthRefreshAccessToken(accessTokenObject, cancellation)
profileNode.expiresIn = accessTokenObject.expiresIn profileNode.expiresIn = accessTokenObject.expiresIn
profileNode.expiresTimestamp = accessTokenObject.expiresTimestamp profileNode.expiresTimestamp = accessTokenObject.expiresTimestamp
@@ -11,7 +11,7 @@ function ExecuteJob() as void
profilesNode = input.profilesService profilesNode = input.profilesService
dialogNode = input.dialog dialogNode = input.dialog
cancellation = CancellationUtils.CreateCancellation(JobGetCallbackNode(), "cancel", true) cancellation = JobGetCancellation()
' TODO:P2 cache client identity ' TODO:P2 cache client identity
authCode = InnertubeService.AuthGetCode(cancellation) authCode = InnertubeService.AuthGetCode(cancellation)
@@ -1,4 +1,5 @@
import "pkg:/source/utils/AssertUtils.bs" import "pkg:/source/utils/AssertUtils.bs"
import "pkg:/source/utils/CancellationUtils.bs"
import "pkg:/source/utils/ErrorUtils.bs" import "pkg:/source/utils/ErrorUtils.bs"
import "pkg:/source/utils/Logging.bs" import "pkg:/source/utils/Logging.bs"
import "pkg:/source/utils/MessagePortUtils.bs" import "pkg:/source/utils/MessagePortUtils.bs"
@@ -22,6 +23,10 @@ function JobGetCallbackNode() as dynamic
return m._callback return m._callback
end function end function
function JobGetCancellation() as dynamic
return CancellationUtils.CreateCancellation(JobGetCallbackNode(), "cancel", true)
end function
function JobSuccess() as void function JobSuccess() as void
callbackNode = JobGetCallbackNode() callbackNode = JobGetCallbackNode()
if callbackNode = invalid if callbackNode = invalid
@@ -3,7 +3,10 @@ import "pkg:/source/utils/MessagePortUtils.bs"
import "pkg:/source/utils/StringUtils.bs" import "pkg:/source/utils/StringUtils.bs"
' Maximum number of JobTasks that can be created ' Maximum number of JobTasks that can be created
const MAX_JOB_TASK_COUNT = 25 ' https://developer.roku.com/en-ca/docs/developer-program/core-concepts/threads.md
' "Developers should take steps to ensure that their apps always remain well under the 50-thread "warning" limit."
' Accounting for other types of long running Tasks in the app, this limit should be way lower than 50.
const MAX_JOB_TASK_COUNT = 30
' Minimum number of JobTasks that will be kept alive ' Minimum number of JobTasks that will be kept alive
const MIN_JOB_TASK_COUNT = 2 const MIN_JOB_TASK_COUNT = 2
' Time in milliseconds to wait before scaling down JobTasks ' Time in milliseconds to wait before scaling down JobTasks
+34 -11
View File
@@ -25,7 +25,6 @@ function Init()
scene.enableSystemLogType = "http.complete" scene.enableSystemLogType = "http.complete"
scene.enableSystemLogType = "bandwidth.minute" scene.enableSystemLogType = "bandwidth.minute"
#end if #end if
m.sysLogEventDropCounter = 0
end if end if
end if end if
@@ -114,26 +113,45 @@ function OnLineSysLog(event as object, dateTime as object, logsFile as string, b
buffer.FromAsciiString(line + `\n`) buffer.FromAsciiString(line + `\n`)
buffer.AppendFile(logsFile) buffer.AppendFile(logsFile)
' Only report 1 in 10 system log errors fingerprint = `SysLog${info.Status}${info.LogType}${info.HttpCode}${info.Method}`
' They're usually repetitive, one is reported for each stream in a DASH
' when a video is blocked if m.sysLogEventTimer = invalid
if m.sysLogEventDropCounter = 0 m.sysLogEventTimer = CreateObject("roTimespan")
m.sysLogFingerprint = fingerprint
LogTelemetryEvent({ LogTelemetryEvent({
level: "error" level: "error"
message: line message: line
fingerprint: ["SysLog", info.Status, info.LogType, info.HttpCode, info.Method] fingerprint: [fingerprint]
}) })
return
end if end if
m.sysLogEventDropCounter = (m.sysLogEventDropCounter + 1) mod 10
' Only log one syslog error per minute (or if the fingerprint changes) to avoid spamming
if m.sysLogEventTimer.TotalSeconds() < 60 and m.sysLogFingerprint = fingerprint
return
end if
m.sysLogEventTimer.Mark()
m.sysLogFingerprint = fingerprint
LogTelemetryEvent({
level: "error"
message: line
fingerprint: [fingerprint]
})
end function end function
function OnLineLogMonitorMemoryWarning(event as object, dateTime as object, logsFile as string, buffer as object) as void function OnLineLogMonitorMemoryWarning(event as object, dateTime as object, logsFile as string, buffer as object) as void
info = event.getInfo() info = event.getInfo()
line = FormatTime(dateTime) + "[WARN][AppMonitorMemory] " + ToString(info) message = "[WARN][AppMonitorMemory] " + ToString(info)
line = FormatTime(dateTime) + message
print line print line
buffer.FromAsciiString(line + `\n`) buffer.FromAsciiString(line + `\n`)
buffer.AppendFile(logsFile) buffer.AppendFile(logsFile)
m.global.telemetry.LogWarn = line LogTelemetryEvent({
level: "warning"
message: line
fingerprint: [message]
})
end function end function
function OnLineLogDeviceInfoMemoryWarning(event as object, dateTime as object, logsFile as string, buffer as object) as void function OnLineLogDeviceInfoMemoryWarning(event as object, dateTime as object, logsFile as string, buffer as object) as void
@@ -148,11 +166,16 @@ function OnLineLogDeviceInfoMemoryWarning(event as object, dateTime as object, l
end if end if
m.lastDeviceInfoMemoryLevel = info.generalMemoryLevel m.lastDeviceInfoMemoryLevel = info.generalMemoryLevel
line = FormatTime(dateTime) + "[WARN][DeviceInfoMemory] " + ToString(info) message = "[WARN][DeviceInfoMemory] " + ToString(info)
line = FormatTime(dateTime) + message
print line print line
buffer.FromAsciiString(line + `\n`) buffer.FromAsciiString(line + `\n`)
buffer.AppendFile(logsFile) buffer.AppendFile(logsFile)
m.global.telemetry.LogWarn = line LogTelemetryEvent({
level: "warning"
message: line
fingerprint: [message]
})
end function end function
' Note: although the timestamp should be captured in the caller, not the logger, ' Note: although the timestamp should be captured in the caller, not the logger,
@@ -20,7 +20,7 @@ function ExecuteJob() as void
content = PrepareTests() content = PrepareTests()
listNode.content = content listNode.content = content
cancellation = CancellationUtils.CreateCancellation(JobGetCallbackNode(), "cancel", true) cancellation = JobGetCancellation()
RunTests(instance, content, cancellation) RunTests(instance, content, cancellation)
end function end function
@@ -15,7 +15,7 @@ function ExecuteJob() as void
return return
end if end if
cancellation = CancellationUtils.CreateCancellation(JobGetCallbackNode(), "cancel", true) cancellation = JobGetCancellation()
response = HttpClient.Get(Invidious.INSTANCES_API).Cancellation(cancellation).Await() response = HttpClient.Get(Invidious.INSTANCES_API).Cancellation(cancellation).Await()
if response.IsCancelled() if response.IsCancelled()
JobCancel() JobCancel()
@@ -3,7 +3,7 @@ import "pkg:/source/utils/CancellationUtils.bs"
@job("LatestLibVersionJob") @job("LatestLibVersionJob")
function ExecuteJob() as void function ExecuteJob() as void
cancellation = CancellationUtils.CreateCancellation(JobGetCallbackNode(), "cancel", true) cancellation = JobGetCancellation()
latest = GetLatestPlayletLibVersionFromGithubReleases(cancellation) latest = GetLatestPlayletLibVersionFromGithubReleases(cancellation)
JobSuccessData({ JobSuccessData({
latest: latest latest: latest
@@ -185,8 +185,8 @@ class DashManifest
if xml.Node("Representation", representationAttributes) if xml.Node("Representation", representationAttributes)
m.AddColorInfo(stream, xml) m.AddColorInfo(stream, xml)
if stream.url = invalid if StringUtils.IsNullOrEmpty(stream.url)
xml.Comment(`[ERROR] Stream.url is invalid for itag: ${stream.itag}`) xml.Comment(`[ERROR] Stream.url is null or empty for itag: ${stream.itag}`)
else if stream.url.InStr("source=yt_live_broadcast") <> -1 else if stream.url.InStr("source=yt_live_broadcast") <> -1
xml.Comment(`[WARN] Stream URL indicates a live broadcast for itag: ${stream.itag}`) xml.Comment(`[WARN] Stream URL indicates a live broadcast for itag: ${stream.itag}`)
end if end if
@@ -295,15 +295,15 @@ class DashManifest
for i = 0 to streams.Count() - 1 for i = 0 to streams.Count() - 1
stream = streams[i] stream = streams[i]
if stream.type.startsWith("audio/") if stream.type.startsWith("audio/")
if stream.bitrate = invalid if StringUtils.IsNullOrEmpty(stream.bitrate)
LogWarn("Invalid audio stream bitrate, itag:", stream.itag) LogWarn("Invalid audio stream bitrate, itag:", stream.itag)
continue for continue for
end if end if
if stream.init = invalid if StringUtils.IsNullOrEmpty(stream.init)
LogWarn("Invalid audio stream init, itag:", stream.itag) LogWarn("Invalid audio stream init, itag:", stream.itag)
continue for continue for
end if end if
if stream.index = invalid if StringUtils.IsNullOrEmpty(stream.index)
LogWarn("Invalid audio stream index, itag:", stream.itag) LogWarn("Invalid audio stream index, itag:", stream.itag)
continue for continue for
end if end if
@@ -325,15 +325,15 @@ class DashManifest
stream = streams[i] stream = streams[i]
if stream.type.startsWith("video/") if stream.type.startsWith("video/")
if stream.bitrate = invalid if StringUtils.IsNullOrEmpty(stream.bitrate)
LogWarn("Invalid video stream bitrate, itag:", stream.itag) LogWarn("Invalid video stream bitrate, itag:", stream.itag)
continue for continue for
end if end if
if stream.init = invalid if StringUtils.IsNullOrEmpty(stream.init)
LogWarn("Invalid video stream init, itag:", stream.itag) LogWarn("Invalid video stream init, itag:", stream.itag)
continue for continue for
end if end if
if stream.index = invalid if StringUtils.IsNullOrEmpty(stream.index)
LogWarn("Invalid video stream index, itag:", stream.itag) LogWarn("Invalid video stream index, itag:", stream.itag)
continue for continue for
end if end if
@@ -56,6 +56,7 @@ namespace Innertube
visitorData = OptionUtils.Get(options, "visitorData") visitorData = OptionUtils.Get(options, "visitorData")
onBehalfOfUser = OptionUtils.Get(options, "onBehalfOfUser") onBehalfOfUser = OptionUtils.Get(options, "onBehalfOfUser")
accessToken = OptionUtils.Get(options, "accessToken") accessToken = OptionUtils.Get(options, "accessToken")
videoId = OptionUtils.Get(options, "videoId")
useAccessToken = client = Innertube.ClientType.TV and not StringUtils.IsNullOrEmpty(accessToken) useAccessToken = client = Innertube.ClientType.TV and not StringUtils.IsNullOrEmpty(accessToken)
@@ -71,11 +72,16 @@ namespace Innertube
} }
} }
if not StringUtils.IsNullOrEmpty(credentialTransferToken) if IsAssociativeArray(credentialTransferToken) and not StringUtils.IsNullOrEmpty(videoId)
context["user"]["credentialTransferTokens"] = [{ cttCideoId = credentialTransferToken.videoId
"token": credentialTransferToken cttToken = credentialTransferToken.token
"scope": "VIDEO"
}] if not StringUtils.IsNullOrEmpty(cttToken) and videoId = cttCideoId
context["user"]["credentialTransferTokens"] = [{
"token": cttToken
"scope": "VIDEO"
}]
end if
end if end if
if not StringUtils.IsNullOrEmpty(visitorData) and not useAccessToken if not StringUtils.IsNullOrEmpty(visitorData) and not useAccessToken
@@ -169,6 +175,10 @@ namespace Innertube
' Separate Shorts from Subscriptions: TV_APP_QUALITY_FULL_ANIMATION ' Separate Shorts from Subscriptions: TV_APP_QUALITY_FULL_ANIMATION
"appQuality": "TV_APP_QUALITY_FULL_ANIMATION" "appQuality": "TV_APP_QUALITY_FULL_ANIMATION"
"useStartPlaybackPreviewCommand": false "useStartPlaybackPreviewCommand": false
"voiceCapability": {
"hasSoftMicSupport": false
"hasHardMicSupport": false
}
"supportsNativeScrolling": false "supportsNativeScrolling": false
} }
"browserName": INNERTUBE_TV_BROWSER_NAME "browserName": INNERTUBE_TV_BROWSER_NAME
@@ -178,6 +188,8 @@ namespace Innertube
"screenWidthPoints": 2560 "screenWidthPoints": 2560
"screenPixelDensity": 2 "screenPixelDensity": 2
"utcOffsetMinutes": -300 "utcOffsetMinutes": -300
"playerType": "UNIPLAYER"
"connectionType": "CONN_CELLULAR_4G"
} }
end function end function
@@ -17,23 +17,14 @@ import "pkg:/source/utils/TimeUtils.bs"
namespace InnertubeService namespace InnertubeService
function GetVideoMetadata(videoId as string, options = invalid as object) as object function GetVideoMetadata(videoId as string, options = invalid as object) as object
options["videoId"] = videoId
cancellation = OptionUtils.Get(options, "cancellation") cancellation = OptionUtils.Get(options, "cancellation")
fetchNext = OptionUtils.GetOrDefault(options, "fetchNext", true) fetchNext = OptionUtils.GetOrDefault(options, "fetchNext", true)
accessToken = OptionUtils.Get(options, "accessToken") accessToken = OptionUtils.Get(options, "accessToken")
raw = OptionUtils.GetOrDefault(options, "raw", false) raw = OptionUtils.GetOrDefault(options, "raw", false)
playerRequest = Innertube.CreatePlayerRequest(videoId, Innertube.ClientType.Tv, options)
if not StringUtils.IsNullOrEmpty(accessToken)
playerRequest.Header("Authorization", "Bearer " + accessToken)
end if
playerRequest.Cancellation(cancellation)
if raw
playerRequest.LogCurlCommand(true)
end if
playerRequest.Send()
nextRequest = invalid nextRequest = invalid
nextResponse = invalid
if fetchNext if fetchNext
nextRequest = Innertube.CreateNextRequest({ "videoId": videoId }, options) nextRequest = Innertube.CreateNextRequest({ "videoId": videoId }, options)
nextRequest.Cancellation(cancellation) nextRequest.Cancellation(cancellation)
@@ -43,119 +34,146 @@ namespace InnertubeService
nextRequest.Send() nextRequest.Send()
end if end if
playerResponse = playerRequest.Await()
if not playerResponse.IsSuccess()
return {
error: playerResponse.ErrorMessage()
}
end if
if CancellationUtils.IsCancelled(cancellation)
return {
error: "Cancelled"
}
end if
' For LIVE videos, we will need to fallback to iOS for HLS streams for now. ' For LIVE videos, we will need to fallback to iOS for HLS streams for now.
' Also, since we might have tracking urls in the player response (if logged in), ' Also, since we might have tracking urls in the player response (if logged in),
' we can keep them to avoid an extra request later. ' we can keep them to avoid an extra request later.
' TODO:P0 figure out how to get DASH to work for live videos. ' TODO:P0 figure out how to get DASH to work for live videos.
'
' # Start of iOS fallback
playbackTrackingUrls = invalid playbackTrackingUrls = invalid
responseJson = playerResponse.Json() playerResponseJson = invalid
if ValidBool(ObjectUtils.Dig(responseJson, ["videoDetails", "isLive"])) or ValidBool(ObjectUtils.Dig(responseJson, ["videoDetails", "hasLiveStreamingData"])) client = Innertube.ClientType.Tv
LogDebug("Live video detected, falling back to iOS for HLS streams.") totalPlayerRequests = 0
isLoggedIn = Innertube.ParseIsLoggedIn(responseJson) while true
playbackTrackingUrls = Innertube.ParsePlaybackTrackingUrls(responseJson, isLoggedIn) ' We shouldn't be making more that 3 requests:
' 1. Make request with TV client, but turns out to be live -> fallback to iOS
playerRequest = Innertube.CreatePlayerRequest(videoId, Innertube.ClientType.IOS, options) ' 2. Make request, but STS_MISMATCH error -> retry with new STS
' 3. Make request, it either succeeds or fails.
if totalPlayerRequests > 3
LogError("Too many player requests, aborting.")
return {
error: "Too many player requests"
}
end if
totalPlayerRequests += 1
playerRequest = Innertube.CreatePlayerRequest(client, options)
if not StringUtils.IsNullOrEmpty(accessToken) and client = Innertube.ClientType.Tv
playerRequest.Header("Authorization", "Bearer " + accessToken)
end if
playerRequest.Cancellation(cancellation) playerRequest.Cancellation(cancellation)
if raw if raw
playerRequest.LogCurlCommand(true) playerRequest.LogCurlCommand(true)
end if end if
playerResponse = playerRequest.Await() playerResponse = playerRequest.Await()
if not playerResponse.IsSuccess()
return {
error: playerResponse.ErrorMessage()
}
end if
if CancellationUtils.IsCancelled(cancellation) if CancellationUtils.IsCancelled(cancellation)
return { return {
error: "Cancelled" error: "Cancelled"
} }
end if end if
end if
' # End of iOS fallback
if fetchNext if not playerResponse.IsSuccess()
nextResponse = nextRequest.Await() parsedResponse = {
end if error: playerResponse.ErrorMessage()
}
parsedResponse = AwaitAndParseNextResponse(fetchNext, raw, parsedResponse, nextRequest)
return parsedResponse
end if
playerResponseJson = playerResponse.Json()
isLive = Innertube.IsLiveStream(playerResponseJson)
if isLive and client = Innertube.ClientType.Tv
LogDebug("Live video detected, falling back to iOS for HLS streams.")
isLoggedIn = Innertube.ParseIsLoggedIn(playerResponseJson)
playbackTrackingUrls = Innertube.ParsePlaybackTrackingUrls(playerResponseJson, isLoggedIn)
client = Innertube.ClientType.IOS
continue while
end if
parsedResponse = Innertube.ParseInnertubePlayerResponse(playerResponseJson, {}, playerRequest, cancellation)
if parsedResponse.error = invalid
exit while
end if
if parsedResponse.errorCode <> invalid
if parsedResponse.errorCode = "STS_MISMATCH"
LogInfo("STS_MISMATCH error, retrying...")
continue while
else if parsedResponse.errorCode = "MISSING_FORMAT_FIELD"
LogTelemetryEvent({
level: "error"
message: parsedResponse.errorCode
fingerprint: parsedResponse.errorCode
attachments: [{
filename: "request.txt"
content_type: "text/plain"
data: playerRequest.ToCurlCommand()
}, {
filename: "response.json"
content_type: "application/json"
data: playerResponse.Text()
}]
})
end if
end if
parsedResponse = AwaitAndParseNextResponse(fetchNext, raw, parsedResponse, nextRequest)
return parsedResponse
end while
if raw if raw
rawResponse = { rawResponse = {
"playerResponse": playerResponse.Json() "playerResponse": playerResponseJson
} }
if fetchNext rawResponse = AwaitAndParseNextResponse(fetchNext, raw, rawResponse, nextRequest)
rawResponse["nextResponse"] = nextResponse.Json()
end if
return rawResponse return rawResponse
end if end if
parsedResponse = invalid parsedResponse = AwaitAndParseNextResponse(fetchNext, raw, parsedResponse, nextRequest)
try
parsedResponse = Innertube.ParseInnertubePlayerResponse(playerResponse.Json(), playerRequest.signatureTimestamp, cancellation)
catch exception
code = ValidString(exception.code)
if code = "STS_MISMATCH"
return GetVideoMetadata(videoId, options)
end if
if code = "MISSING_FORMAT_FIELD"
LogTelemetryEvent({
level: "error"
message: code
fingerprint: code
attachments: [{
filename: "request.txt"
content_type: "text/plain"
data: playerRequest.ToCurlCommand()
}, {
filename: "response.json"
content_type: "application/json"
data: playerResponse.Text()
}]
})
end if
throw exception
end try
if parsedResponse.error <> invalid
return parsedResponse
end if
if fetchNext if StringUtils.IsNullOrEmpty(parsedResponse.videoId)
if nextResponse.IsSuccess()
parsedResponse = Innertube.ParseInnertubeNextResponse(nextResponse.Json(), parsedResponse, nextResponse)
else
LogWarn(nextResponse.ErrorMessage())
end if
end if
' If for some reason we missed the videoId, add it back
if parsedResponse.error = invalid and StringUtils.IsNullOrEmpty(parsedResponse.videoId)
parsedResponse["videoId"] = videoId parsedResponse["videoId"] = videoId
end if end if
' # Start of iOS fallback ' If we did capture tracking urls when we did the TV request, but now we're
' missing them because we switched to iOS, add them back.
if playbackTrackingUrls <> invalid and parsedResponse.playbackTrackingUrls = invalid if playbackTrackingUrls <> invalid and parsedResponse.playbackTrackingUrls = invalid
LogDebug("Adding playback tracking URLs from TV player response.") LogDebug("Adding playback tracking URLs from TV player response.")
parsedResponse["playbackTrackingUrls"] = playbackTrackingUrls parsedResponse["playbackTrackingUrls"] = playbackTrackingUrls
end if end if
' # End of iOS fallback
return parsedResponse return parsedResponse
end function end function
function AwaitAndParseNextResponse(fetchNext as boolean, raw as boolean, parsedResponse as object, nextRequest as object) as object
if not fetchNext
return parsedResponse
end if
nextResponse = nextRequest.Await()
if not nextResponse.IsSuccess()
if nextResponse.IsCancelled()
return parsedResponse
end if
error = nextResponse.ErrorMessage()
LogWarn(error)
if raw
parsedResponse["nextError"] = error
end if
return parsedResponse
end if
if raw
parsedResponse["nextResponse"] = nextResponse.Json()
end if
return Innertube.ParseInnertubeNextResponse(nextResponse.Json(), parsedResponse, nextResponse)
end function
function GetVideoInfoBatched(videoIds as object, options = invalid as object) as object function GetVideoInfoBatched(videoIds as object, options = invalid as object) as object
if not IsArray(videoIds) or videoIds.Count() = 0 if not IsArray(videoIds) or videoIds.Count() = 0
return { return {
@@ -362,7 +380,8 @@ namespace InnertubeService
cancellation = options.cancellation cancellation = options.cancellation
end if end if
playerRequest = Innertube.CreatePlayerRequest(videoId, Innertube.ClientType.Tv, options) options["videoId"] = videoId
playerRequest = Innertube.CreatePlayerRequest(Innertube.ClientType.Tv, options)
playerRequest.Cancellation(cancellation) playerRequest.Cancellation(cancellation)
playerRequest.Header("Authorization", "Bearer " + accessToken) playerRequest.Header("Authorization", "Bearer " + accessToken)
@@ -375,7 +394,7 @@ namespace InnertubeService
json = playerResponse.Json() json = playerResponse.Json()
error = Innertube.ParsePlayerResponseForError(json) error = Innertube.ParsePlayerResponseForError(json, playerRequest)
if error <> "" if error <> ""
return { return {
error: error error: error
@@ -6,10 +6,10 @@ function ExecuteJob() as void
innertubeNode = input.innertube innertubeNode = input.innertube
cancellation = CancellationUtils.CreateCancellation(JobGetCallbackNode(), "cancel", true) cancellation = JobGetCancellation()
sessionData = Innertube.GetSessionData(cancellation) sessionData = Innertube.GetSessionData(cancellation)
if sessionData = invalid if sessionData.error <> invalid
JobError("Failed to fetch session data") JobError(sessionData.error)
return return
end if end if
@@ -34,12 +34,7 @@ namespace Innertube
}) })
end function end function
function ParseInnertubeNextResponse(payload as object, parsedResponse as object, response as object) as object function ParseInnertubeNextResponse(payload as object, parsedResponse as object, httpResponse as object) as object
if parsedResponse.error <> invalid
LogWarn("Invalid parsed response", parsedResponse)
return parsedResponse
end if
if not IsAssociativeArray(payload) if not IsAssociativeArray(payload)
LogWarn("Invalid payload", payload) LogWarn("Invalid payload", payload)
return parsedResponse return parsedResponse
@@ -51,6 +46,23 @@ namespace Innertube
return parsedResponse return parsedResponse
end if end if
endscreen = playerOverlayRenderer["endScreen"]
feeds = Innertube.ParseResponseDataForFeeds(endscreen, {
response: httpResponse
noContainers: true
})
if feeds.Count() > 0
parsedResponse["recommendedVideos"] = ValidArray(feeds[0].items)
end if
' Sometimes the title and author are missing in /player respnonse, so we get them here.
' But if we have an error, we don't need them, recommendedVideos is enough to play the
' next video, after showing the error dialog.
if parsedResponse.error <> invalid
return parsedResponse
end if
if StringUtils.IsNullOrEmpty(parsedResponse.title) if StringUtils.IsNullOrEmpty(parsedResponse.title)
title = ParseText(ObjectUtils.Dig(playerOverlayRenderer, ["videoDetails", "playerOverlayVideoDetailsRenderer", "title"])) title = ParseText(ObjectUtils.Dig(playerOverlayRenderer, ["videoDetails", "playerOverlayVideoDetailsRenderer", "title"]))
if not StringUtils.IsNullOrEmpty(title) if not StringUtils.IsNullOrEmpty(title)
@@ -65,21 +77,6 @@ namespace Innertube
end if end if
end if end if
if not IsArray(parsedResponse.recommendedVideos)
LogWarn("Invalid recommended videos", parsedResponse.recommendedVideos)
return parsedResponse
end if
endscreen = playerOverlayRenderer["endScreen"]
feeds = Innertube.ParseResponseDataForFeeds(endscreen, {
response: response
noContainers: true
})
if feeds.Count() > 0
parsedResponse.recommendedVideos.Append(ValidArray(feeds[0].items))
end if
return parsedResponse return parsedResponse
end function end function
@@ -93,9 +93,14 @@ namespace Innertube
' Ignored nodes: ' Ignored nodes:
' TODO:P2 radioRenderer seems like a Mix https://github.com/iBicha/playlet/issues/709 ' TODO:P2 radioRenderer seems like a Mix https://github.com/iBicha/playlet/issues/709
"radioRenderer": ParseNotImplemented "radioRenderer": ParseNotImplemented
"compactRadioRenderer": ParseNotImplemented
' TODO:P2 A carousel of videos, found on the home tab of a channel. ' TODO:P2 A carousel of videos, found on the home tab of a channel.
' Should probably be parsed. ' Should probably be parsed.
"carouselItemRenderer": ParseNotImplemented "carouselItemRenderer": ParseNotImplemented
' When searching for hashtags, this renderer is used.
' It redirects to a page similar to a channel page, with browseId "FEhashtag"
' the hashtag name is encoded in a proto and passed as a param to the browseEndpoint.
"hashtagTileRenderer": ParseNotImplemented
' Movies are not supported. ' Movies are not supported.
"movieRenderer": ParseNotImplemented "movieRenderer": ParseNotImplemented
"compactMovieRenderer": ParseNotImplemented "compactMovieRenderer": ParseNotImplemented
@@ -140,6 +145,7 @@ namespace Innertube
"backgroundPromoRenderer": ParseNotImplemented "backgroundPromoRenderer": ParseNotImplemented
' Autocorrect for search terms ' Autocorrect for search terms
"showingResultsForRenderer": ParseNotImplemented "showingResultsForRenderer": ParseNotImplemented
"includingResultsForRenderer": ParseNotImplemented
' "This channel has no podcasts." ' "This channel has no podcasts."
"channelOwnerEmptyStateRenderer": ParseNotImplemented "channelOwnerEmptyStateRenderer": ParseNotImplemented
' Live chat replay ("See what others said about this video while it was live.") ' Live chat replay ("See what others said about this video while it was live.")
@@ -1287,6 +1293,9 @@ namespace Innertube
return TileRendererTypeShorts(nodeData, context) return TileRendererTypeShorts(nodeData, context)
else if contentType = "TILE_CONTENT_TYPE_PLAYLIST" else if contentType = "TILE_CONTENT_TYPE_PLAYLIST"
return TileRendererTypePlaylist(nodeData, context) return TileRendererTypePlaylist(nodeData, context)
else if contentType = "TILE_CONTENT_TYPE_CHANNEL"
' Not implemented yet - https://github.com/iBicha/playlet/issues/724
return invalid
end if end if
Warning(`Unknown content type: ${contentType}`, nodeData, context) Warning(`Unknown content type: ${contentType}`, nodeData, context)
@@ -32,9 +32,14 @@ namespace Innertube
Innertube.ParseNode(containers, context) Innertube.ParseNode(containers, context)
if context.currentFeed <> invalid and (context.currentFeed.items.Count() > 0 or context.currentFeed.title <> "") if context.currentFeed <> invalid
context.feeds.Push(context.currentFeed) hasTitle = context.currentFeed.title <> ""
context.currentFeed = invalid hasItems = context.currentFeed.items.Count() > 0
hasContinuation = context.currentFeed.DoesExist("continuation")
if hasTitle or hasItems or hasContinuation
context.feeds.Push(context.currentFeed)
context.currentFeed = invalid
end if
end if end if
return context.feeds return context.feeds
end function end function
@@ -7,7 +7,8 @@ import "pkg:/source/utils/UrlUtils.bs"
namespace Innertube namespace Innertube
function CreatePlayerRequest(videoId as string, client as Innertube.ClientType, options = invalid as object) as object function CreatePlayerRequest(client as Innertube.ClientType, options = invalid as object) as object
videoId = OptionUtils.Get(options, "videoId")
cancellation = OptionUtils.Get(options, "cancellation") cancellation = OptionUtils.Get(options, "cancellation")
visitorData = OptionUtils.Get(options, "visitorData") visitorData = OptionUtils.Get(options, "visitorData")
accessToken = OptionUtils.Get(options, "accessToken") accessToken = OptionUtils.Get(options, "accessToken")
@@ -62,63 +63,83 @@ namespace Innertube
return request return request
end function end function
function ParseInnertubePlayerResponse(payload as object, signatureTimestamp as dynamic, cancellation as object) as object function ParseInnertubePlayerResponse(payload as object, parsedResponse as object, playerRequest as dynamic, cancellation as object) as object
error = ParsePlayerResponseForError(payload) error = ParsePlayerResponseForError(payload, playerRequest)
if error <> "" if error <> ""
return { parsedResponse["error"] = error
error: error return parsedResponse
}
end if end if
videoDetails = payload["videoDetails"] videoDetails = payload["videoDetails"]
if not IsAssociativeArray(videoDetails) if not IsAssociativeArray(videoDetails)
return { parsedResponse["error"] = "Invalid videoDetails"
error: "Invalid video details" return parsedResponse
}
end if end if
streamingData = payload["streamingData"] streamingData = payload["streamingData"]
if not IsAssociativeArray(streamingData) if not IsAssociativeArray(streamingData)
return { parsedResponse["error"] = "Invalid streamingData"
error: "Invalid streaming data" return parsedResponse
}
end if end if
lengthSeconds = videoDetails["lengthSeconds"].ToInt() lengthSeconds = videoDetails["lengthSeconds"].ToInt()
isLive = ValidBool(videoDetails["isLive"]) isLive = ValidBool(videoDetails["isLive"])
adaptiveFormats = ParseAdaptiveFormats(payload, signatureTimestamp, isLive, cancellation)
hasLiveStreamingData = FormatsHaveLiveStreamingData(adaptiveFormats)
videoInfo = { adaptiveFormats = ValidArray(ObjectUtils.Dig(payload, ["streamingData", "adaptiveFormats"]))
"type": "video" formats = ValidArray(ObjectUtils.Dig(payload, ["streamingData", "formats"]))
"title": videoDetails["title"]
"videoId": videoDetails["videoId"]
"videoThumbnails": videoDetails["thumbnail"]["thumbnails"]
"storyboards": ParseStoryboards(payload, lengthSeconds)
"author": videoDetails["author"]
"authorId": videoDetails["channelId"]
"lengthSeconds": lengthSeconds
"liveNow": isLive
"hasLiveStreamingData": hasLiveStreamingData
"hlsUrl": streamingData["hlsManifestUrl"]
"dashUrl": streamingData["dashManifestUrl"]
"adaptiveFormats": adaptiveFormats
"formatStreams": []
"captions": ParseCaptions(payload)
"recommendedVideos": []
}
if videoDetails.DoesExist("viewCount") if not isLive
videoInfo["viewCount"] = videoDetails["viewCount"].ToInt() error = DecipherUrls(formats, adaptiveFormats, playerRequest.signatureTimestamp, cancellation)
if error <> invalid
parsedResponse["error"] = error.error
if error.DoesExist("errorCode")
parsedResponse["errorCode"] = error.errorCode
end if
return parsedResponse
end if
end if end if
videoInfo["isLoggedIn"] = ParseIsLoggedIn(payload) hasLiveStreamingData = FormatsHaveLiveStreamingData(adaptiveFormats) or FormatsHaveLiveStreamingData(formats)
videoInfo["playbackTrackingUrls"] = ParsePlaybackTrackingUrls(payload, videoInfo.isLoggedIn) hasDrm = (not StringUtils.IsNullOrEmpty(streamingData.drmParams)) or IsArray(streamingData.licenseInfos)
return videoInfo shouldAnalyze = (not isLive) and (not hasLiveStreamingData) and (not hasDrm)
adaptiveFormats = TransformFormats(adaptiveFormats, shouldAnalyze)
formats = TransformFormats(formats, false)
parsedResponse["type"] = "video"
parsedResponse["videoId"] = videoDetails["videoId"]
parsedResponse["videoThumbnails"] = videoDetails["thumbnail"]["thumbnails"]
parsedResponse["storyboards"] = ParseStoryboards(payload, lengthSeconds)
parsedResponse["author"] = videoDetails["author"]
parsedResponse["authorId"] = videoDetails["channelId"]
parsedResponse["lengthSeconds"] = lengthSeconds
parsedResponse["liveNow"] = isLive
parsedResponse["hasLiveStreamingData"] = hasLiveStreamingData
parsedResponse["hlsUrl"] = streamingData["hlsManifestUrl"]
parsedResponse["dashUrl"] = streamingData["dashManifestUrl"]
parsedResponse["adaptiveFormats"] = adaptiveFormats
parsedResponse["formatStreams"] = formats
parsedResponse["captions"] = ParseCaptions(payload)
if not StringUtils.IsNullOrEmpty(videoDetails["title"])
parsedResponse["title"] = videoDetails["title"]
end if
if not StringUtils.IsNullOrEmpty(videoDetails["author"])
parsedResponse["author"] = videoDetails["author"]
end if
if videoDetails.DoesExist("viewCount")
parsedResponse["viewCount"] = videoDetails["viewCount"].ToInt()
end if
parsedResponse["isLoggedIn"] = ParseIsLoggedIn(payload)
parsedResponse["playbackTrackingUrls"] = ParsePlaybackTrackingUrls(payload, parsedResponse.isLoggedIn)
return parsedResponse
end function end function
function ParsePlayerResponseForError(payload as object) as string function ParsePlayerResponseForError(payload as object, playerRequest as object) as string
if not IsAssociativeArray(payload) if not IsAssociativeArray(payload)
return "Invalid payload" return "Invalid payload"
end if end if
@@ -155,9 +176,15 @@ namespace Innertube
' TODO:P2 localize ' TODO:P2 localize
errorLines.Push("Hint: Log in to the YouTube app on your phone, then cast the video to Playlet.") errorLines.Push("Hint: Log in to the YouTube app on your phone, then cast the video to Playlet.")
isLoggedIn = Innertube.ParseIsLoggedIn(payload) hasAccessToken = ValidString(playerRequest.GetHeaders()["Authorization"]).Len() > "Bearer ".Len()
if isLoggedIn hasCtt = ValidString(playerRequest.GetBody()).InStr("credentialTransferTokens") <> -1
LogError("Video requires login, but user is already logged in!")
if hasAccessToken or hasCtt
LogTelemetryEvent({
level: "error"
message: `LOGIN_REQUIRED: hasAccessToken=${hasAccessToken} hasCtt=${hasCtt}\nPlayabilityStatus: ${FormatJson(playabilityStatus)}`
fingerprint: ["LOGIN_REQUIRED hasAccessToken hasCtt"]
})
end if end if
end if end if
@@ -296,25 +323,32 @@ namespace Innertube
return captions return captions
end function end function
function ParseAdaptiveFormats(payload as object, signatureTimestamp as dynamic, isLive as boolean, cancellation as object) as object function TransformFormats(formats as object, analyze as boolean) as object
adaptiveFormats = ObjectUtils.Dig(payload, ["streamingData", "adaptiveFormats"]) analysis = invalid
if not IsArray(adaptiveFormats) if analyze
return [] analysis = {
"issueDetected": false
}
end if end if
if not isLive result = []
adaptiveFormats = DecipherUrls(adaptiveFormats, signatureTimestamp, cancellation) for i = 0 to formats.Count() - 1
end if result.Push(TransformFormat(formats[i], analysis))
formats = []
for each fmt in adaptiveFormats
formats.Push(GetAdaptiveFormat(fmt))
end for end for
return formats if analyze and analysis.issueDetected
' Are these OTF streams?
LogTelemetryEvent({
level: "error"
message: `Some formats are missing initRange or indexRange\nFormats: ${FormatJson(formats)}`
fingerprint: ["Some formats are missing initRange or indexRange"]
})
end if
return result
end function end function
function GetAdaptiveFormat(fmt as object) as object function TransformFormat(fmt as object, analysis as object) as object
itag = `${fmt["itag"]}` itag = `${fmt["itag"]}`
result = { result = {
"bitrate": `${fmt["bitrate"]}` "bitrate": `${fmt["bitrate"]}`
@@ -329,11 +363,17 @@ namespace Innertube
result["init"] = `${fmt["initRange"]["start"]}-${fmt["initRange"]["end"]}` result["init"] = `${fmt["initRange"]["start"]}-${fmt["initRange"]["end"]}`
else else
result["init"] = "" result["init"] = ""
if analysis <> invalid
analysis.issueDetected = true
end if
end if end if
if IsAssociativeArray(fmt["indexRange"]) if IsAssociativeArray(fmt["indexRange"])
result["index"] = `${fmt["indexRange"]["start"]}-${fmt["indexRange"]["end"]}` result["index"] = `${fmt["indexRange"]["start"]}-${fmt["indexRange"]["end"]}`
else else
result["index"] = "" result["index"] = ""
if analysis <> invalid
analysis.issueDetected = true
end if
end if end if
if fmt["audioQuality"] <> invalid if fmt["audioQuality"] <> invalid
@@ -396,24 +436,34 @@ namespace Innertube
return json["sts"] return json["sts"]
end function end function
function DecipherUrls(adaptiveFormats as object, signatureTimestamp as dynamic, cancellation as object) as object function DecipherUrls(formats as object, adaptiveFormats as object, signatureTimestamp as dynamic, cancellation as object) as object
if signatureTimestamp = invalid if signatureTimestamp = invalid
' No need to decipher if signatureTimestamp is not available ' No need to decipher if signatureTimestamp is not available
return adaptiveFormats return invalid
end if end if
formats = [] reqFormats = []
for each fmt in adaptiveFormats for each fmt in formats
formats.push({ reqFormats.push({
"url": fmt["url"] "url": fmt["url"]
"cipher": fmt["cipher"] "cipher": fmt["cipher"]
"signatureCipher": fmt["signatureCipher"] "signatureCipher": fmt["signatureCipher"]
}) })
end for end for
request = HttpClient.PostJson(`${PLAYLET_SUPPORT_SERVER}/v1/decipher`, { reqAdaptiveFormats = []
for each fmt in adaptiveFormats
reqAdaptiveFormats.push({
"url": fmt["url"]
"cipher": fmt["cipher"]
"signatureCipher": fmt["signatureCipher"]
})
end for
request = HttpClient.PostJson(`${PLAYLET_SUPPORT_SERVER}/v2/decipher`, {
"sts": signatureTimestamp "sts": signatureTimestamp
"formats": formats "formats": reqFormats
"adaptiveFormats": reqAdaptiveFormats
}) })
request.Cancellation(cancellation) request.Cancellation(cancellation)
@@ -421,51 +471,71 @@ namespace Innertube
response = request.Await() response = request.Await()
if not response.IsSuccess() if not response.IsSuccess()
if response.IsCancelled() errorCode = ""
LogErrorNoTelemetry(response.ErrorMessage())
else
LogError(response.ErrorMessage())
end if
code = ""
if response.StatusCode() = 400 if response.StatusCode() = 400
json = response.Json() json = response.Json()
if IsAssociativeArray(json) if IsAssociativeArray(json)
code = ValidString(json["code"]) errorCode = ValidString(json["code"])
if code = "STS_MISMATCH" if errorCode = "STS_MISMATCH"
DeleteFile("tmp:/sts_cache.json") DeleteFile("tmp:/sts_cache.json")
end if end if
end if end if
end if end if
exception = { message: response.ErrorMessage() } exception = {
if code <> "" error: response.ErrorMessage()
exception.code = code }
if errorCode <> ""
exception.errorCode = errorCode
end if end if
throw exception
if response.IsCancelled() or errorCode = "STS_MISMATCH"
LogErrorNoTelemetry(response.ErrorMessage())
else
LogError(response.ErrorMessage())
end if
return exception
end if end if
json = response.Json() json = response.Json()
if not IsAssociativeArray(json) or not json.DoesExist("formats") if not IsAssociativeArray(json) or not json.DoesExist("formats") or not json.DoesExist("adaptiveFormats")
error = "Invalid response from decipher service" error = "Invalid response from decipher service"
LogError(error) LogError(error)
throw error return {
error: error
}
end if end if
decipheredFormats = json["formats"] decipheredFormats = json["formats"]
if not IsArray(decipheredFormats) or decipheredFormats.Count() <> adaptiveFormats.Count() if not IsArray(decipheredFormats) or decipheredFormats.Count() <> formats.Count()
error = "Invalid formats in deciphered response" error = "Invalid formats in deciphered response"
LogError(error) LogError(error)
throw error return {
error: error
}
end if end if
for i = 0 to decipheredFormats.Count() - 1 for i = 0 to decipheredFormats.Count() - 1
fmt = adaptiveFormats[i] fmt = formats[i]
decipheredFmt = decipheredFormats[i] decipheredFmt = decipheredFormats[i]
fmt["url"] = decipheredFmt["url"] fmt["url"] = decipheredFmt["url"]
end for end for
return adaptiveFormats decipheredAdaptiveFormats = json["adaptiveFormats"]
if not IsArray(decipheredAdaptiveFormats) or decipheredAdaptiveFormats.Count() <> adaptiveFormats.Count()
error = "Invalid adaptiveFormats in deciphered response"
LogError(error)
return {
error: error
}
end if
for i = 0 to decipheredAdaptiveFormats.Count() - 1
fmt = adaptiveFormats[i]
decipheredFmt = decipheredAdaptiveFormats[i]
fmt["url"] = decipheredFmt["url"]
end for
return invalid
end function end function
function ParseIsLoggedIn(payload as object) as boolean function ParseIsLoggedIn(payload as object) as boolean
@@ -512,14 +582,30 @@ namespace Innertube
} }
end function end function
function FormatsHaveLiveStreamingData(adaptiveFormats as object) as boolean function IsLiveStream(payload as object) as boolean
if not IsArray(adaptiveFormats) if ValidBool(ObjectUtils.Dig(payload, ["videoDetails", "isLive"]))
return false return true
end if end if
for each fmt in adaptiveFormats adaptiveFormats = ValidArray(ObjectUtils.Dig(payload, ["streamingData", "adaptiveFormats"]))
if FormatsHaveLiveStreamingData(adaptiveFormats)
return true
end if
formats = ValidArray(ObjectUtils.Dig(payload, ["streamingData", "formats"]))
if FormatsHaveLiveStreamingData(formats)
return true
end if
return false
end function
function FormatsHaveLiveStreamingData(formats as object) as boolean
if not IsArray(formats)
return false
end if
for each fmt in formats
url = fmt["url"] url = fmt["url"]
if IsString(url) and url.InStr("yt_live_broadcast") <> -1 if IsString(url) and (url.InStr("yt_live_broadcast") <> -1 or url.InStr("yt_premiere_broadcast") <> -1)
return true return true
end if end if
end for end for
@@ -18,6 +18,9 @@ namespace Innertube
end if end if
sessionData = RequestSessionData(cancellation) sessionData = RequestSessionData(cancellation)
if sessionData.error <> invalid
return sessionData
end if
SaveSessionDataToRegistry(sessionData) SaveSessionDataToRegistry(sessionData)
return sessionData return sessionData
end function end function
@@ -31,11 +34,13 @@ namespace Innertube
"Referer": "https://www.youtube.com/sw.js" "Referer": "https://www.youtube.com/sw.js"
}) })
request.Cancellation(cancellation) request.Cancellation(cancellation)
request.TryCount(2)
response = request.Await() response = request.Await()
if not response.IsSuccess() if not response.IsSuccess()
LogError("Failed to fetch session data", response.ErrorMessage()) return {
return invalid "error": "Failed to fetch session data: " + response.ErrorMessage()
}
end if end if
text = response.Text() text = response.Text()
@@ -43,14 +48,16 @@ namespace Innertube
json = ParseJson(text) json = ParseJson(text)
if json = invalid if json = invalid
LogError("Failed to parse session data", text) return {
return invalid "error": "Failed to parse session data: " + text
}
end if end if
visitorData = ObjectUtils.Dig(json, [0, 2, 0, 0, 13]) visitorData = ObjectUtils.Dig(json, [0, 2, 0, 0, 13])
if StringUtils.IsNullOrEmpty(visitorData) if StringUtils.IsNullOrEmpty(visitorData)
LogError("Visitor data not found", text) return {
return invalid "error": "Failed to find visitorData in session data: " + text
}
end if end if
return { return {
@@ -60,10 +67,6 @@ namespace Innertube
end function end function
function SaveSessionDataToRegistry(sessionData as object) as void function SaveSessionDataToRegistry(sessionData as object) as void
if sessionData = invalid
return
end if
sessionData.__version = SESSION_DATA_VERSION sessionData.__version = SESSION_DATA_VERSION
RegistryUtils.Write(RegistryUtils.INNERTUBE_SESSION_DATA, FormatJson(sessionData)) RegistryUtils.Write(RegistryUtils.INNERTUBE_SESSION_DATA, FormatJson(sessionData))
@@ -128,9 +128,6 @@ namespace Invidious
end function end function
function GetVideoMetadata(videoId as string, options = invalid as object) as object function GetVideoMetadata(videoId as string, options = invalid as object) as object
' 10 minutes cache.
' https://github.com/iv-org/invidious/blob/069e91d2a609b1df94bdfbb693335969b2a281d8/src/invidious/videos.cr#L349
cacheSeconds = OptionUtils.GetOrDefault(options, "cacheSeconds", 600) ' 10 minutes
cancellation = OptionUtils.Get(options, "cancellation") cancellation = OptionUtils.Get(options, "cancellation")
tryCount = OptionUtils.GetOrDefault(options, "tryCount", 2) tryCount = OptionUtils.GetOrDefault(options, "tryCount", 2)
@@ -139,7 +136,6 @@ namespace Invidious
request = HttpClient.Get(url) request = HttpClient.Get(url)
request.CacheSeconds(cacheSeconds)
request.Cancellation(cancellation) request.Cancellation(cancellation)
if tryCount > 1 if tryCount > 1
@@ -198,7 +198,7 @@ class LongPoller
m.status_code = Val(statusCode) m.status_code = Val(statusCode)
m.status_text = status.Mid(spaceIndex + 1) m.status_text = status.Mid(spaceIndex + 1)
if m.status_code <> 200 if m.status_code <> 200
if m.status_code = 400 and m.status_text = "Unknown SID" if m.status_code = 410 or (m.status_code = 400 and m.status_text = "Unknown SID")
LogErrorNoTelemetry("Invalid status code:", m.status_code, m.status_text, `\nResponse data:`, m.socket_buffer) LogErrorNoTelemetry("Invalid status code:", m.status_code, m.status_text, `\nResponse data:`, m.socket_buffer)
else else
LogError("Invalid status code:", m.status_code, m.status_text, `\nResponse data:`, m.socket_buffer) LogError("Invalid status code:", m.status_code, m.status_text, `\nResponse data:`, m.socket_buffer)
@@ -59,6 +59,7 @@ class LoungeApi
commandHandlers[COMMAND_TYPE_GET_VOLUME] = m.HandleIgnoreCommand commandHandlers[COMMAND_TYPE_GET_VOLUME] = m.HandleIgnoreCommand
commandHandlers[COMMAND_TYPE_GET_SUBTITLES_TRACK] = m.HandleIgnoreCommand commandHandlers[COMMAND_TYPE_GET_SUBTITLES_TRACK] = m.HandleIgnoreCommand
commandHandlers[COMMAND_TYPE_SET_SUBTITLES] = m.HandleIgnoreCommand commandHandlers[COMMAND_TYPE_SET_SUBTITLES] = m.HandleIgnoreCommand
commandHandlers[COMMAND_TYPE_SET_AUDIO_TRACK] = m.HandleIgnoreCommand
commandHandlers[COMMAND_TYPE_DPAD_COMMAND] = m.HandleIgnoreCommand commandHandlers[COMMAND_TYPE_DPAD_COMMAND] = m.HandleIgnoreCommand
commandHandlers[COMMAND_TYPE_VOICE_COMMAND] = m.HandleIgnoreCommand commandHandlers[COMMAND_TYPE_VOICE_COMMAND] = m.HandleIgnoreCommand
commandHandlers[COMMAND_TYPE_ON_USER_ACTIVITY] = m.HandleIgnoreCommand commandHandlers[COMMAND_TYPE_ON_USER_ACTIVITY] = m.HandleIgnoreCommand
@@ -436,8 +437,11 @@ class LoungeApi
' Right now we just store only the last ctt, which works ok if we're casting one video at a time. ' Right now we just store only the last ctt, which works ok if we're casting one video at a time.
' But if the age restrcited video is added to the queue, we don't capture a token and playing the video would fail. ' But if the age restrcited video is added to the queue, we don't capture a token and playing the video would fail.
' These tokens need to be managed better, based on the video they belong to. ' These tokens need to be managed better, based on the video they belong to.
if not StringUtils.IsNullOrEmpty(commandArgs[FIELD_CTT]) if not StringUtils.IsNullOrEmpty(commandArgs[FIELD_CTT]) and not StringUtils.IsNullOrEmpty(commandArgs[FIELD_VIDEO_ID])
m.loungeServiceNode.credentialTransferToken = commandArgs[FIELD_CTT] m.loungeServiceNode.credentialTransferToken = {
"token": commandArgs[FIELD_CTT]
"videoId": commandArgs[FIELD_VIDEO_ID]
}
end if end if
LoungeVideoQueue.SetPlaylist(m.videoQueueNode, m.invService, commandArgs) LoungeVideoQueue.SetPlaylist(m.videoQueueNode, m.invService, commandArgs)
end function end function
@@ -560,7 +564,7 @@ class LoungeApi
}) })
if not response.IsSuccess() if not response.IsSuccess()
if response.StatusCode() = 400 and response.ErrorMessage().InStr("Unknown SID") <> -1 if response.StatusCode() = 410 or (response.StatusCode() = 400 and response.ErrorMessage().InStr("Unknown SID") <> -1)
LogErrorNoTelemetry(response.ErrorMessage()) LogErrorNoTelemetry(response.ErrorMessage())
else else
LogError(response.ErrorMessage()) LogError(response.ErrorMessage())
@@ -24,6 +24,7 @@ const COMMAND_TYPE_STOP_VIDEO = "stopVideo"
const COMMAND_TYPE_DPAD_COMMAND = "dpadCommand" const COMMAND_TYPE_DPAD_COMMAND = "dpadCommand"
const COMMAND_TYPE_VOICE_COMMAND = "voiceCommand" const COMMAND_TYPE_VOICE_COMMAND = "voiceCommand"
const COMMAND_TYPE_SET_SUBTITLES = "setSubtitlesTrack" const COMMAND_TYPE_SET_SUBTITLES = "setSubtitlesTrack"
const COMMAND_TYPE_SET_AUDIO_TRACK = "setAudioTrack"
const COMMAND_TYPE_ON_USER_ACTIVITY = "onUserActivity" const COMMAND_TYPE_ON_USER_ACTIVITY = "onUserActivity"
const COMMAND_TYPE_GET_DISCOVERT_DEVICE_ID = "getDiscoveryDeviceId" const COMMAND_TYPE_GET_DISCOVERT_DEVICE_ID = "getDiscoveryDeviceId"
const COMMAND_TYPE_GRACEFUL_RECONNECT = "gracefulReconnect" const COMMAND_TYPE_GRACEFUL_RECONNECT = "gracefulReconnect"
@@ -41,7 +41,7 @@ function ExecuteJob() as void
form["access_type"] = "permanent" form["access_type"] = "permanent"
form["app"] = "Playlet" form["app"] = "Playlet"
cancellation = CancellationUtils.CreateCancellation(JobGetCallbackNode(), "cancel", true) cancellation = JobGetCancellation()
request = HttpClient.Post("https://www.youtube.com/api/lounge/pairing/get_pairing_code?ctx=pair", "") request = HttpClient.Post("https://www.youtube.com/api/lounge/pairing/get_pairing_code?ctx=pair", "")
request.UrlEncodedForm(form) request.UrlEncodedForm(form)
request.Cancellation(cancellation) request.Cancellation(cancellation)
@@ -123,14 +123,14 @@ function LoungeServiceLoop() as void
unknownSid = false unknownSid = false
' TODO:P2 move this check somewhere else ' TODO:P2 move this check somewhere else
if api.poller.status_code = 400 and ValidString(api.poller.status_text) = "Unknown SID" if (api.poller.status_code = 410) or (api.poller.status_code = 400 and ValidString(api.poller.status_text) = "Unknown SID")
api.poller.status_code = 0 api.poller.status_code = 0
unknownSid = true unknownSid = true
end if end if
if not unknownSid if not unknownSid
for each result in outgoingLoungeMessagesResults for each result in outgoingLoungeMessagesResults
if result.status = 400 and result.error.InStr("Unknown SID") <> -1 if result.status = 410 or (result.status = 400 and result.error.InStr("Unknown SID") <> -1)
unknownSid = true unknownSid = true
exit for exit for
end if end if
@@ -5,7 +5,7 @@
<field id="deviceName" type="string" /> <field id="deviceName" type="string" />
<field id="screenId" type="string" /> <field id="screenId" type="string" />
<field id="loungeToken" type="string" /> <field id="loungeToken" type="string" />
<field id="credentialTransferToken" type="string" /> <field id="credentialTransferToken" type="assocarray" />
<field id="join" type="boolean" alwaysNotify="true" /> <field id="join" type="boolean" alwaysNotify="true" />
<field id="outgoingMessages" type="array" alwaysNotify="true" /> <field id="outgoingMessages" type="array" alwaysNotify="true" />
@@ -12,7 +12,7 @@ function ExecuteJob() as void
categories = input.categories categories = input.categories
service = new SponsorBlock.SponsorBlockService() service = new SponsorBlock.SponsorBlockService()
cancellation = CancellationUtils.CreateCancellation(JobGetCallbackNode(), "cancel", true) cancellation = JobGetCancellation()
skipSegments = service.GetSkipSegmentsForVideo(videoId, cancellation) skipSegments = service.GetSkipSegmentsForVideo(videoId, cancellation)
skipSegments = ProcessSkipSegments(skipSegments, showNotifications, categories, service) skipSegments = ProcessSkipSegments(skipSegments, showNotifications, categories, service)
+77 -20
View File
@@ -28,17 +28,6 @@ namespace Sentry
event.timestamp = timestamp event.timestamp = timestamp
end if end if
message = event.message
hasAttachments = IsArray(event.attachments) and event.attachments.Count() > 0
if (not SUPPORTS_ATTACHMENTS) and hasAttachments
message += `\nAttachments:`
for each attachment in event.attachments
message += `\nAttachment: ${attachment.filename} (${attachment.content_type})\n${attachment.data}`
end for
end if
eventPayload = { eventPayload = {
event_id: event.event_id event_id: event.event_id
timestamp: event.timestamp timestamp: event.timestamp
@@ -51,22 +40,44 @@ namespace Sentry
release: event.release release: event.release
tags: event.tags tags: event.tags
level: event.level level: event.level
logentry: {
formatted: message
}
user: { user: {
id: event.userId id: event.userId
} }
} }
if event.fingerprint <> invalid message = event.message
if IsString(event.fingerprint)
eventPayload.fingerprint = [event.fingerprint] if event.fingerprint = invalid
else if IsArray(event.fingerprint) event.fingerprint = GetFingerprint(message)
eventPayload.fingerprint = event.fingerprint
end if
end if end if
if event.fingerprint <> invalid
fingerprint = event.fingerprint
if not IsArray(fingerprint)
fingerprint = [fingerprint]
end if
for i = 0 to fingerprint.Count() - 1
if not IsString(fingerprint[i])
fingerprint[i] = ToString(fingerprint[i])
end if
end for
eventPayload.fingerprint = fingerprint
end if
hasAttachments = IsArray(event.attachments) and event.attachments.Count() > 0
if (not SUPPORTS_ATTACHMENTS) and hasAttachments
message += `\nAttachments: (${event.attachments.Count()} files)`
for each attachment in event.attachments
message += `\nAttachment: ${attachment.filename} (${attachment.content_type})\n${attachment.data}`
end for
message += `\nEnd of attachments.`
end if
eventPayload.logentry = {
formatted: message
}
payload += FormatJson(eventPayload) + `\n` payload += FormatJson(eventPayload) + `\n`
if SUPPORTS_ATTACHMENTS and hasAttachments if SUPPORTS_ATTACHMENTS and hasAttachments
@@ -113,4 +124,50 @@ namespace Sentry
return eventId return eventId
end function end function
function GetFingerprint(message as dynamic) as dynamic
if StringUtils.IsNullOrEmpty(message)
return invalid
end if
' Replaces `\nRequestId: 12345678\n` with `\nRequestId: <REQUEST_ID>\n`
fingerprint = ReplaceRequestId(message)
if fingerprint = invalid
return invalid
end if
return [fingerprint]
end function
function ReplaceRequestId(message as string) as dynamic
reqIdStart = `\nRequestId: `
reqIdPlaceholder = "<REQUEST_ID>"
result = message
replaced = false
searchIndex = 0
while true
requestIdIndex = result.InStr(searchIndex, reqIdStart)
if requestIdIndex = -1
exit while
end if
reqIdStartIndex = requestIdIndex + reqIdStart.Len()
newLineIndex = result.InStr(reqIdStartIndex, `\n`)
if newLineIndex = -1
exit while
end if
reqIdEndIndex = newLineIndex - 1
if (reqIdEndIndex <= reqIdStartIndex) or ((reqIdEndIndex - reqIdStartIndex) > 20)
exit while
end if
result = result.Mid(0, reqIdStartIndex) + reqIdPlaceholder + result.Mid(reqIdEndIndex + 1)
replaced = true
searchIndex = reqIdStartIndex + reqIdPlaceholder.Len()
end while
if not replaced
return invalid
end if
return result
end function
end namespace end namespace
@@ -1,4 +1,4 @@
#const SUPPORTS_BATCHING = true #const SUPPORTS_BATCHING = false
import "pkg:/components/Telemetry/Sentry.bs" import "pkg:/components/Telemetry/Sentry.bs"
import "pkg:/source/utils/Logging.bs" import "pkg:/source/utils/Logging.bs"
@@ -68,7 +68,9 @@ function ExecuteJob() as void
if response.error = Invidious.ERROR_NOT_AUTHENTICATED if response.error = Invidious.ERROR_NOT_AUTHENTICATED
if feedSources.Count() = 1 if feedSources.Count() = 1
parent = feedContentNode.getParent() parent = feedContentNode.getParent()
parent.removeChild(feedContentNode) if parent <> invalid
parent.removeChild(feedContentNode)
end if
JobSuccess() JobSuccess()
return return
end if end if
@@ -80,7 +82,9 @@ function ExecuteJob() as void
LogWarnNoTelemetry(feedSource.endpoint, "feedSource not available:", response.error) LogWarnNoTelemetry(feedSource.endpoint, "feedSource not available:", response.error)
if feedSources.Count() = 1 if feedSources.Count() = 1
parent = feedContentNode.getParent() parent = feedContentNode.getParent()
parent.removeChild(feedContentNode) if parent <> invalid
parent.removeChild(feedContentNode)
end if
JobSuccess() JobSuccess()
return return
end if end if
@@ -12,7 +12,7 @@ function ExecuteJob() as void
profileType = input.profileType profileType = input.profileType
playbackTrackingUrls = input.playbackTrackingUrls playbackTrackingUrls = input.playbackTrackingUrls
cancellation = CancellationUtils.CreateCancellation(JobGetCallbackNode(), "cancel", true) cancellation = JobGetCancellation()
if profileType = "invidious" if profileType = "invidious"
service = new Invidious.InvidiousService(invidiousNode) service = new Invidious.InvidiousService(invidiousNode)
@@ -30,7 +30,7 @@ function ExecuteJob() as void
metadata = contentNode.metadata metadata = contentNode.metadata
if not IsAssociativeArray(metadata) if not IsAssociativeArray(metadata)
cancellation = CancellationUtils.CreateCancellation(JobGetCallbackNode(), "cancel", true) cancellation = JobGetCancellation()
if backend = "playlet" if backend = "playlet"
visitorData = innertubeNode.visitorData visitorData = innertubeNode.visitorData
if StringUtils.IsNullOrEmpty(visitorData) if StringUtils.IsNullOrEmpty(visitorData)
@@ -68,13 +68,13 @@ function ExecuteJob() as void
end if end if
end if end if
if metadata = invalid if JobIsCancelled()
JobError("Failed to get video metadata") JobCancel()
return return
end if end if
if JobIsCancelled() if metadata = invalid
JobCancel() JobError("Failed to get video metadata")
return return
end if end if
@@ -97,6 +97,12 @@ function ExecuteJob() as void
end if end if
streamUrls = CreateStreamUrls(metadata, service, preferencesNode, backend, playletServerPort) streamUrls = CreateStreamUrls(metadata, service, preferencesNode, backend, playletServerPort)
if streamUrls.Count() = 0
contentNode.addFields({ metadata: metadata })
JobError("No playable streams found for this video.")
return
end if
' Forwarding query params to HLS playlists is not needed. In fact, it can cause issues ' Forwarding query params to HLS playlists is not needed. In fact, it can cause issues
' because the playlist is limited to 4MB, and on large playlists the query params ' because the playlist is limited to 4MB, and on large playlists the query params
' significantly increase the size of the playlist, making it cropped. ' significantly increase the size of the playlist, making it cropped.
@@ -126,18 +132,46 @@ function CreateStreamUrls(metadata as object, service as Invidious.InvidiousServ
streamUrls = [] streamUrls = []
if not StringUtils.IsNullOrEmpty(metadata.hlsUrl) if SupportsHls(metadata)
metadata.hlsUrl = AddInstanceToUrlIfNeeded(metadata.hlsUrl, instance) metadata.hlsUrl = AddInstanceToUrlIfNeeded(metadata.hlsUrl, instance)
AddHlsUrls(streamUrls, metadata, preferredQuality, backend, proxyVideos, playletServerPort) AddHlsUrls(streamUrls, metadata, preferredQuality, backend, proxyVideos, playletServerPort)
else else if SupportsDash(metadata)
' Not that we're using dashUrl, but why not, it useful when testing it
metadata.dashUrl = AddInstanceToUrlIfNeeded(metadata.dashUrl, instance)
AddDashUrls(streamUrls, metadata, preferredQuality, backend, proxyVideos, playletServerPort) AddDashUrls(streamUrls, metadata, preferredQuality, backend, proxyVideos, playletServerPort)
else if SupportsMuxedFormats(metadata)
for each stream in metadata.formatStreams
if StringUtils.IsNullOrEmpty(stream.url)
continue for
end if
stream.url = AddInstanceToUrlIfNeeded(stream.url, instance)
streamUrls.push(stream.url)
end for
end if end if
return streamUrls return streamUrls
end function end function
function SupportsHls(metadata as object) as boolean
return not StringUtils.IsNullOrEmpty(metadata.hlsUrl)
end function
function SupportsDash(metadata as object) as boolean
if not IsArray(metadata.adaptiveFormats) or metadata.adaptiveFormats.Count() = 0
return false
end if
for each fmt in metadata.adaptiveFormats
if not StringUtils.IsNullOrEmpty(fmt.url)
return true
end if
end for
return false
end function
function SupportsMuxedFormats(metadata as object) as boolean
return IsArray(metadata.formatStreams) and metadata.formatStreams.Count() > 0
end function
function AddHlsUrls(streamUrls as object, metadata as object, preferredQuality as string, backend as string, proxyVideos as string, playletServerPort as integer) function AddHlsUrls(streamUrls as object, metadata as object, preferredQuality as string, backend as string, proxyVideos as string, playletServerPort as integer)
hlsUrl = metadata.hlsUrl hlsUrl = metadata.hlsUrl
hlsUrlLocal = invalid hlsUrlLocal = invalid
@@ -460,7 +460,12 @@ function OnVideoPlayerStateChange() as void
content.playletStreamUrlIndex = playletStreamUrlIndex content.playletStreamUrlIndex = playletStreamUrlIndex
if playletStreamUrlIndex < playletStreamUrls.Count() if playletStreamUrlIndex < playletStreamUrls.Count()
nextUrl = playletStreamUrls[playletStreamUrlIndex] nextUrl = playletStreamUrls[playletStreamUrlIndex]
LogError(`Stream ${currentUrl} failed to play. Trying next stream ${nextUrl}`) LogErrorNoTelemetry(`Stream ${currentUrl} failed to play. Trying next stream ${nextUrl}`)
LogTelemetryEvent({
level: "error"
message: `Stream ${currentUrl} failed to play. Trying next stream ${nextUrl}`
fingerprint: ["Stream <URL> failed to play. Trying next stream <URL>"]
})
if StringUtils.IsNullOrEmpty(nextUrl) if StringUtils.IsNullOrEmpty(nextUrl)
LogError("Next stream URL is empty, cannot try next stream") LogError("Next stream URL is empty, cannot try next stream")
@@ -552,6 +557,10 @@ function GetPlayerErrorData(videoId as string, errorInfo as object) as object
end function end function
function ReportVideoError(errorData as object, url as string) as void function ReportVideoError(errorData as object, url as string) as void
if errorData.body.Instr("DRM exception") <> -1
return
end if
attachments = invalid attachments = invalid
if errorData.body.Instr("malformed data") <> -1 or errorData.body.Instr("invalid pathname") <> -1 if errorData.body.Instr("malformed data") <> -1 or errorData.body.Instr("invalid pathname") <> -1
lastGeneratedDash = ReadAsciiFile("tmp:/last_generated_dash.xml") lastGeneratedDash = ReadAsciiFile("tmp:/last_generated_dash.xml")
@@ -561,7 +570,6 @@ function ReportVideoError(errorData as object, url as string) as void
content_type: "plain/text" content_type: "plain/text"
data: lastGeneratedDash data: lastGeneratedDash
}] }]
DeleteFile("tmp:/last_generated_dash.xml")
else else
lastGeneratedHls = ReadAsciiFile("tmp:/last_generated_hls.m3u8") lastGeneratedHls = ReadAsciiFile("tmp:/last_generated_hls.m3u8")
if not StringUtils.IsNullOrEmpty(lastGeneratedHls) if not StringUtils.IsNullOrEmpty(lastGeneratedHls)
@@ -570,7 +578,6 @@ function ReportVideoError(errorData as object, url as string) as void
content_type: "plain/text" content_type: "plain/text"
data: lastGeneratedHls data: lastGeneratedHls
}] }]
DeleteFile("tmp:/last_generated_hls.m3u8")
end if end if
end if end if
end if end if
@@ -28,7 +28,7 @@ function ExecuteJob() as void
backgroundPoster.uri = `${instance}/vi/${videoId}/maxresdefault.jpg` backgroundPoster.uri = `${instance}/vi/${videoId}/maxresdefault.jpg`
cancellation = CancellationUtils.CreateCancellation(JobGetCallbackNode(), "cancel", true) cancellation = JobGetCancellation()
backend = preferencesNode["backend.selected"] backend = preferencesNode["backend.selected"]
if backend = "playlet" if backend = "playlet"
metadata = InnertubeService.GetVideoMetadata(videoId, { cancellation: cancellation }) metadata = InnertubeService.GetVideoMetadata(videoId, { cancellation: cancellation })
@@ -128,11 +128,7 @@ namespace VideoQueueUtils
end if end if
recommendedVideos = metadata.recommendedVideos recommendedVideos = metadata.recommendedVideos
if recommendedVideos = invalid if not IsArray(recommendedVideos) or recommendedVideos.Count() = 0
return false
end if
if recommendedVideos = invalid or recommendedVideos.Count() = 0
return false return false
end if end if
@@ -15,7 +15,7 @@ function ExecuteJob() as void
preferencesNode = input.preferences preferencesNode = input.preferences
service = new Invidious.InvidiousService(invidiousNode) service = new Invidious.InvidiousService(invidiousNode)
instance = service.GetInstance() instance = service.GetInstance()
cancellation = CancellationUtils.CreateCancellation(JobGetCallbackNode(), "cancel", true) cancellation = JobGetCancellation()
index = MathUtils.Clamp(input.index - 2, 0, videoNodes.Count() - 1) index = MathUtils.Clamp(input.index - 2, 0, videoNodes.Count() - 1)
@@ -66,7 +66,7 @@ end function
function LoadVideoDetail(videoNode as object, service as object, instance as string, requestOptions as object, backend as string) as boolean function LoadVideoDetail(videoNode as object, service as object, instance as string, requestOptions as object, backend as string) as boolean
videoId = videoNode.videoId videoId = videoNode.videoId
if backend = "playlet" if backend = "playlet" or instance = Invidious.PLAYLET_BUILT_IN_INSTANCE
requestOptions["retry"] = false requestOptions["retry"] = false
metadata = InnertubeService.GetVideoInfoBatched([videoId], requestOptions) metadata = InnertubeService.GetVideoInfoBatched([videoId], requestOptions)
if IsArray(metadata.videos) and metadata.videos.Count() > 0 if IsArray(metadata.videos) and metadata.videos.Count() > 0
@@ -420,31 +420,59 @@ namespace Http
options.continuation = continuation options.continuation = continuation
end if end if
result = InnertubeService.Search(query, options) fetchedPages = 0
while true
' Content can be filtered (for example, shorts removed)
' so we could be fetching multiple pages.
if fetchedPages > 3
response.Json({
"error": "Failed to search: no results found"
})
response.http_code = 500
return true
end if
result = InnertubeService.Search(query, options)
fetchedPages += 1
if raw if raw
response.Json(result) response.Json(result)
return true return true
end if end if
if result.error <> invalid if result.error <> invalid
response.Json(result) response.Json(result)
response.http_code = 500 response.http_code = 500
return true return true
end if end if
if not IsArray(result.feeds) or result.feeds.Count() = 0 if not IsArray(result.feeds) or result.feeds.Count() = 0
response.Json({ response.Json({
"error": "Failed to search: no results found" "error": "Failed to search: no results found"
}) })
response.http_code = 500 response.http_code = 500
return true return true
end if end if
response.Json(result.feeds[0]) feed = result.feeds[0]
if result.DoesExist("cache-control") if feed.items.Count() > 0
response.headers["cache-control"] = result["cache-control"] response.Json(feed)
end if if fetchedPages = 1 and result.DoesExist("cache-control")
response.headers["cache-control"] = result["cache-control"]
end if
return true
end if
if StringUtils.IsNullOrEmpty(feed.continuation)
response.Json({
"error": "Failed to search: no results found"
})
response.http_code = 500
return true
end if
LogDebug("Search returned no results, fetching next page with continuation")
options.continuation = feed.continuation
end while
return true return true
end function end function
+1 -1
View File
@@ -3,7 +3,7 @@ title=PlayletLib
# Do not update version manually, it is auto updated from package.json # Do not update version manually, it is auto updated from package.json
major_version=0 major_version=0
minor_version=41 minor_version=41
build_version=00009 build_version=00021
ui_resolutions=hd ui_resolutions=hd
uri_resolution_autosub=$$RES$$,480p,720p,1080p uri_resolution_autosub=$$RES$$,480p,720p,1080p
@@ -440,7 +440,8 @@ namespace HttpClient
while triesLeft > 0 while triesLeft > 0
backoffMs = 1000 + Rnd(2000) backoffMs = 1000 + Rnd(2000)
tryNumber = m._tryCount - triesLeft + 1 tryNumber = m._tryCount - triesLeft + 1
LogWarn("Request failed ID:", m.urlTransfer.GetIdentity(), "ErrorMessage:", response.ErrorMessage(), `\nRetrying: (`, tryNumber, "/", m._tryCount, ") in", backoffMs, "ms") LogWarnNoTelemetry("Request failed ID:", m.urlTransfer.GetIdentity(), "ErrorMessage:", response.ErrorMessage(), `\nRetrying: (`, tryNumber, "/", m._tryCount, ") in", backoffMs, "ms")
LogWarnTelemetry(response.ErrorMessage())
if IsFunction(m._retryCallback) if IsFunction(m._retryCallback)
try try
+4
View File
@@ -33,6 +33,10 @@ function LogTelemetryEvent(event as object)
m.global.telemetry.LogEvent = event m.global.telemetry.LogEvent = event
end function end function
function LogWarnTelemetry(message as string)
m.global.telemetry.LogWarn = message
end function
function ToString(value as dynamic) as string function ToString(value as dynamic) as string
if getInterface(value, "ifString") <> invalid if getInterface(value, "ifString") <> invalid
return value return value
+31 -51
View File
@@ -1,37 +1,37 @@
{ {
"name": "playlet-web", "name": "playlet-web",
"version": "0.41.9", "version": "0.41.21",
"lockfileVersion": 3, "lockfileVersion": 3,
"requires": true, "requires": true,
"packages": { "packages": {
"": { "": {
"name": "playlet-web", "name": "playlet-web",
"version": "0.41.9", "version": "0.41.21",
"devDependencies": { "devDependencies": {
"@sveltejs/vite-plugin-svelte": "^6.2.0", "@sveltejs/vite-plugin-svelte": "^6.2.1",
"@tailwindcss/postcss": "^4.1.13", "@tailwindcss/postcss": "^4.1.13",
"@tailwindcss/typography": "^0.5.16", "@tailwindcss/typography": "^0.5.19",
"@tsconfig/svelte": "^5.0.5", "@tsconfig/svelte": "^5.0.5",
"@vitejs/plugin-legacy": "^7.2.1", "@vitejs/plugin-legacy": "^7.2.1",
"autoprefixer": "^10.4.21", "autoprefixer": "^10.4.21",
"bgutils-js": "^3.2.0", "bgutils-js": "^3.2.0",
"daisyui": "^5.1.10", "daisyui": "^5.1.24",
"dotenv": "^17.2.2", "dotenv": "^17.2.2",
"ip": "^2.0.1", "ip": "^2.0.1",
"jszip": "^3.10.1", "jszip": "^3.10.1",
"postcss": "^8.5.6", "postcss": "^8.5.6",
"rollup-plugin-visualizer": "^6.0.3", "rollup-plugin-visualizer": "^6.0.3",
"svelte": "^5.38.10", "svelte": "^5.39.6",
"svelte-check": "^4.3.1", "svelte-check": "^4.3.2",
"svelte-preprocess": "^6.0.3", "svelte-preprocess": "^6.0.3",
"tailwindcss": "^4.1.13", "tailwindcss": "^4.1.13",
"terser": "^5.44.0", "terser": "^5.44.0",
"tslib": "^2.8.1", "tslib": "^2.8.1",
"typescript": "^5.9.2", "typescript": "^5.9.2",
"vite": "^7.1.5", "vite": "^7.1.7",
"vite-plugin-compression": "^0.5.1", "vite-plugin-compression": "^0.5.1",
"vite-tsconfig-paths": "^5.1.4", "vite-tsconfig-paths": "^5.1.4",
"youtubei.js": "^15.1.0" "youtubei.js": "^15.1.1"
} }
}, },
"node_modules/@alloc/quick-lru": { "node_modules/@alloc/quick-lru": {
@@ -2368,9 +2368,9 @@
} }
}, },
"node_modules/@sveltejs/vite-plugin-svelte": { "node_modules/@sveltejs/vite-plugin-svelte": {
"version": "6.2.0", "version": "6.2.1",
"resolved": "https://registry.npmjs.org/@sveltejs/vite-plugin-svelte/-/vite-plugin-svelte-6.2.0.tgz", "resolved": "https://registry.npmjs.org/@sveltejs/vite-plugin-svelte/-/vite-plugin-svelte-6.2.1.tgz",
"integrity": "sha512-nJsV36+o7rZUDlrnSduMNl11+RoDE1cKqOI0yUEBCcqFoAZOk47TwD3dPKS2WmRutke9StXnzsPBslY7prDM9w==", "integrity": "sha512-YZs/OSKOQAQCnJvM/P+F1URotNnYNeU3P2s4oIpzm1uFaqUEqRxUB0g5ejMjEb5Gjb9/PiBI5Ktrq4rUUF8UVQ==",
"dev": true, "dev": true,
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
@@ -2683,14 +2683,12 @@
} }
}, },
"node_modules/@tailwindcss/typography": { "node_modules/@tailwindcss/typography": {
"version": "0.5.16", "version": "0.5.19",
"resolved": "https://registry.npmjs.org/@tailwindcss/typography/-/typography-0.5.16.tgz", "resolved": "https://registry.npmjs.org/@tailwindcss/typography/-/typography-0.5.19.tgz",
"integrity": "sha512-0wDLwCVF5V3x3b1SGXPCDcdsbDHMBe+lkFzBRaHeLvNi+nrrnZ1lA18u+OTWO8iSWU2GxUOCvlXtDuqftc1oiA==", "integrity": "sha512-w31dd8HOx3k9vPtcQh5QHP9GwKcgbMp87j58qi6xgiBnFFtKEAgCWnDw4qUT8aHwkCp8bKvb/KGKWWHedP0AAg==",
"dev": true, "dev": true,
"license": "MIT",
"dependencies": { "dependencies": {
"lodash.castarray": "^4.4.0",
"lodash.isplainobject": "^4.0.6",
"lodash.merge": "^4.6.2",
"postcss-selector-parser": "6.0.10" "postcss-selector-parser": "6.0.10"
}, },
"peerDependencies": { "peerDependencies": {
@@ -3153,9 +3151,9 @@
} }
}, },
"node_modules/daisyui": { "node_modules/daisyui": {
"version": "5.1.10", "version": "5.1.24",
"resolved": "https://registry.npmjs.org/daisyui/-/daisyui-5.1.10.tgz", "resolved": "https://registry.npmjs.org/daisyui/-/daisyui-5.1.24.tgz",
"integrity": "sha512-p1J/HME2WmaSiy6u2alIbeP3gd5PNVft3+6Bdll0BRSm/UdI4084+pD01LxFug/5wGexNewWqbcEL6nB2n2o+Q==", "integrity": "sha512-CFfVmaTNOM4H6rJ7YjD8pIZNmRg6merSI2Yx0cP2cOSvyfG571zSPf8Y8m6rLqsteVrE6cqI+hBcpJqNB3YqkA==",
"dev": true, "dev": true,
"license": "MIT", "license": "MIT",
"funding": { "funding": {
@@ -3873,12 +3871,6 @@
"integrity": "sha512-SW13ws7BjaeJ6p7Q6CO2nchbYEc3X3J6WrmTTDto7yMPqVSZTUyY5Tjbid+Ab8gLnATtygYtiDIJGQRRn2ZOiA==", "integrity": "sha512-SW13ws7BjaeJ6p7Q6CO2nchbYEc3X3J6WrmTTDto7yMPqVSZTUyY5Tjbid+Ab8gLnATtygYtiDIJGQRRn2ZOiA==",
"dev": true "dev": true
}, },
"node_modules/lodash.castarray": {
"version": "4.4.0",
"resolved": "https://registry.npmjs.org/lodash.castarray/-/lodash.castarray-4.4.0.tgz",
"integrity": "sha512-aVx8ztPv7/2ULbArGJ2Y42bG1mEQ5mGjpdvrbJcJFU3TbYybe+QlLS4pst9zV52ymy2in1KpFPiZnAOATxD4+Q==",
"dev": true
},
"node_modules/lodash.debounce": { "node_modules/lodash.debounce": {
"version": "4.0.8", "version": "4.0.8",
"resolved": "https://registry.npmjs.org/lodash.debounce/-/lodash.debounce-4.0.8.tgz", "resolved": "https://registry.npmjs.org/lodash.debounce/-/lodash.debounce-4.0.8.tgz",
@@ -3886,18 +3878,6 @@
"dev": true, "dev": true,
"license": "MIT" "license": "MIT"
}, },
"node_modules/lodash.isplainobject": {
"version": "4.0.6",
"resolved": "https://registry.npmjs.org/lodash.isplainobject/-/lodash.isplainobject-4.0.6.tgz",
"integrity": "sha512-oSXzaWypCMHkPC3NvBEaPHf0KsA5mvPrOPgQWDsbg8n7orZ290M0BmC/jgRZ4vcJ6DTAhjrsSYgdsW/F+MFOBA==",
"dev": true
},
"node_modules/lodash.merge": {
"version": "4.6.2",
"resolved": "https://registry.npmjs.org/lodash.merge/-/lodash.merge-4.6.2.tgz",
"integrity": "sha512-0KpjqXRVvrYyCsX1swR/XTK0va6VQkQM6MNo7PqW77ByjAhoARA8EfrP1N4+KlKj8YS0ZUCtRT/YUuhyYDujIQ==",
"dev": true
},
"node_modules/lru-cache": { "node_modules/lru-cache": {
"version": "5.1.1", "version": "5.1.1",
"resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-5.1.1.tgz", "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-5.1.1.tgz",
@@ -4471,9 +4451,9 @@
} }
}, },
"node_modules/svelte": { "node_modules/svelte": {
"version": "5.38.10", "version": "5.39.6",
"resolved": "https://registry.npmjs.org/svelte/-/svelte-5.38.10.tgz", "resolved": "https://registry.npmjs.org/svelte/-/svelte-5.39.6.tgz",
"integrity": "sha512-UY+OhrWK7WI22bCZ00P/M3HtyWgwJPi9IxSRkoAE2MeAy6kl7ZlZWJZ8RaB+X4KD/G+wjis+cGVnVYaoqbzBqg==", "integrity": "sha512-bOJXmuwLNaoqPCTWO8mPu/fwxI5peGE5Efe7oo6Cakpz/G60vsnVF6mxbGODaxMUFUKEnjm6XOwHEqOht6cbvw==",
"dev": true, "dev": true,
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
@@ -4497,9 +4477,9 @@
} }
}, },
"node_modules/svelte-check": { "node_modules/svelte-check": {
"version": "4.3.1", "version": "4.3.2",
"resolved": "https://registry.npmjs.org/svelte-check/-/svelte-check-4.3.1.tgz", "resolved": "https://registry.npmjs.org/svelte-check/-/svelte-check-4.3.2.tgz",
"integrity": "sha512-lkh8gff5gpHLjxIV+IaApMxQhTGnir2pNUAqcNgeKkvK5bT/30Ey/nzBxNLDlkztCH4dP7PixkMt9SWEKFPBWg==", "integrity": "sha512-71udP5w2kaSTcX8iV0hn3o2FWlabQHhJTJLIQrCqMsrcOeDUO2VhCQKKCA8AMVHSPwdxLEWkUWh9OKxns5PD9w==",
"dev": true, "dev": true,
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
@@ -4813,9 +4793,9 @@
"dev": true "dev": true
}, },
"node_modules/vite": { "node_modules/vite": {
"version": "7.1.5", "version": "7.1.7",
"resolved": "https://registry.npmjs.org/vite/-/vite-7.1.5.tgz", "resolved": "https://registry.npmjs.org/vite/-/vite-7.1.7.tgz",
"integrity": "sha512-4cKBO9wR75r0BeIWWWId9XK9Lj6La5X846Zw9dFfzMRw38IlTk2iCcUt6hsyiDRcPidc55ZParFYDXi0nXOeLQ==", "integrity": "sha512-VbA8ScMvAISJNJVbRDTJdCwqQoAareR/wutevKanhR2/1EkoXVZVkkORaYm/tNVCjP/UDTKtcw3bAkwOUdedmA==",
"dev": true, "dev": true,
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
@@ -5046,9 +5026,9 @@
} }
}, },
"node_modules/youtubei.js": { "node_modules/youtubei.js": {
"version": "15.1.0", "version": "15.1.1",
"resolved": "https://registry.npmjs.org/youtubei.js/-/youtubei.js-15.1.0.tgz", "resolved": "https://registry.npmjs.org/youtubei.js/-/youtubei.js-15.1.1.tgz",
"integrity": "sha512-XwSXrbLpeER4gXArQ0NPRwfR9cUC3jVSZfHe4+LFGrambSHLO5wDR+vUm8tjDTC/SpGWj2Jxd9oQ5OXQolT9iQ==", "integrity": "sha512-fuEDj9Ky6cAQg93BrRVCbr+GTYNZQAIFZrx/a3oDRuGc3Mf5bS0dQfoYwwgjtSV7sgAKQEEdGtzRdBzOc8g72Q==",
"dev": true, "dev": true,
"funding": [ "funding": [
"https://github.com/sponsors/LuanRT" "https://github.com/sponsors/LuanRT"
+8 -8
View File
@@ -1,6 +1,6 @@
{ {
"name": "playlet-web", "name": "playlet-web",
"version": "0.41.9", "version": "0.41.21",
"type": "module", "type": "module",
"scripts": { "scripts": {
"dev": "vite", "dev": "vite",
@@ -9,29 +9,29 @@
"lint": "svelte-check --tsconfig ./tsconfig.json --fail-on-warnings" "lint": "svelte-check --tsconfig ./tsconfig.json --fail-on-warnings"
}, },
"devDependencies": { "devDependencies": {
"@sveltejs/vite-plugin-svelte": "^6.2.0", "@sveltejs/vite-plugin-svelte": "^6.2.1",
"@tailwindcss/postcss": "^4.1.13", "@tailwindcss/postcss": "^4.1.13",
"@tailwindcss/typography": "^0.5.16", "@tailwindcss/typography": "^0.5.19",
"@tsconfig/svelte": "^5.0.5", "@tsconfig/svelte": "^5.0.5",
"@vitejs/plugin-legacy": "^7.2.1", "@vitejs/plugin-legacy": "^7.2.1",
"autoprefixer": "^10.4.21", "autoprefixer": "^10.4.21",
"bgutils-js": "^3.2.0", "bgutils-js": "^3.2.0",
"daisyui": "^5.1.10", "daisyui": "^5.1.24",
"dotenv": "^17.2.2", "dotenv": "^17.2.2",
"ip": "^2.0.1", "ip": "^2.0.1",
"jszip": "^3.10.1", "jszip": "^3.10.1",
"postcss": "^8.5.6", "postcss": "^8.5.6",
"rollup-plugin-visualizer": "^6.0.3", "rollup-plugin-visualizer": "^6.0.3",
"svelte": "^5.38.10", "svelte": "^5.39.6",
"svelte-check": "^4.3.1", "svelte-check": "^4.3.2",
"svelte-preprocess": "^6.0.3", "svelte-preprocess": "^6.0.3",
"tailwindcss": "^4.1.13", "tailwindcss": "^4.1.13",
"terser": "^5.44.0", "terser": "^5.44.0",
"tslib": "^2.8.1", "tslib": "^2.8.1",
"typescript": "^5.9.2", "typescript": "^5.9.2",
"vite": "^7.1.5", "vite": "^7.1.7",
"vite-plugin-compression": "^0.5.1", "vite-plugin-compression": "^0.5.1",
"vite-tsconfig-paths": "^5.1.4", "vite-tsconfig-paths": "^5.1.4",
"youtubei.js": "^15.1.0" "youtubei.js": "^15.1.1"
} }
} }
-1
View File
@@ -280,7 +280,6 @@ export class YoutubeJs {
adaptiveFormats: YoutubeJs.getAdaptiveFormats(info), adaptiveFormats: YoutubeJs.getAdaptiveFormats(info),
formatStreams: [], formatStreams: [],
captions: YoutubeJs.getCaptions(info), captions: YoutubeJs.getCaptions(info),
recommendedVideos: [],
} }
} }
+2 -3
View File
@@ -79,8 +79,7 @@ Function RALE_InitConfig() as Object
minSocketPort: 49152, minSocketPort: 49152,
maxSocketPort: 65535, maxSocketPort: 65535,
screensaverResetTimeout: 30000, screensaverResetTimeout: 30000,
' Note: commandTimeout reduced from 10000 to 1000 to improve responsiveness commandTimeout: 10000,
commandTimeout: 1000,
defaultLogLevel: 3, defaultLogLevel: 3,
logFormat: "[RALE][%level%] - %message%" logFormat: "[RALE][%level%] - %message%"
} }
@@ -2003,7 +2002,7 @@ Sub init()
m.logger = RALE_Logger(m.config.defaultLogLevel, m.config.logFormat) m.logger = RALE_Logger(m.config.defaultLogLevel, m.config.logFormat)
m.socketConnection = RALE_SocketConnection() m.socketConnection = RALE_SocketConnection()
m.sceneBG = m.top.GetScene().getChild(0) m.sceneBG = m.top.GetScene().getChild(0)
m.raleVersion = "3.2.0" m.raleVersion = "3.3.5"
m.sessionId = CreateObject("roDeviceInfo").GetRandomUUID() m.sessionId = CreateObject("roDeviceInfo").GetRandomUUID()
m.logger.info("Roku Advanced Layout Editor v." + m.raleVersion) m.logger.info("Roku Advanced Layout Editor v." + m.raleVersion)
+20
View File
@@ -0,0 +1,20 @@
# Invidious
Just an Invidious docker-compose setup for quick testing with Playlet.
Detailed instructions in <https://docs.invidious.io/installation/#docker-compose-method-production>
To run:
- Create a `.env` file next to `docker-compose.yml`
- Generate two random passwords of 16 characters (e.g. using command `pwgen 16 1`)
- Add the two variables to your `.env` file, in addition to the port, like so:
```sh
INVIDIOUS_PORT=3000
INVIDIOUS_HMAC_KEY=PASSWORD_1
INVIDIOUS_COMPANION_KEY=PASSWORD_2
```
- Run `docker-compose up`
Invidious should now be running locally on port 3000.
+12
View File
@@ -0,0 +1,12 @@
#!/bin/bash
set -eou pipefail
psql --username "$POSTGRES_USER" --dbname "$POSTGRES_DB" < config/sql/channels.sql
psql --username "$POSTGRES_USER" --dbname "$POSTGRES_DB" < config/sql/videos.sql
psql --username "$POSTGRES_USER" --dbname "$POSTGRES_DB" < config/sql/channel_videos.sql
psql --username "$POSTGRES_USER" --dbname "$POSTGRES_DB" < config/sql/users.sql
psql --username "$POSTGRES_USER" --dbname "$POSTGRES_DB" < config/sql/session_ids.sql
psql --username "$POSTGRES_USER" --dbname "$POSTGRES_DB" < config/sql/nonces.sql
psql --username "$POSTGRES_USER" --dbname "$POSTGRES_DB" < config/sql/annotations.sql
psql --username "$POSTGRES_USER" --dbname "$POSTGRES_DB" < config/sql/playlists.sql
psql --username "$POSTGRES_USER" --dbname "$POSTGRES_DB" < config/sql/playlist_videos.sql
@@ -0,0 +1,12 @@
-- Table: public.annotations
-- DROP TABLE public.annotations;
CREATE TABLE IF NOT EXISTS public.annotations
(
id text NOT NULL,
annotations xml,
CONSTRAINT annotations_id_key UNIQUE (id)
);
GRANT ALL ON TABLE public.annotations TO current_user;
@@ -0,0 +1,30 @@
-- Table: public.channel_videos
-- DROP TABLE public.channel_videos;
CREATE TABLE IF NOT EXISTS public.channel_videos
(
id text NOT NULL,
title text,
published timestamp with time zone,
updated timestamp with time zone,
ucid text,
author text,
length_seconds integer,
live_now boolean,
premiere_timestamp timestamp with time zone,
views bigint,
CONSTRAINT channel_videos_id_key UNIQUE (id)
);
GRANT ALL ON TABLE public.channel_videos TO current_user;
-- Index: public.channel_videos_ucid_idx
-- DROP INDEX public.channel_videos_ucid_idx;
CREATE INDEX IF NOT EXISTS channel_videos_ucid_idx
ON public.channel_videos
USING btree
(ucid COLLATE pg_catalog."default");
+25
View File
@@ -0,0 +1,25 @@
-- Table: public.channels
-- DROP TABLE public.channels;
CREATE TABLE IF NOT EXISTS public.channels
(
id text NOT NULL,
author text,
updated timestamp with time zone,
deleted boolean,
subscribed timestamp with time zone,
CONSTRAINT channels_id_key UNIQUE (id)
);
GRANT ALL ON TABLE public.channels TO current_user;
-- Index: public.channels_id_idx
-- DROP INDEX public.channels_id_idx;
CREATE INDEX IF NOT EXISTS channels_id_idx
ON public.channels
USING btree
(id COLLATE pg_catalog."default");
+22
View File
@@ -0,0 +1,22 @@
-- Table: public.nonces
-- DROP TABLE public.nonces;
CREATE TABLE IF NOT EXISTS public.nonces
(
nonce text,
expire timestamp with time zone,
CONSTRAINT nonces_id_key UNIQUE (nonce)
);
GRANT ALL ON TABLE public.nonces TO current_user;
-- Index: public.nonces_nonce_idx
-- DROP INDEX public.nonces_nonce_idx;
CREATE INDEX IF NOT EXISTS nonces_nonce_idx
ON public.nonces
USING btree
(nonce COLLATE pg_catalog."default");
@@ -0,0 +1,19 @@
-- Table: public.playlist_videos
-- DROP TABLE public.playlist_videos;
CREATE TABLE IF NOT EXISTS public.playlist_videos
(
title text,
id text,
author text,
ucid text,
length_seconds integer,
published timestamptz,
plid text references playlists(id),
index int8,
live_now boolean,
PRIMARY KEY (index,plid)
);
GRANT ALL ON TABLE public.playlist_videos TO current_user;
+29
View File
@@ -0,0 +1,29 @@
-- Type: public.privacy
-- DROP TYPE public.privacy;
CREATE TYPE public.privacy AS ENUM
(
'Public',
'Unlisted',
'Private'
);
-- Table: public.playlists
-- DROP TABLE public.playlists;
CREATE TABLE IF NOT EXISTS public.playlists
(
title text,
id text primary key,
author text,
description text,
video_count integer,
created timestamptz,
updated timestamptz,
privacy privacy,
index int8[]
);
GRANT ALL ON public.playlists TO current_user;
@@ -0,0 +1,23 @@
-- Table: public.session_ids
-- DROP TABLE public.session_ids;
CREATE TABLE IF NOT EXISTS public.session_ids
(
id text NOT NULL,
email text,
issued timestamp with time zone,
CONSTRAINT session_ids_pkey PRIMARY KEY (id)
);
GRANT ALL ON TABLE public.session_ids TO current_user;
-- Index: public.session_ids_id_idx
-- DROP INDEX public.session_ids_id_idx;
CREATE INDEX IF NOT EXISTS session_ids_id_idx
ON public.session_ids
USING btree
(id COLLATE pg_catalog."default");
+29
View File
@@ -0,0 +1,29 @@
-- Table: public.users
-- DROP TABLE public.users;
CREATE TABLE IF NOT EXISTS public.users
(
updated timestamp with time zone,
notifications text[],
subscriptions text[],
email text NOT NULL,
preferences text,
password text,
token text,
watched text[],
feed_needs_update boolean,
CONSTRAINT users_email_key UNIQUE (email)
);
GRANT ALL ON TABLE public.users TO current_user;
-- Index: public.email_unique_idx
-- DROP INDEX public.email_unique_idx;
CREATE UNIQUE INDEX IF NOT EXISTS email_unique_idx
ON public.users
USING btree
(lower(email) COLLATE pg_catalog."default");
+23
View File
@@ -0,0 +1,23 @@
-- Table: public.videos
-- DROP TABLE public.videos;
CREATE UNLOGGED TABLE IF NOT EXISTS public.videos
(
id text NOT NULL,
info text,
updated timestamp with time zone,
CONSTRAINT videos_pkey PRIMARY KEY (id)
);
GRANT ALL ON TABLE public.videos TO current_user;
-- Index: public.id_idx
-- DROP INDEX public.id_idx;
CREATE UNIQUE INDEX IF NOT EXISTS id_idx
ON public.videos
USING btree
(id COLLATE pg_catalog."default");
+86
View File
@@ -0,0 +1,86 @@
version: "3"
services:
invidious:
image: quay.io/invidious/invidious:latest
restart: unless-stopped
ports:
- "${INVIDIOUS_PORT}:3000"
environment:
# Please read the following file for a comprehensive list of all available
# configuration options and their associated syntax:
# https://github.com/iv-org/invidious/blob/master/config/config.example.yml
INVIDIOUS_CONFIG: |
db:
dbname: invidious
user: kemal
password: kemal
host: invidious-db
port: 5432
check_tables: true
invidious_companion:
# URL used for the internal communication between invidious and invidious companion
# There is no need to change that except if Invidious companion does not run on the same docker compose file.
- private_url: "http://companion:8282/companion"
# IT is NOT recommended to use the same key as HMAC KEY. Generate a new key!
# Use the key generated in the 2nd step
invidious_companion_key: $INVIDIOUS_COMPANION_KEY
# external_port:
# domain:
# https_only: false
# statistics_enabled: false
# Use the key generated in the 2nd step
hmac_key: $INVIDIOUS_HMAC_KEY
healthcheck:
test: wget -nv --tries=1 --spider http://127.0.0.1:3000/api/v1/trending || exit 1
interval: 30s
timeout: 5s
retries: 2
logging:
options:
max-size: "1G"
max-file: "4"
depends_on:
- invidious-db
companion:
image: quay.io/invidious/invidious-companion:latest
environment:
# Use the key generated in the 2nd step
- SERVER_SECRET_KEY=$INVIDIOUS_COMPANION_KEY
restart: unless-stopped
# Uncomment only if you have configured "public_url" for Invidious companion
# Or if you want to use Invidious companion as an API in your program.
# Remove "127.0.0.1:" if used from an external IP
ports:
- "8282:8282"
logging:
options:
max-size: "1G"
max-file: "4"
cap_drop:
- ALL
read_only: true
# cache for youtube library
volumes:
- companioncache:/var/tmp/youtubei.js:rw
security_opt:
- no-new-privileges:true
invidious-db:
image: docker.io/library/postgres:14
restart: unless-stopped
volumes:
- postgresdata:/var/lib/postgresql/data
- ./config/sql:/config/sql
- ./docker/init-invidious-db.sh:/docker-entrypoint-initdb.d/init-invidious-db.sh
environment:
POSTGRES_DB: invidious
POSTGRES_USER: kemal
POSTGRES_PASSWORD: kemal
healthcheck:
test: ["CMD-SHELL", "pg_isready -U $$POSTGRES_USER -d $$POSTGRES_DB"]
volumes:
postgresdata:
companioncache: