* Revert "Fix disappearing end of the comments with emoji (#5587)"
This reverts commit 86c425b43f75dd1f22034bbfbd99476651661348.
* fix: fix rendered links and timestamps in video descriptions
* Add error message when comments are disabled
* Add btn to try reddit comments when yt is disabled
* Escape warning messages for disabled comments
* Add missing semicolons
* Update comment detection to not use msg renderer
* Use short syntax for comment entry-point detection
Co-authored-by: Samantaz Fox <coding@samantaz.fr>
* Condense try-reddit-comments-link HTML in player.js
Co-authored-by: Samantaz Fox <coding@samantaz.fr>
* Improve locale keys for comments disabled messages
Co-authored-by: Samantaz Fox <coding@samantaz.fr>
* Remove extra whitespace
* Use button instead of anchor for try reddit link
* Request Reddit comm when yt disabled during nojs=1
* Change order of commentsEnabled in parse results
* Lint
* Rebase error
* update the naming of the comments section in Innertube
Downstreamed from 36ac67610d
---------
Co-authored-by: Samantaz Fox <coding@samantaz.fr>
Co-authored-by: Fijxu <fijxu@nadeko.net>
Community posts comments still preserve the old author thumbnails
format that has an Array of thumbnails. I forgot to check that as I had
no idea `comments_youtube.cr` was also used for community posts comments
```json
"authorThumbnail": {
"thumbnails": [
{
"url": "//yt3.googleusercontent.com/ytc/AIdro_m9CJFVl3bEWvGnNnN4G9ErBO2lTpKePWCjx_FQtLWaDww=s32-c-k-c0x00ffffff-no-rj-mo",
"width": 32,
"height": 32
},
{
"url": "//yt3.googleusercontent.com/ytc/AIdro_m9CJFVl3bEWvGnNnN4G9ErBO2lTpKePWCjx_FQtLWaDww=s48-c-k-c0x00ffffff-no-rj-mo",
"width": 48,
"height": 48
},
{
"url": "//yt3.googleusercontent.com/ytc/AIdro_m9CJFVl3bEWvGnNnN4G9ErBO2lTpKePWCjx_FQtLWaDww=s76-c-k-c0x00ffffff-no-rj-mo",
"width": 76,
"height": 76
}
],
"accessibility": {
"accessibilityData": {
"label": "SomeOrdinaryGamers"
}
}
},
```
Some YouTube videos like https://www.youtube.com/watch?v=Ajkr_Wg-k8g
had an non comment key that was inside the Array that contained some
comment information that Invidious parses (like comment_key and
toolbar_key), that being the `commentFilterContextViewModel` key, which
is just an indicator on how comments are sorted:
```
{
"commentThreadRenderer": { ... } <- comment information that is
handled by line 134 of youtube.cr
},
{
"commentFilterContextViewModel": {
"text": {
"content": "Top is selected, so you'll see featured comments"
},
"accessibility": {
"accessibilityData": {
"label": "Top is selected, so you'll see featured comments"
}
}
} <- Useless information, this is not a comment
}
```
* Add option to disable easy to abuse API endpoints
The API endpoints that will be disabled when this option are:
- /api/v1/videos
- /api/v1/clips
- /api/v1/transcripts
There is still API endponts that need some sort of validation or
connection/proxying to Invidious companion like
`/api/v1/captions` and `/api/v1/storyboards` since they also do a video
request to Invidious companion. I'm not sure if the `/next` API endpoint
could be used to gather that type of information, if so, that would be
better.
Closes#5599
* Rename configuration variable, add additional comment for the option
Review fixes on top of the rebased /next-fallback work:
- Fix TypeCastError when subreason is stored as JSON null: accessors use
as_s?, and error returns go through a helper that omits nil subreason.
- Restore graceful no-companion path by reverting player() to return nil,
and drop the now-dead info.nil? branch in fetch_video.
- Re-enable video caching when Invidious Companion is not configured.
- Detect genuinely unavailable videos via playabilityStatus == "ERROR"
instead of the localized "Video unavailable" string.
- HTML-escape reason/subreason coming from YouTube to avoid HTML injection,
and guard against a missing "runs" key.
- Tidy published-date fallback and add a regression test.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
||= with false then nil resets live_now to nil in Crystal.
Use explicit nil checks instead to preserve false values from
microformat.isLiveNow for scheduled streams.
Error reason, subreason, and 'After which you should try to' links
now appear above the <h1> title, making them the first thing users
see when a video fails to play.
- player endpoint now uses direct _post_json when companion is absent
- When player endpoint fails, fall back to /next-only data extraction
- Watch page renders with title, description, comments from /next
- Set reason when companion unavailable for graceful error display
- Handle not-found videos correctly with 404 redirect
- Disabled companion in config for dev testing
- Keep error message only in player container placeholder (like YouTube does)
- Show only error_redirect_helper links below the title, no duplicate text
- Fixes visual duplication reported during review
- Display watch page even when player endpoint fails, using data from /next
- Show error message in player container placeholder (like YouTube does)
- Extract title, description, views, likes, comments etc. from /next
- Handle missing videoDetails gracefully with fallback to renderer data
- Fix is_listed detection from video badges when videoDetails unavailable
- Add subreason display for better error messages
- Add has_unlisted_badge? helper function
- Bump SCHEMA_VERSION to 4
- Integrate embed page with the same error handling
- Guard against empty streams when video has errors
- Fix JSON::Any.new(nil) crash for shortDescription
- Add locale key: error_from_youtube_unplayable
PR TODO status:
[x] Integrate the embed page with the changes
[x] Display the subreason on the watch page when there is an error
[x] Fix description (nil safety)
[ ] Add mocks for a video without videoDetails
Saves an unnecessary redirect by using `www.youtube.com` on some parts of Invidious where `youtube.com` was used instead. youtube.com will redirect to www.youtube.com anyways.
Co-authored-by: janmoesen <@>
* Add support for alternative domains for Invidious cookies
* check if @@secure is already true before changing it's value
* Add alternative_domains config option example
* fix: Do not append query params `quality=medium` to videos that are about to premiere
Video premieres do not have `audio_streams` and they aren't `video.live_now == true` either,
therefore we skip the checks that are made for older videos (`if audio_streams.empty? && !video.live_now` closure)
if the video is a premiere.
This commit also adds the `microformat` field to the `info` instance
variable of the `Video` struct, since it's needed for the function
`Video#premiere_timestamp : Time?`. This is more like a quick fix than a
proper fix because in `Invidious::Videos::Parser#parse_video_info`,
`premiere_timestamp` is gathered from the `microformat` JSON Object but
is used to set the `published` hash key for the `params` variable.
The parsers and structs really need a rework :/
* Revert "fix: Do not append query params `quality=medium` to videos that are about to premiere"
This reverts commit 5cfc8dace82590ea6a41c849c9c39b1b7ba95fe7.
* chore: build premiere_timestamp using video_type and published time
Previous code use UTF-8 to count characters however Emojis are UTF-16 units.
This difference leads to misalignment of index offsets.
Co-authored-by: shiny-comic <shiny-comic@winPC>
* fix author verification in channels
Fixes https://github.com/iv-org/invidious/issues/5730
Author verification badge is not longer located in
`c4TabbedHeaderRenderer`. It may be deprecated.
* Also detect AUDIO_BADGE for verified author
* feat: add support for /pl_c/ images
This path can be found on Podcast images.
* add support for /pl_c and /tvfilm_banner paths
* add support for /pl_c and /tvfilm_banner paths 2
* remove leftover comment
* fix: fix channel videos and playlists on searches
Channel videos are now encapsulated in a `lockupViewModel`.
There is 3 types of content that can be inside a `lockupViewModel`:
- LOCKUP_CONTENT_TYPE_VIDEO
- LOCKUP_CONTENT_TYPE_PLAYLIST
- LOCKUP_CONTENT_TYPE_PODCAST
This commit parses `LOCKUP_CONTENT_TYPE_VIDEO`, `LOCKUP_CONTENT_TYPE_PLAYLIST`, `LOCKUP_CONTENT_TYPE_PODCAST` types
to fix videos in channels, playlists in channels, podcast in channels, and other parts of Invidious were playlists and videos are displayed.
* remove unused variable `author_verified`
* fix parsing for podcasts
For some reason, Podcasts contains an empty JSON Object that we have to
skip, therefore we just iterate metadataRows until finding metadataParts
since metadataRows will not always contain a single Object.
* fix length_seconds for channel videos
* fix playlists parsing for playlists without metadataParts
On some channels like MrBeast, metadataParts is absent, missing the
author information, this is intended behaviour by Youtube since there is
no author information attached to them.
Example URL: https://www.youtube.com/channel/UCX6OQ3DkcsbYNE6H8uQQuVA/playlists
* restore author_verified functionality
* more robust metadata_parts parsing
Videos that have two or more authors (in collaborations), have their
author information in JSON Objects inside metadataParts, alongside with
their view count and their published date, therefore, we need to iterate
the metadataParts array and do some filtering based on the content of
each JSON Object to find the view count and published date for some
videos.
Example:
```json
"metadataParts": [
{
"text": {
"content": "Veritasium"
},
"icon": {
"name": "CHECK_CIRCLE_FILLED",
"height": 14,
"width": 14,
"accessibilityLabel": "Verified"
}
},
{
"text": {
"content": "and Linus Tech Tips"
},
"icon": {
"name": "CHECK_CIRCLE_FILLED",
"height": 14,
"width": 14,
"accessibilityLabel": "Verified"
}
},
{
"text": {
"content": "10M"
},
"accessibilityLabel": "10 million views"
},
{
"text": {
"content": "1y ago"
}
}
]
```
* improve playlist metadataRows and metadataParts parsing for channel playlists
* apply ameba suggestion
* Also parse lessons for playlists that are a course
* Playlists: fix parsing error when some videos are paid for in a course
* Remove redundant casting to string
fix rebase error
Co-Authored-By: syeopite <70992037+syeopite@users.noreply.github.com>
* Fix rebase issues
---------
Co-authored-by: syeopite <70992037+syeopite@users.noreply.github.com>