diff --git a/.github/ISSUE_TEMPLATE/new_instance.yaml b/.github/ISSUE_TEMPLATE/new_instance.yaml index c0fa887..de1e042 100644 --- a/.github/ISSUE_TEMPLATE/new_instance.yaml +++ b/.github/ISSUE_TEMPLATE/new_instance.yaml @@ -4,9 +4,17 @@ title: "[New instance] " assignees: - unixfox - samantazfox - - thefrenchghosty +labels: + - instance-add body: + - type: markdown + attributes: + value: | + Please consider joining our Matrix room for public instance maintainers by joining our Matrix room: https://matrix.to/#/#invidious:matrix.org + then pinging @unixfox, @TheFrenchGhosty and @SamantazFox for asking to be invited to the Matrix room. + We discuss troubles managing a public instance, sharing some advices and more. + - type: input id: url attributes: @@ -31,6 +39,8 @@ body: required: true - label: "Instance has an automatic hourly restart setup of Invidious" required: true + - label: "If dash, proxy + download is enabled (default settings), the instance has unlimited traffic/bandwidth or close to unlimited (100TB minimum)" + required: true - type: checkboxes diff --git a/.github/workflows/add-instance-uptimerobot.yml b/.github/workflows/add-instance-uptimerobot.yml new file mode 100644 index 0000000..d50b88f --- /dev/null +++ b/.github/workflows/add-instance-uptimerobot.yml @@ -0,0 +1,110 @@ +name: Add instance to uptimerobot + +on: + issues: + types: [opened, reopened] + +jobs: + + replycomment: + + runs-on: ubuntu-latest + permissions: write-all + steps: + - uses: actions/checkout@v3 + if: contains(github.event.issue.labels.*.name, 'instance-add') + - uses: actions/setup-node@v3 + if: contains(github.event.issue.labels.*.name, 'instance-add') + with: + node-version: 16 + - run: npm install request linkifyjs + if: contains(github.event.issue.labels.*.name, 'instance-add') + - uses: actions/github-script@v6 + if: contains(github.event.issue.labels.*.name, 'instance-add') + with: + script: | + var issueInfo = (await github.rest.issues.get({ + issue_number: context.issue.number, + owner: context.repo.owner, + repo: context.repo.repo, + })).data; + var linkify = require("linkifyjs"); + var issueTitleParseUrl = linkify.find(issueInfo.title); + if (issueTitleParseUrl.length !== 0) { + if (issueInfo.title.includes(".onion")) { + var replyComment = + ['Hello! I have detected that you are requesting to add an onion URL.', + 'Please create a pull request instead for adding your onion url as an alternative to your clearnet URL: https://github.com/iv-org/documentation/edit/master/docs/instances.md' + ].join('\n'); + await github.rest.issues.createComment({ + issue_number: context.issue.number, + owner: context.repo.owner, + repo: context.repo.repo, + body: replyComment + }); + await github.rest.issues.update({ + issue_number: context.issue.number, + owner: context.repo.owner, + repo: context.repo.repo, + state: 'closed' + }); + } + else { + var instanceHostname = (new URL(issueTitleParseUrl[0].href)).hostname; + var request = require("request"); + var options = { method: 'POST', + url: 'https://api.uptimerobot.com/v2/newMonitor', + json:true, + headers: + { 'content-type': 'application/x-www-form-urlencoded', + 'cache-control': 'no-cache' }, + form: + { api_key: '${{ secrets.UPTIMEROBOT_API_KEY }}', + format: 'json', + type: '1', + url: 'https://' + instanceHostname, + friendly_name: instanceHostname } }; + + request(options, async function (error, response, body) { + if (error) throw new Error(error); + console.log(body); + if (body.stat == "ok") { + var replyComment = + ['Hello! Your instance has been added to our monitoring system: https://stats.uptimerobot.com/89VnzSKAn/' + body.monitor.id, + 'You need to wait 30 days before we add your instance, this is to evaluate that your instance will keep a good uptime for one month.', + '', + 'Make sure you double checked all the mandatory checks or this will slow down the process of adding your instance!', + '', + 'Please consider joining our Matrix room for public instance maintainers by joining our Matrix room: https://matrix.to/#/#invidious:matrix.org', + 'then pinging @ unixfox, @ TheFrenchGhosty and @ SamantazFox for asking to be invited to the Matrix room.', + 'We discuss troubles managing a public instance, sharing some advices and more.' + ].join('\n'); + await github.rest.issues.createComment({ + issue_number: context.issue.number, + owner: context.repo.owner, + repo: context.repo.repo, + body: replyComment + }) + await github.rest.issues.addLabels({ + issue_number: context.issue.number, + owner: context.repo.owner, + repo: context.repo.repo, + labels: ['wait-30-days'] + }) + } + }); + } + } + else { + var replyComment = + ['Domain not detected in the title, please edit the title by correcting it like this:', + 'Issue title example: `[New instance] https://myinstance.com`' + ].join('\n'); + + await github.rest.issues.createComment({ + issue_number: context.issue.number, + owner: context.repo.owner, + repo: context.repo.repo, + body: replyComment + }) + } diff --git a/.github/workflows/remove-30days-label.yml b/.github/workflows/remove-30days-label.yml new file mode 100644 index 0000000..6e235ad --- /dev/null +++ b/.github/workflows/remove-30days-label.yml @@ -0,0 +1,23 @@ +name: Remove instance label when closing + +on: + issues: + types: [closed] + +jobs: + + replycomment: + + runs-on: ubuntu-latest + permissions: write-all + steps: + - uses: actions/github-script@v6 + if: contains(github.event.issue.labels.*.name, 'wait-30-days') + with: + script: | + await github.rest.issues.removeLabel({ + issue_number: context.issue.number, + owner: context.repo.owner, + repo: context.repo.repo, + name: 'wait-30-days' + }); \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 0000000..e2f6d9c --- /dev/null +++ b/README.md @@ -0,0 +1,19 @@ +# The Invidious documentation + +## Running the documentation locally for development purposes + +Run those commands in the repository's folder. + +### Local `mkdocs-material` installation + +```bash +# You might want to create a virtualenv first +pip install mkdocs-material +mkdocs-material serve +``` + +### With docker + +```bash +docker run --rm -it -p 8000:8000 -v ${PWD}:/docs squidfunk/mkdocs-material:latest +``` diff --git a/docs/anti-captcha.md b/docs/anti-captcha.md index f60e58e..764c240 100644 --- a/docs/anti-captcha.md +++ b/docs/anti-captcha.md @@ -1,4 +1,4 @@ -# How to setup Anti-Captcha +# Anti-Captcha setup 1. [Register on anti-captcha.com](https://anti-captcha.com/clients/entrance/register) and finish the registration with the link provided in your mailbox. 2. Head over to the [Add fund](https://anti-captcha.com/clients/finance/refill) page and use whatever currency you prefer to use for adding $2 into your balance. diff --git a/docs/apache2.md b/docs/apache2.md index 473ebcb..911610d 100644 --- a/docs/apache2.md +++ b/docs/apache2.md @@ -1,4 +1,4 @@ -# Apache2 Reverse Proxy +# Apache2 reverse proxy setup - A very basic config, secured with Let's Encrypt. Any log is disabled by default. Do not forget to replace `ServerName` with your domain. diff --git a/docs/api.md b/docs/api.md index 7099696..9681c69 100644 --- a/docs/api.md +++ b/docs/api.md @@ -187,7 +187,10 @@ Returns annotation XML from YouTube's `/annotations_invideo` endpoint. Alternati ], "authorId": String, "authorUrl": String, - "isEdited": Bool, + + "isEdited": Boolean, + "isPinned": Boolean, + "content": String, "contentHtml": String, "published": Int64, @@ -321,203 +324,6 @@ region: ISO 3166 country code (default: "US") ] ``` -##### GET `/api/v1/channels/:ucid` - -> Schema: - -```javascript -{ - "author": String, - "authorId": String, - "authorUrl": String, - "authorBanners": [ - { - "url": String, - "width": Int32, - "height": Int32 - } - ], - "authorThumbnails": [ - { - "url": String, - "width": Int32, - "height": Int32 - } - ], - - "subCount": Int32, - "totalViews": Int64, - "joined": Int64, - - "paid": Bool, - "autoGenerated": Bool, - "isFamilyFriendly": Bool, - "description": String, - "descriptionHtml": String, - "allowedRegions": Array(String), - - "latestVideos": [ - { - "title": String, - "videoId": String, - "author": String, - "authorId": String, - "authorUrl": String, - - "videoThumbnails": [ - { - "quality": String, - "url": String, - "width": Int32, - "height": Int32 - } - ], - "description": String, - "descriptionHtml": String, - "viewCount": Int64, - "published": Int64, - "publishedText": String, - "lengthSeconds": Int32, - "paid": Bool, - "premium": Bool - } - ], - "relatedChannels": [ - { - "author": String, - "authorId": String, - "authorUrl": String, - "authorThumbnails": [ - { - "url": String, - "width": Int32, - "height": Int32 - } - ] - } - ] -} -``` - -Parameters: - -``` -sort_by: "newest", "oldest", "popular" (default: newest) -``` - -Note that a channel's username (if it doesn't include spaces) is also valid in place of `ucid`, e.g. `/api/v1/channels/BlenderFoundation`. - -##### GET `/api/v1/channels/:ucid/videos`, `/api/v1/channels/videos/:ucid` - -> Schema: - -```javascript -[ - { - title: String, - videoId: String, - author: String, - authorId: String, - authorUrl: String, - - videoThumbnails: [ - { - quality: String, - url: String, - width: Int32, - height: Int32 - } - ], - description: String, - descriptionHtml: String, - - viewCount: Int64, - published: Int64, - publishedText: String, - lengthSeconds: Int32 - paid: Bool, - premium: Bool - } -] -``` - -Parameters: - -``` -page: Int32 -sort_by: "newest", "oldest", "popular" (default: newest) -``` - -##### GET `/api/v1/channels/:ucid/latest`, `/api/v1/channels/latest/:ucid` - -```javascript -[ - { - title: String, - videoId: String, - authorId: String, - authorUrl: String, - - videoThumbnails: [ - { - quality: String, - url: String, - width: Int32, - height: Int32 - } - ], - description: String, - descriptionHtml: String, - - viewCount: Int64, - published: Int64, - publishedText: String, - lengthSeconds: Int32 - paid: Bool, - premium: Bool - } -] -``` - -##### GET `/api/v1/channels/playlists/:ucid`, `/api/v1/channels/:ucid/playlists` - -```javascript -{ - "playlists": [ - { - "title": String, - "playlistId": String, - "author": String, - "authorId": String, - "authorUrl": String, - "videoCount": Int32, - "videos": [ - { - "title": String, - "videoId": String, - "lengthSeconds": Int32, - "videoThumbnails": [ - { - "quality": String, - "url": String, - "width": Int32, - "height": Int32 - } - ] - } - ] - ], - "continuation": String? -} -``` - -Parameters: - -``` -continuation: String -sort_by: "oldest", "newest", "last" -``` - ##### GET `/api/v1/channels/comments/:ucid`, `/api/v1/channels/:ucid/comments` @@ -747,9 +553,11 @@ q: String type: "playlist", title: String, playlistId: String, + playlistThumbnail: String, author: String, authorId: String, authorUrl: String, + authorVerified: Boolean, videoCount: Int32, videos: [ @@ -781,6 +589,7 @@ q: String height: Int32 } ], + autoGenerated: Bool subCount: Int32, videoCount: Int32, description: String, @@ -796,9 +605,9 @@ q: String page: Int32 sort_by: "relevance", "rating", "upload_date", "view_count" date: "hour", "today", "week", "month", "year" -duration: "short", "long" -type: "video", "playlist", "channel", "all", (default: video) -features: "hd", "subtitles", "creative_commons", "3d", "live", "purchased", "4k", "360", "location", "hdr" (comma separated: e.g. "&features=hd,subtitles,3d,live") +duration: "short", "long", "medium" +type: "video", "playlist", "channel", "movie", "show", "all", (default: all) +features: "hd", "subtitles", "creative_commons", "3d", "live", "purchased", "4k", "360", "location", "hdr", "vr180" (comma separated: e.g. "&features=hd,subtitles,3d,live") region: ISO 3166 country code (default: "US") ``` diff --git a/docs/authenticated-endpoints.md b/docs/api/authenticated-endpoints.md similarity index 99% rename from docs/authenticated-endpoints.md rename to docs/api/authenticated-endpoints.md index 6efc0b5..dab3b1f 100644 --- a/docs/authenticated-endpoints.md +++ b/docs/api/authenticated-endpoints.md @@ -1,4 +1,4 @@ -# Authenticated Endpoints +# API - Authenticated endpoints All endpoints under namespace `/api/v1/auth` require authentication. diff --git a/docs/api/channels_endpoint.md b/docs/api/channels_endpoint.md new file mode 100644 index 0000000..2bd4b8d --- /dev/null +++ b/docs/api/channels_endpoint.md @@ -0,0 +1,208 @@ +# API - Channels endpoint + +Please refer to the [Common object types](./common_types.md) page for more +details on the various JSON objects used below. + + +##### GET `/api/v1/channels/:id` + +> Response: + +```javascript +{ + "author": String, + "authorId": String, + "authorUrl": String, + "authorVerified": Boolean, + "authorBanners": [ + // One or more ImageObject + ], + "authorThumbnails": [ + // One or more ImageObject + ], + + "subCount": Number, // Integer + "totalViews": Number, // Integer + "joined": Number, // Unix timestamp + + "autoGenerated": Boolean, + "isFamilyFriendly": Boolean, + + "description": String, + "descriptionHtml": String, + "allowedRegions": String[], + + "tabs": String[], + + "latestVideos": [ + // One or more VideoObject + ], + "relatedChannels": [ + // One or more ChannelObject + ] +} +``` + + +##### GET `/api/v1/channels/:id/channels` + +> URL parameters: + +* `continuation`: A continuation token to get the next chunk of items. The token is provided each time this API is requested. + +> Response: + +```javascript +{ + "relatedChannels": [ + // One or more ChannelObject + ], + "continuation": String +} +``` + + +##### GET `/api/v1/channels/:id/latest` + +This is the same as requesting `/api/v1/channels/:id/videos` without URL parameters. + + +##### GET `/api/v1/channels/:id/playlists` + +> URL parameters: + +* `continuation`: A continuation token to get the next chunk of items. The token is provided each time this API is requested. +* `sort_by`: Sort order filter. Accepted values: `oldest`, `newest`, `last`. Defaults to `last`. + +> Response: + +```javascript +{ + "playlists": [ + // One or more PlaylistOject + ], + "continuation": continuation +} +``` + + +##### GET `/api/v1/channels/:id/shorts` + +> URL parameters: + +* `continuation`: A continuation token to get the next chunk of items. The token is provided each time this API is requested. + +> Response: + +See: GET `/api/v1/channels/:id/videos` + + +##### GET `/api/v1/channels/:id/streams` + +> URL parameters: + +* `continuation`: A continuation token to get the next chunk of items. The token is provided each time this API is requested. + +> Response: + +See: GET `/api/v1/channels/:id/videos` + + +##### GET `/api/v1/channels/:id/videos` + +> URL parameters: + +* `continuation`: A continuation token to get the next chunk of items. The token is provided each time this API is requested. +* `sort_by`: Sort order filter. Accepted values: `newest`, `popular` or `oldest` (Broken as of 10/2022). Default to `newest`. + +> Response: + +```javascript +{ + "videos": [ + // One or more VideoObject + ], + "continuation": String +} +``` + +##### GET `/api/v1/channels/:id/community` + +Please refer to the [Community Post Attachment types](#community-post-attachment-types) below for more details on the attachment JSON objects used below. + +> Url parameters + +* `continuation`: A continuation token to get the next chunk of items. + +> Response: + +```javascript +{ + "authorId": String, + "comments": { + "attachment": ImageAttachment | MultiImageAttachment | VideoAttachment | PollAttachment | PlaylistAttachment + "author": String, + "authorIsChannelOwner": Boolean + "authorId": String, + "authorThumbnails": ImageObject[], + "authorUrl": String, + "commentId": String, + "content": String, + "contentHtml": String, + "isEdited": Boolean, + "likeCount": Number, + "published": Number, + "publishedText": String, + "replyCount": Number + }[] +} +``` +###### Community Post Attachment Types +__VideoAttachment__ +See [VideoObject](./common_types.md#videoobject) common type + +__PlaylistAttachment__ +See [PlaylistObject](./common_types.md#playlistobject) common type + +__ImageAttachment__ + +```javascript +{ + "type": "image", + "imageThumbnails": ImageObject[] +} +``` + +__MultiImageAttachment__ + +```javascript +{ + "type": "multiImage", + "images": ImageObject[][] +} +``` + +__PollAttachment__ + +```javascript +{ + "type": "poll", + "totalVotes": Number, + "choices": { + "text": String, + "image?": ImageObject[] + }[] + +} +``` + +__Unknown__ + +This usually means that parsing support for the attachment type has not yet been implemented. + +```javascript +{ + "type": "unknown", + "error": String +} +``` diff --git a/docs/api/common_types.md b/docs/api/common_types.md new file mode 100644 index 0000000..994b917 --- /dev/null +++ b/docs/api/common_types.md @@ -0,0 +1,116 @@ +# API - Common object types + + +### ImageObject + +```javascript +{ + "url": String, + "width": Number, // Integer + "height": Number // Integer +} +``` + + +### ThumbnailObject + +```javascript +{ + "quality": String, + "url": String, + "width": Number, // Integer + "height": Number // Integer +} +``` + + +### VideoObject + +```javascript +{ + "type": "video", // Constant + + "title": String, + "videoId": String, + + "author": String, + "authorId": String, + "authorUrl": String, + "authorVerified": Boolean, + + "videoThumbnails": [ + // One or more ThumbnailObject + ], + + "description": String, + "descriptionHtml": String, + + "viewCount": Number, // Integer + "viewCountText": String, + "lengthSeconds": Number, // Integer + + "published": Number, // Unix timestamp + "publishedText": String, + + // Only available on premiered videos + "premiereTimestamp": Number, // Unix timestamp + + "liveNow": Boolean, + "premium": Boolean, + "isUpcoming": Boolean +} +``` + + +### ChannelObject + +```javascript +{ + "type": "channel", // Constant + + "author": String, + "authorId": String, + "authorUrl": String, + "authorVerified": Boolean, + "authorThumbnails": [ + // One or more ThumbnailObject + ], + + "autoGenerated": Boolean, + "subCount": Number, // Integer + "videoCount": Number, // Integer + + "description": String, + "descriptionHtml": String, +} +``` + + +### PlaylistObject + +```javascript +{ + "type": "playlist", // Constant + + "title": String, + "playlistId": String, + "playlistThumbnail": String, + + "author": String, + "authorId": String, + "authorUrl": String, + "authorVerified": Boolean, + + "videoCount": Number, // Integer + "videos": [ + { + "title": String, + "videoId": String, + "lengthSeconds": Number, // Integer + "videoThumbnails": [ + // One or more ThumbnailObject + ] + } + ] +} +``` diff --git a/docs/applications.md b/docs/applications.md index 2e941de..b57a7c2 100644 --- a/docs/applications.md +++ b/docs/applications.md @@ -1,28 +1,43 @@ # Applications -### Browser extensions for Invidious -- [Privacy Redirect](https://github.com/SimonBrazell/privacy-redirect): Redirects YouTube to Invidious, Twitter to Nitter, and Instagram to Bibliogram. [Source](https://github.com/SimonBrazell/privacy-redirect) / [Firefox](https://addons.mozilla.org/addon/privacy-redirect) / [Chrome](https://chrome.google.com/webstore/detail/privacy-redirect/pmcmeagblkinmogikoikkdjiligflglb) -- [Alter](https://addons.mozilla.org/addon/alter): Firefox extension that redirects YouTube, Twitter and Reddit to Invidious, Nitter and Teddit respectively. [Source](https://github.com/w3bdev1/alter) / [Firefox](https://addons.mozilla.org/addon/alter) -- [SponsorBlock](https://github.com/ajayyy/SponsorBlock): A crowd-sourced extension to skip sponsorships. Support invidious instances if enabled in the options. [Source](https://github.com/ajayyy/SponsorBlock) / [Firefox](https://addons.mozilla.org/addon/sponsorblock) / [Chrome](https://chrome.google.com/webstore/detail/mnjggcdmjocbbbhaepdhchncahnbgone) -- [Invidition](https://addons.mozilla.org/addon/invidition): Firefox extension that redirects YouTube links and embeds to their Invidious counterpart without any call to YouTube. [Source](https://codeberg.org/Booteille/Invidition) (**deprecated**). -- [Alternate Tube Redirector](https://gitlab.com/2vek/alternate-tube-redirector): Extension to automatically open YouTube Videos on alternate sites like Invidious or Hooktube. [Source](https://gitlab.com/2vek/alternate-tube-redirector) -- [Invidious Copy URL](https://github.com/recette-lemon/invidious-copy-url): Adds context menu options on Invidious to copy shortened YouTube URL at current time or not (Requires using developer mode in Chrome or a developer version of Firefox). -- [View on Invidious](https://omar.yt/722e5c15832840fe1ae8830b7c590254b9e0a45c/invidious-bookmarklet.html): View page on Invidious (bookmarklet). -- [Inviduration](https://addons.mozilla.org/addon/inviduration): Firefox extension that shows total duration of playlists on Invidious. [Source](https://github.com/rsapkf/inviduration) / [Firefox](https://addons.mozilla.org/addon/inviduration) +Lists of third-party projects that use or support Invidious. + +### Browser Extensions + +| Name | Description | Links | +|---|---|---| +| [Privacy Redirect](https://github.com/SimonBrazell/privacy-redirect) | Redirects YouTube to Invidious, Twitter to Nitter, and Instagram to Bibliogram. | [Source](https://github.com/SimonBrazell/privacy-redirect) / [Firefox](https://addons.mozilla.org/addon/privacy-redirect) / [Chrome](https://chrome.google.com/webstore/detail/privacy-redirect/pmcmeagblkinmogikoikkdjiligflglb) | +| [Alter](https://addons.mozilla.org/addon/alter) | Firefox extension that redirects YouTube, Twitter and Reddit to Invidious, Nitter and Teddit respectively. | [Source](https://github.com/w3bdev1/alter) / [Firefox](https://addons.mozilla.org/addon/alter) | +| [SponsorBlock](https://github.com/ajayyy/SponsorBlock) | A crowd-sourced extension to skip sponsorships. Support invidious instances if enabled in the options. | [Source](https://github.com/ajayyy/SponsorBlock) / [Firefox](https://addons.mozilla.org/addon/sponsorblock) / [Chrome](https://chrome.google.com/webstore/detail/mnjggcdmjocbbbhaepdhchncahnbgone) | +| [Invidious Copy URL](https://github.com/recette-lemon/invidious-copy-url) | Adds context menu options on Invidious to copy shortened YouTube URL at current time or not (Requires using developer mode in Chrome or a developer version of Firefox). | | +| [View on Invidious](https://omar.yt/722e5c15832840fe1ae8830b7c590254b9e0a45c/invidious-bookmarklet.html) | View page on Invidious (bookmarklet). | | +| [Inviduration](https://addons.mozilla.org/addon/inviduration) | Firefox extension that shows total duration of playlists on Invidious. | [Source](https://github.com/rsapkf/inviduration) / [Firefox](https://addons.mozilla.org/addon/inviduration) | +| [Redirector](https://github.com/einaregilsson/Redirector) | Extension for Firefox and Chromium that can manually be configured to process Invidious Redirects. For details, see the [setup page](./redirector.md) to use it with Invidious. | ### Userscripts for Invidious. -- [Invidious Redirect](https://greasyfork.org/en/scripts/370461-invidious-redirect): Redirects YouTube URLs to Invidio.us. -- [YouTube to Invidious](https://greasyfork.org/en/scripts/375264-youtube-to-invidious): Scans current page for YouTube embeds and replace with Invidious. -- [No-Youtube](https://github.com/mperez01/no-youtube): Userscript to replace youtube links to invidio.us. -- [Invidious Audio Mode](https://greasyfork.org/en/scripts/397700-invidious-audio-mode): Adds a headphone icon next to all video links. Handy for those that just want to stream audio and not video. -- [FYTE](https://greasyfork.org/en/scripts/9252-fyte-fast-youtube-embedded-player): Replace all YouTube embeds on a page with the video's thumbnail. Click on the thumbnail to play the video. Invidious is supported in the Options panel. -### Extensions that integrate Invidious into other programs and apps -- [UntrackMe](https://f-droid.org/en/packages/app.fedilab.nitterizeme): Android app to rewrite YouTube links to Invidious. Can optionally play videos in the app as well. -- [iPhone Redirector Shortcut](https://www.icloud.com/shortcuts/6bbf26d989cf4d07a5fe1626efbc0950): Automatically open YouTube videos in Invidious (iPhone shortcut). -- [FreshRSS Extension](https://github.com/tmiland/freshrss-invidious): A FreshRSS extension to directly embed videos from Invidious channel feeds. -- [Kodi add-on](https://github.com/TheAssassin/kodi-invidious-plugin): Watch YouTube videos in the Kodi media center, using the Invidious API. Privacy-friendly alternative to the YouTube API add-on. -- [Another Kodi add-on](https://github.com/lekma/plugin.video.invidious): Seems to have been more recently updated than the above. +| Name | Description | +|---|---| +| [Invidious Redirect](https://greasyfork.org/en/scripts/370461-invidious-redirect) | Redirects YouTube URLs to a deprecated instance, but can be edited to redirect to a different instance. | +| [YouTube to Invidious](https://greasyfork.org/en/scripts/375264-youtube-to-invidious) | Scans current page for YouTube embeds and replace with invidio.us. (Can be edited to use any preferred instance) | +| [No-Youtube](https://github.com/mperez01/no-youtube) | Userscript to replace YouTube links to invidio.us. Can be edited to redirect to a preferred instance. +| [FYTE](https://greasyfork.org/en/scripts/9252-fyte-fast-youtube-embedded-player) | Replace all YouTube embeds on a page with the video's thumbnail. Click on the thumbnail to play the video. Invidious is supported in the Options panel (redirects to invidio.us by default, can be edited). | +| [Privacy Redirector](https://github.com/dybdeskarphet/privacy-redirector) | Userscript to automatically redirect to different private frontends, including Invidious. Can be configured to redirect to specific instances of the user's choice. | +| [Simple Sponsor Skipper](https://codeberg.org/mthsk/userscripts/src/branch/master/simple-sponsor-skipper) | Userscript based on SponsorBlock that is pre-configured to work with multiple Invidious instances, but can be easily altered to use any instance desired by the user. | +| [Invidious Preferences Userscript](https://github.com/MintMain21/Invidious-Preferences-Userscript) | Userscript for enforcing preferences across multiple instances, through URL Parameters, and without using browser cookies. Works in tandem with Privacy Redirector and Simple Sponsor Skipper. See [here](https://docs.invidious.io/url-parameters/) for more information about URL Parameters. | -### Utilities for Invidious -- [Invidious-Updater (And Installer)](https://github.com/tmiland/Invidious-Updater): Automatic install and update script for Invidious. +### Extensions that Integrate Invidious into other Apps + +| Name | Description | Links | +|---|---|---| +| [UntrackMe](https://f-droid.org/en/packages/app.fedilab.nitterizeme) | Android app to rewrite YouTube links to Invidious. Can optionally play videos in the app as well. | | +| [iPhone Redirector Shortcut](https://www.icloud.com/shortcuts/6bbf26d989cf4d07a5fe1626efbc0950) | Automatically open YouTube videos in Invidious (iPhone shortcut). | | +| [FreshRSS Extension](https://github.com/tmiland/freshrss-invidious) | A FreshRSS extension to directly embed videos from Invidious channel feeds. | | +| [Kodi add-on](https://github.com/lekma/plugin.video.invidious) | Watch YouTube videos in the Kodi media center, using the Invidious API. Privacy-friendly alternative to the YouTube API add-on. | | +| [Playlet](https://github.com/iBicha/playlet) | A Roku TV YouTube app that uses Invidious as a backend. | [Roku Store](https://channelstore.roku.com/en-ca/details/840aec36f51bfe6d96cf6db9055a372a/playlet) | + +### Utilities + +| Name | Description | +|---|---| +| [Invidious-Updater (And Installer)](https://github.com/tmiland/Invidious-Updater) | Automatic install and update script for Invidious. | diff --git a/docs/caddy.md b/docs/caddy.md new file mode 100644 index 0000000..c4ece41 --- /dev/null +++ b/docs/caddy.md @@ -0,0 +1,14 @@ +# Caddy reverse proxy setup + +This is a very basic config, assuming that you're using Caddy to manage SSL certificates for you. +Any log is disabled by default. Do not forget to replace `server_name` with your domain. + +``` +https:// { + reverse_proxy localhost:3000 + + log { + output discard + } +} +``` diff --git a/docs/captcha-bug.md b/docs/captcha-bug.md index f51b7fb..eb80fad 100644 --- a/docs/captcha-bug.md +++ b/docs/captcha-bug.md @@ -1,4 +1,4 @@ -# Issues with CAPTCHA on Debian and Ubuntu +# CAPTCHA bug on Debian and Ubuntu #### Warning: If you use ImageMagick on Ubuntu for other services like Mastodon this guide may break them, please use [this guide](https://linuxconfig.org/how-to-install-imagemagick-7-on-ubuntu-18-04-linux) instead. There is some issue on Debian 9 and Ubuntu 18.04 and later. It appears that the clock (the CAPTCHA) has no hands but you can see them outside the clock. You need to compile ImageMagick yourself with librsvg to solve this issue. diff --git a/docs/configuration.md b/docs/configuration.md index e6544fe..e932c66 100644 --- a/docs/configuration.md +++ b/docs/configuration.md @@ -1,73 +1,3 @@ # Configuration -### What can be configured and what are these configuration options? - -The configuration file is located at [invidious/config/config.yml](https://github.com/iv-org/invidious/blob/master/config/config.example.yml). - -- `channel_threads` (default `1`) Number of threads to use for crawling videos from channels - -- `feed_threads` (default `1`) Number of threads to use for refreshing subscription feeds - -``` -db: - user: kemal # your database user - password: kemal # your database password - host: localhost # database host - port: 5432 # postgres port -``` - -- `full_refresh` (default `false`) When crawling channel videos, threads should refresh *all* videos uploaded by a channel - -- `https_only` (default `false`) Used to tell Invidious it is accessed via https, set to `true` if you have for example a reverse proxy with a ssl certificate - -- `hmac_key` (default `nil`) Signing key for CSRF tokens (when `nil` is randomly generated on startup, can be any random string) - -- `domain` (default `nil`) Domain to use for providing `self` links in RSS feeds, issuing cookies, etc. - -- `use_pubsub_feeds` (default `false`) Use server-side notifications provided by [YouTube](https://developers.google.com/youtube/v3/guides/push_notifications). Requires `domain` and `hmac_key` to be set - -- `default_home` (default `"Popular"`) Default home page **Moved into `default_user_preferences`** - -- `feed_menu` (default `["Popular", "Trending", "Subscriptions"]`) Order of tabs on feed menu **Moved into `default_user_preferences`** - -- `captcha_enabled` (default `true`) Determine if CAPTCHA should be required for registration - -- `login_enabled` (default `true`) Whether users should be able to login - -- `registration_enabled` (default `true`) Whether new users should be able to register - -- `statistics_enabled` (default `false`) Whether statistics should be available from `/api/v1/stats` - -- `admins` (default `[]`) List of user IDs that have access to administrator preferences - -- `external_port` (default `nil`) Invidious should supply links to a different port (if running behind a proxy, for example). PubSub notifications (if enabled) will also be sent to this port - -- `default_user_preferences` (default [`ConfigPreferences`](https://github.com/iv-org/invidious/blob/master/src/invidious/helpers/helpers.cr#L127)) Default preferences to use for new and unregistered users, see [#415](https://github.com/iv-org/invidious/issues/415) - -- `dmca_content` (default `[]`) For compliance with DMCA requests, disables download widget for list of video IDs - -- `check_tables` (default `false`) Check table integrity, automatically try to add any missing columns, create columns, etc. - -- `cache_annotations` (default `false`) Cache annotations requested from IA, will not cache empty annotations or annotations that only contain cards - -- `banner` (default `nil`) Optional banner to be displayed along top of page for announcements, etc. - -- `hsts` (default `true`) For HTTP Strict Transport Security - -- `disable_proxy` (default `false`) Disable proxy option serverwide (options: 'dash', 'livestreams', 'downloads', 'local') - -- `force_resolve` (default `nil`) Force IPv4 or IPv6 connection to Google (options: 'ipv4', 'ipv6') see [#811](https://github.com/iv-org/invidious/issues/811) - -- `pool_size` (default `100`) Pool size for HTTP connections for youtube.com and ytimg.com (each domain has a separate pool of `pool_size`) - -- `admin_email` (default `omarroth@protonmail.com`) Email provided to users for bug reports - -- `port` (default `3000`) Default port for HTTP server - -- `host_binding` (default `0.0.0.0`) Default host for HTTP server - -- `cookies` (default `nil`) Cookies to be used when connecting to YouTube - -- `captcha_key` (default `nil`) [Anti-Captcha](https://anti-captcha.com/) API key for solving YouTube CAPTCHAs, see [#886](https://github.com/iv-org/invidious/issues/886). - -- `popular_enabled` (default `false`) Whether to display popular videos of the instance. +An comprehensive list of all the available config options, with detailed explaination and default values is available under [`config/config.example.yml`](https://github.com/iv-org/invidious/blob/master/config/config.example.yml) in the main invidious repository. diff --git a/docs/db-maintenance.md b/docs/db-maintenance.md index 5412980..1fef950 100644 --- a/docs/db-maintenance.md +++ b/docs/db-maintenance.md @@ -1,4 +1,10 @@ -# Database Information and Maintenance +# Database maintenance + +!!! Note + + You do not need to setup a cleanup cron anymore as there is now an automatic cleaning process in Invidious. + Since this pull request: [https://github.com/iv-org/invidious/pull/3294](https://github.com/iv-org/invidious/pull/3294). + But this page is left in case you need to manually cleanup the database. Invidious needs one PostgreSQL database which has the following tables. diff --git a/docs/export-youtube-subscriptions.md b/docs/export-youtube-subscriptions.md index dcf632c..5757feb 100644 --- a/docs/export-youtube-subscriptions.md +++ b/docs/export-youtube-subscriptions.md @@ -4,10 +4,11 @@ settings.** 1. Open [Google Takeout](https://takeout.google.com/takeout/custom/youtube). -2. Under `Create a new export` choose `YouTube and YouTube Music`. -3. Click on `All YouTube data included` and only tick `subscriptions` in the dialog that opens. -4. Click on `Next step`, make sure `Export once` is chosen and click on `Create export`. -5. Wait until the export creation is finished, then on the same page click on `Download` under +2. Check if you are on the right account, as you might be using a "brand" account on YouTube. +3. Under `Create a new export` choose `YouTube and YouTube Music`. +4. Click on `All YouTube data included` and only tick `subscriptions` in the dialog that opens. +5. Click on `Next step`, make sure `Export once` is chosen and click on `Create export`. +6. Wait until the export creation is finished, then on the same page click on `Download` under `Your latest export` that should now be visible. 6. Extract the downloaded archive and find the file `subscriptions.csv`. 7. While logged into your Invidious account go to Subscriptions -> Manage Subscriptions -> diff --git a/docs/geoblocking.md b/docs/geoblocking.md index e8f8011..ea9e4a6 100644 --- a/docs/geoblocking.md +++ b/docs/geoblocking.md @@ -1,4 +1,4 @@ -# Geoblocking, available video quality and DASH +# Videos geoblocking ## Geoblocking Sometimes you may notice that you cannot watch a video on Invidious. This is because YouTube is geoblocking, i.e. preventing access to videos based on your geographical location. diff --git a/docs/hide-instance-behind-proxy-server.md b/docs/hide-instance-behind-proxy-server.md new file mode 100644 index 0000000..372ac47 --- /dev/null +++ b/docs/hide-instance-behind-proxy-server.md @@ -0,0 +1,246 @@ +# Hiding Invidious instance behind proxy servers (for escaping DMCA requests) + +This tutorial has been written by [unixfox](https://github.com/unixfox), owner of [yewtu.be](https://yewtu.be/). He is better suited when looking for help about this tutorial. + +## Synopsis + +This tutorial will explain how to hide your Invidious (public) instance behind another server, useful for escaping the DMCA requests. + +This proxy server will only redirect the [TCP](https://en.wikipedia.org/wiki/Transmission_Control_Protocol) connections, allowing you to keep everything from your existing infrastructure. + +??? note "It's possible to do it by forwarding the HTTP connections directly but..." + + By forwarding the actual HTTP protocol this is more compute intensive and won't be covered in this tutorial. + + You need to proxy the HTTP protocol normally like you would already do with your current web server for invidious. But in this case from the proxy server to your existing infrastructure. Then also setup the certificates for HTTPS. + + Then you optionally preserve the IP address of your clients using for example on NGINX set_real_ip_from and real_ip_header. + +## Warning + +Adding an extra layer like a proxy server **will** add more latency, thus increase the response time from your final server to your browser. That's why for the part where you are going to rent a proxy server, you should choose a server close to your existing server(s). + +It should be noted, in the 4th step of the instructions, you will be able to remove this latency for a major part of the users of your instance (around 90% - people using modern browsers). The rest will experience this *added* latency which won't result in a decrease of the user experience if you choose your server wisely. + +## Requirements + +- Your main web server should support the proxy protocol, it's possible to do it without it (later on in the tutorial). Non-exhaustive list of web servers that support it: + + * NGINX (recommended web server for this tutorial) + * Traefik + * Apache ([doesn't come in the official version](https://www.scaleway.com/en/docs/tutorials/proxy-protocol-v2-load-balancer/#configuring-proxy-protocol-in-apache-web-server)) + * Caddy ([need to build with a custom module](https://github.com/mastercactapus/caddy2-proxyprotocol)) + +- You will have to spend a bit more money per month for renting this new proxy server. + +## Instructions + +### 1) Renting your proxy server + +There are a lot of providers that don't care about DMCA requests, you can find them by doing a search on your favorite search engine. +Here are some lists compiled from lowendtalk users: + +- https://lowendtalk.com/discussion/182615/are-there-any-active-dmca-free-vps-offers-from-top-providers ([webarchive link](https://web.archive.org/web/20221206182503/https://lowendtalk.com/discussion/182615/are-there-any-active-dmca-free-vps-offers-from-top-providers)) +- https://lowendtalk.com/discussion/181443/options-for-dmca-free-vps ([webarchive link](https://web.archive.org/web/20221007000624/https://lowendtalk.com/discussion/181443/options-for-dmca-free-vps)) +- https://lowendtalk.com/discussion/179472/what-are-my-options-for-a-dmca-free-vps ([webarchive link](https://web.archive.org/web/20230217184607/https://lowendtalk.com/discussion/179472/what-are-my-options-for-a-dmca-free-vps)) + +I personally chose [BuyVM](https://buyvm.net) as it's close to my existing infrastructure and it's cheap, but please try to at least find another one, it's much better to avoid the centralisation. + +Here are the recommended requirements for this proxy server: + +- At least 256MB of RAM in total if you are running Debian or 512MB with Ubuntu. +- The **outgoing** bandwidth limit/quota should be the same as the **outgoing** bandwidth consumption of your existing server that run Invidious. + Later in the tutorial I'll explain you how to reduce the bandwidth consumption on the proxy server but this won't drastically reduce it by a lot. + TL;DR: If you have "unlimited" bandwidth limit it's much better. +- 1 CPU core. +- The proxy server should be close to your existing server(s), for minimal latency overhead. + +??? note "You can monitor the bandwidth usage of your servers using vnStat." + + Documentation: https://wiki.archlinux.org/title/vnStat + Column `rx`: receive or incoming bandwidth + Column `tx`: Transfer or outgoing bandwidth + + 1. Install vnStat from your package manager, example on debian/ubuntu: `apt install vnstat` + 2. Start vnStat: `systemctl enable --now vnstat` + 3. In a few hours execute the command `vnstat` + +If you run into performance issue on the proxy server, feel free to switch to a new provider. + +And if you need help in choosing the ideal server, please seek for help on our [Matrix room](https://matrix.to/#/#invidious:matrix.org) or [IRC channel](https://web.libera.chat/?channel=#invidious). + +### 2) Listen to new ports on your web server of your existing infrastructure + +**On the web server of your existing infrastructure/server** that currently host your Invidious, listen on another port with the proxy protocol enabled for the HTTPS/TLS port. + +In this tutorial I'll use the port 8443, but you can choose any port you would want. +You don't need to setup a new port for the HTTP (cleartext) port as the proxy protocol is only for preserving the IP address of the clients that will connect your web server and nowadays all the requests are permanently redirected to HTTPS. + +??? note "If you don't want to preserve the IP address of the users of your instance." + + Meaning keeping your instance truly 100% anonymous, then you don't need to enable the proxy protocol on another port, you can keep your current configuration without touching anything and jump to the 3rd step. + + But preserving the IP address is in my opinion essential for blocking bots, bad actors. + +#### NGINX + +In the NGINX configuration file for Invidious, just after the line `listen 443 ssl http2` add this line: +``` +listen 8443 ssl http2 proxy_protocol; +set_real_ip_from PUBLIC_IPV4_ADDRESS_OF_PROXY_SERVER/32; +real_ip_header proxy_protocol; +``` + +Very simple example of a final result: +``` +http { + server { + listen 443 ssl http2; + listen 8443 ssl http2 proxy_protocol; + set_real_ip_from PUBLIC_IPV4_ADDRESS_OF_PROXY_SERVER/32; + real_ip_header proxy_protocol; + } +} +``` + +Note: You may not have `http2` parameter for the `listen 443 ssl` line, if you don't have it enabled, it's hugely recommended to enable it for better performance and user experience. + +**If you are going to follow the [4th step](#4-optionally-reduce-the-traffic-going-through-the-proxy-server), please remove `http2` parameter from the line `listen 8443 ssl http2 proxy_protocol`, it may clash with the technique.** + +#### Traefik + +CLI parameters, adapt to your platform (docker compose, kubernetes or local traefik): +``` +--entryPoints.websecure.address=:8443 +--entryPoints.websecure.proxyProtocol.trustedIPs=PUBLIC_IPV4_ADDRESS_OF_PROXY_SERVER/32 +``` + +Please see the documentation: https://doc.traefik.io/traefik/routing/entrypoints/#proxyprotocol + +For people on Kubernetes, this may help you: https://github.com/traefik/traefik-helm-chart/issues/404 + +#### Caddy + +(Not tested) On caddy it is not possible to listen on a port that support proxy protocol and another port without the proxy protocol, thus you won't be able to follow the step 4. +Or you can follow the step 4 but you need to not use the proxy protocol (not touching your configuration), thus losing the ability to preserve the IP address of the clients. + +1. Compile caddy with this module: https://github.com/mastercactapus/caddy2-proxyprotocol +2. Enable the proxy protocol like so: https://github.com/mastercactapus/caddy2-proxyprotocol#caddyfile + +#### Apache + +Apache is not the ideal web server for using proxy protocol because it's still in alpha stage and you need to compile apache using an external module like explained here: https://www.scaleway.com/en/docs/tutorials/proxy-protocol-v2-load-balancer/#configuring-proxy-protocol-in-apache-web-server + +Either you do that or you don't preserve the IP address of the clients by not touching your configuration but I can't help you more. + +#### Other web servers + +I won't cover all the possible web servers, look at the documentation of your web server and make it listen on port 8443 (or another port) with the proxy protocol enabled on it. Also try to find a way to preserve the IP address if needed. + +You can also not touch anything about your web server configuration and follow the note in the 3rd step. + +### 3) Install HAProxy on the proxy server + +**On the proxy server that you just rented.** + +1. Install haproxy from your package manager, on debian/ubuntu: `apt install haproxy`. +2. Edit the file `/etc/haproxy/haproxy.cfg` and replace it with this configuration: + + ``` + global + log /dev/null local0 info alert + log /dev/null local1 notice alert + chroot /var/lib/haproxy + stats socket /run/haproxy/admin.sock mode 660 level admin + stats timeout 30s + user haproxy + group haproxy + daemon + + defaults + log global + mode http + + frontend https + bind :::443 v4v6 + mode tcp + use_backend https + + backend https + balance roundrobin + mode tcp + server server1 PUBLIC_IPV4_ADDRESS_OF_ORIGINAL_SERVER:8443 check send-proxy + + frontend http + bind :::80 v4v6 + mode tcp + use_backend http + + backend http + balance roundrobin + mode tcp + server server1 PUBLIC_IPV4_ADDRESS_OF_ORIGINAL_SERVER:80 check + ``` + + **If you didn't enable the proxy protocol on your server** then remove `send-proxy` for the backend `https` and replace the port `8443` with `443`. + + In case you have more servers, add the other servers after the two lines `server server1` with their corresponding IP addresses. + + For caddy if you have enabled the proxy protocol you need to also add `send-proxy` for the backend `http`. + +4. Restart HAProxy using `systemctl restart haproxy`. + +5. Test if your setup is working by either temporarily update your local Hosts file to the IP address of your proxy server. + Or you can use curl for that: + ``` + curl https://yourdomain.com/ --resolve yourdomain.com:443:PUBLIC_IPV4_ADDRESS_OF_PROXY_SERVER + ``` + +6. If everything works well, you can now update the DNS entries of the domain for your Invidious instance to the IPv4 (and IPv6) address of your proxy server. + +### 4) Optionally reduce the traffic going through the proxy server + +There is a technique in the HTTP protocol that allow to redirect a client (e.g. a browser) to another server, it's the Alt-Svc header: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Alt-Svc. + +Unfortunately it only works for Firefox browsers as Chrome doesn't support the ability to use a different domain on HTTP2 with Alt-Svc but it does support it for HTTP3 which you can later on enable too with Alt-Svc. + +*I'll use the terminology `original server(s)` for the server(s) of your existing infrastructure, not the proxy server.* + +#### Requirement +You need to have HTTP2 enabled on your web server, on NGINX it's as simple as adding `http2` in the `listen ssl` line. +You can check that in your config or here: https://tools.keycdn.com/http2-test + +#### Instructions + +1. Go to your instance and press F12 for the dev tools, then go to the "Network" tab and click on the latest request. + Then check in `Remote Address` (Chrome) or `Address` (Firefox you need to click on `>`) if you see the IP address of your proxy server. +2. Add a new DNS record for the IPv4 (and IPv6) of your original server(s) to a subdomain, like `original.yourdomain.com`. +3. In your existing web server add this new HTTP header: + ``` + alt-svc: h2="original.yourdomain.com:443"; ma=86400 + ``` + Here is how to do it for: + - NGINX: `add_header alt-svc 'h2="original.yourdomain.com:443"; ma=86400';` + - Traefik (or [read the doc](https://doc.traefik.io/traefik/middlewares/http/headers/)): `traefik.http.middlewares.altsvc.headers.customresponseheaders.alt-svc=h2="original.yourdomain.com:443"; ma=86400` + - Caddy: `header alt-svc h2="original.yourdomain.com:443"; ma=86400` + - Apache: `Header set alt-svc 'h2="original.yourdomain.com:443"; ma=86400'` +4. Restart your web server +5. Go to your instance and press F12 for the dev tools, then go to the "Network" tab and click on the latest request. + Then check in `Remote Address` (Chrome) or `Address` (Firefox you need to click on `>`) if you see the IP address of your original server(s). + You may need to refresh the page. + + +#### Bonus point if you have HTTP3 on your web server + +Different web servers that support HTTP3: + +- Traefik, you can enable HTTP3: https://doc.traefik.io/traefik/routing/entrypoints/#http3 +- NGINX, there is a tutorial here: https://www.nginx.com/blog/binary-packages-for-preview-nginx-quic-http3-implementation/ +- Caddy, it's already enabled by default + +1. Whitelist the port UDP 443 in your firewall. +2. Edit the previously added HTTP header by adapting it like this: + ``` + alt-svc: h3="original.yourdomain.com:443"; ma=86400, h2="original.yourdomain.com:443"; ma=86400 + ``` +3. Restart your web server. Check in the dev tools if you still see the IP address of your original server(s) and the HTTP3 protocol should be also displayed. diff --git a/docs/index.md b/docs/index.md index db5560b..b188e47 100644 --- a/docs/index.md +++ b/docs/index.md @@ -1,25 +1,39 @@ ## General -- [Public Invidious Instances](./instances.md) +- [Invidious Instances](./instances.md) - [Applications](./applications.md) -- [Always proxy videos through server](./proxy-videos.md) +- [Export YouTube subscriptions](./export-youtube-subscriptions.md) +- [Frequently Asked Questions](./faq.md) + +## For Advanced Users + - [Preferences](./preferences.md) -- [Geoblocking, available quality and DASH](./geoblocking.md) -- [Using search filters](./search-filters.md) -- [List of URL parameters](./url-parameters.md) -- [How to deal with uMatrix](./umatrix.md) +- [Search filters](./search-filters.md) +- [URL parameters](./url-parameters.md) +- [UserScript to always proxy video](./proxy-videos.md) +- [Videos geoblocking](./geoblocking.md) +- [uMatrix setup](./umatrix.md) +- [Redirector setup](./redirector.md) ## For Administrators - [Installation](./installation.md) - [Configuration](./configuration.md) -- [Apache2 Virtual Host with Reverse Proxy](./apache2.md) -- [Nginx Reverse Proxy Configuration](./nginx.md) -- [Database Information and Maintenance](./db-maintenance.md) -- [Issues with CAPTCHA](./captcha-bug.md) -- [How to setup Anti-Captcha](./anti-captcha.md) +- [NGINX reverse proxy setup](./nginx.md) +- [Caddy reverse proxy setup](./caddy.md) +- [Apache2 reverse proxy setup](./apache2.md) +- [Database maintenance](./db-maintenance.md) +- [Handling takedown notices](./takedown.md) +- [Hiding Invidious instance behind proxy servers (for escaping DMCA requests)](./hide-instance-behind-proxy-server.md) +- [IPv6 rotator (for escaping YouTube blocking)](./ipv6-rotator.md) +- [CAPTCHA bug on Debian and Ubuntu](./captcha-bug.md) +- [Anti-Captcha setup](./anti-captcha.md) +- [Reset user password](./reset-password.md) +- [Known Exception in log](./known-exception.md) ## For Developers - [API](./api.md) -- [Authenticated Endpoints](./authenticated-endpoints.md) +- [API - Common object types](./api/common_types.md) +- [API - Channels endpoint](./api/channels_endpoint.md) +- [API - Authenticated endpoints](./api/authenticated-endpoints.md) diff --git a/docs/installation.md b/docs/installation.md index cffb34f..4dae24b 100644 --- a/docs/installation.md +++ b/docs/installation.md @@ -7,17 +7,11 @@ Note: Any [PaaS](https://en.wikipedia.org/wiki/Platform_as_a_service) or [SaaS]( ## Hardware requirements -Running Invidious requires at least 512MB of free RAM (so ~2G installed on the system), as long as the is restarted regularly, as recommended in the post-install configuration. Public instances should ideally have at least 4GB of RAM, 2vCPU, a 200 mbps link and 20TB of traffic (no data cap/unlimited traffic is preferred). +Running Invidious requires at least 20GB disk space, 512MB of free RAM (so ~2G installed on the system), as long as it is restarted regularly, as recommended in the post-install configuration. Public instances should ideally have at least 60G disk space, 4GB of RAM, 2vCPU, a 200 mbps link and 20TB of traffic (no data cap/unlimited traffic is preferred). Compiling Invidious requires at least 2.5GB of free RAM (We recommend to have at least 4GB installed). If you have less (e.g on a cheap VPS) you can setup a SWAP file or partition, so the combined amount is >= 4GB. - -## Automated Installation - -[Invidious-Updater](https://github.com/tmiland/Invidious-Updater) is a self-contained script that can automatically install and update Invidious. - - ## Docker **The Invidious docker image is only [available on Quay](https://quay.io/repository/invidious/invidious) because, unlike Docker Hub, [Quay is Free and Open Source Software](https://github.com/quay/quay/blob/master/LICENSE). This is reflected in the `docker-compose.yml` file used in this walk-through.** @@ -63,11 +57,16 @@ services: # domain: # https_only: false # statistics_enabled: false + hmac_key: "CHANGE_ME!!" healthcheck: test: wget -nv --tries=1 --spider http://127.0.0.1:3000/api/v1/comments/jNQXAC9IVRw || exit 1 interval: 30s timeout: 5s retries: 2 + logging: + options: + max-size: "1G" + max-file: "4" depends_on: - invidious-db @@ -91,8 +90,6 @@ volumes: Note: This compose is made for a true "production" setup, where Invidious is behind a reverse proxy. If you prefer to directly access Invidious, replace `127.0.0.1:3000:3000` with `3000:3000` under the `ports:` section. -**The environment variable `POSTGRES_USER` cannot be changed. The SQL config files that run the initial database migrations are hard-coded with the username `kemal`.** - ### Docker-compose method (development) @@ -113,7 +110,7 @@ docker-compose up Follow the instructions for your distribution here: https://crystal-lang.org/install/ -Note: Invidious currently supports the following Crystal versions: `1.4.0` / `1.3.X` / `1.2.X` +Note: Invidious currently supports the following Crystal versions: `1.8.2` / `1.7.X` / `1.6.X` / `1.5.X` / `1.4.1`. #### Install the dependencies @@ -148,15 +145,6 @@ systemctl enable --now postgresql sudo -i -u postgres psql -c "CREATE USER kemal WITH PASSWORD 'kemal';" # Change 'kemal' here to a stronger password, and update `password` in config/config.yml createdb -O kemal invidious -psql invidious kemal < /home/invidious/invidious/config/sql/channels.sql -psql invidious kemal < /home/invidious/invidious/config/sql/videos.sql -psql invidious kemal < /home/invidious/invidious/config/sql/channel_videos.sql -psql invidious kemal < /home/invidious/invidious/config/sql/users.sql -psql invidious kemal < /home/invidious/invidious/config/sql/session_ids.sql -psql invidious kemal < /home/invidious/invidious/config/sql/nonces.sql -psql invidious kemal < /home/invidious/invidious/config/sql/annotations.sql -psql invidious kemal < /home/invidious/invidious/config/sql/playlists.sql -psql invidious kemal < /home/invidious/invidious/config/sql/playlist_videos.sql exit ``` @@ -165,8 +153,14 @@ exit ```bash su - invidious cd invidious -shards install --production -crystal build src/invidious.cr --release +make + +# Configure config/config.yml as you like +cp config/config.example.yml config/config.yml + +# Deploy the database +./invidious --migrate + exit ``` @@ -217,6 +211,8 @@ git clone https://github.com/iv-org/invidious cd invidious shards install --production crystal build src/invidious.cr --release +cp config/config.example.yml config/config.yml +# Configure config/config.yml how you want ``` Note: If the command `crystal build` didn't work properly, you can build Invidious without lsquic may solve compatibilities issues: @@ -236,6 +232,8 @@ Crystal, the programming language used by Invidious, [doesn't support Windows ye Detailed configuration available in the [configuration guide](./configuration.md). +You must set a random generated value for the parameter `hmac_key:`! On Linux you can generate it using the command `pwgen 20 1`. + Because of various issues Invidious **must** be restarted often, at least once a day, ideally every hour. If you use a reverse proxy, you **must** configure invidious to properly serve request through it: @@ -257,11 +255,10 @@ docker image prune -f #### Update a manual install ```bash -sudo - invidious +su - invidious cd invidious git pull -shards install --production -crystal build src/invidious.cr --release +make exit systemctl restart invidious.service ``` diff --git a/docs/instances.md b/docs/instances.md index caa24d8..c02aba5 100644 --- a/docs/instances.md +++ b/docs/instances.md @@ -8,47 +8,69 @@ ## List of public Invidious Instances (sorted from oldest to newest): -* [invidious.snopyta.org](https://invidious.snopyta.org) 🇫🇮 - -* [yewtu.be](https://yewtu.be) 🇳🇱 [![Uptime Robot status](https://img.shields.io/uptimerobot/status/m783898765-2a4efa67aa8d1c7be6b1dd9d)](https://uptime.invidious.io/784257752) - Source code/changes: https://github.com/unixfox/invidious-custom - -* [invidious.kavin.rocks](https://invidious.kavin.rocks) 🇮🇳 [![Uptime Robot status](https://img.shields.io/uptimerobot/status/m786132664-f9fa738fba1c4dc2f7364f71)](https://status.kavin.rocks/786132664) (uses Cloudflare) +* [yewtu.be](https://yewtu.be) 🇳🇱 [![Uptime Robot status](https://img.shields.io/uptimerobot/status/m783898765-2a4efa67aa8d1c7be6b1dd9d)](https://uptime.invidious.io/784257752) - Source code/changes: https://github.com/yewtudotbe/invidious-custom * [vid.puffyan.us](https://vid.puffyan.us) 🇺🇸 [![Uptime Robot status](https://img.shields.io/uptimerobot/status/m786947233-1131c3f67b9a20621b1926d3?style=plastic)](https://stats.uptimerobot.com/n7A08HGVl6/786947233) -* [invidious.namazso.eu](https://invidious.namazso.eu) 🇩🇪 - -* [inv.riverside.rocks](https://inv.riverside.rocks) 🇺🇸 - -* [youtube.076.ne.jp](https://youtube.076.ne.jp) 🇯🇵 - Source code/changes: https://git.076.ne.jp/TechnicalSuwako/invidious-mod - * [yt.artemislena.eu](https://yt.artemislena.eu) 🇩🇪 * [invidious.flokinet.to](https://invidious.flokinet.to) 🇷🇴 -* [invidious.weblibre.org](https://invidious.weblibre.org) 🇨🇱 - -* [invidious.esmailelbob.xyz](https://invidious.esmailelbob.xyz) 🇨🇦 - * [invidious.projectsegfau.lt](https://invidious.projectsegfau.lt) 🇫🇷 [inv.bp.projectsegfau.lt](https://inv.bp.projectsegfau.lt) 🇱🇺 -* [y.com.sb](https://y.com.sb) 🇩🇪 - -* [invidious.sethforprivacy.com](https://invidious.sethforprivacy.com) 🇩🇪 - -* [invidious.tiekoetter.com](https://invidious.tiekoetter.com) 🇩🇪 - -* [invidious.nerdvpn.de](https://invidious.nerdvpn.de) 🇩🇪 - Source code/changes: https://github.com/Sommerwiesel/invidious - -* [inv.vern.cc](https://inv.vern.cc) 🇨🇦 - * [invidious.slipfox.xyz](https://invidious.slipfox.xyz) 🇺🇸 -* [inv.privacy.com.de](https://inv.privacy.com.de) 🇩🇪 +* [invidious.privacydev.net](https://invidious.privacydev.net) 🇫🇷 -* [invidious.rhyshl.live](https://invidious.rhyshl.live) 🇬🇧 (Uses Cloudflare) +* [vid.priv.au](https://vid.priv.au) 🇸🇬 -* [invidio.xamh.de](https://invidio.xamh.de) 🇩🇪 +* [iv.melmac.space](https://iv.melmac.space) 🇩🇪 + +* [iv.ggtyler.dev](https://iv.ggtyler.dev) 🇺🇸 + +* [invidious.lunar.icu](https://invidious.lunar.icu) 🇩🇪 (uses Cloudflare) + +* [inv.zzls.xyz](https://inv.zzls.xyz) 🇨🇱 + +* [inv.tux.pizza](https://inv.tux.pizza) 🇺🇸 + +* [invidious.protokolla.fi](https://invidious.protokolla.fi) 🇫🇮 + +* [onion.tube](https://onion.tube) 🇯🇵 (uses Cloudflare) + +* [inv.in.projectsegfau.lt](https://inv.in.projectsegfau.lt) 🇮🇳 + +* [inv.citw.lgbt](https://inv.citw.lgbt) 🇳🇱 + +* [yt.oelrichsgarcia.de](https://yt.oelrichsgarcia.de) 🇩🇪 (uses Cloudflare) + +* [invidious.no-logs.com](https://invidious.no-logs.com) 🇸🇪 + +* [invidious.io.lol](https://invidious.io.lol) 🇺🇸 + +* [iv.nboeck.de](https://iv.nboeck.de) 🇫🇮 + +* [invidious.private.coffee](https://invidious.private.coffee) 🇦🇹 + +* [yt.drgnz.club](https://yt.drgnz.club) 🇨🇿 + +* [invidious.asir.dev](https://invidious.asir.dev) 🇺🇸 + +* [iv.datura.network](https://iv.datura.network) 🇩🇪 + +* [invidious.fdn.fr](https://invidious.fdn.fr) 🇫🇷 + +* [anontube.lvkaszus.pl](https://anontube.lvkaszus.pl) 🇩🇪 + +* [invidious.perennialte.ch](https://invidious.perennialte.ch) 🇦🇺 (uses Cloudflare) + +* [yt.cdaut.de](https://yt.cdaut.de) 🇩🇪 + +* [invidious.drgns.space](https://invidious.drgns.space) 🇺🇸 + +* [inv.us.projectsegfau.lt](https://inv.us.projectsegfau.lt) 🇺🇸 + +* [invidious.einfachzocken.eu](https://invidious.einfachzocken.eu) 🇩🇪 (uses Cloudflare) ### Tor Onion Services: * [c7hqkpkpemu6e7emz5b4vyz7idjgdvgaaa3dyimmeojqbgpea3xqjoid.onion](http://c7hqkpkpemu6e7emz5b4vyz7idjgdvgaaa3dyimmeojqbgpea3xqjoid.onion) 🇫🇮 (Onion of invidious.snopyta.org) @@ -61,15 +83,31 @@ * [osbivz6guyeahrwp2lnwyjk2xos342h4ocsxyqrlaopqjuhwn2djiiyd.onion](http://osbivz6guyeahrwp2lnwyjk2xos342h4ocsxyqrlaopqjuhwn2djiiyd.onion) 🇳🇱 (Onion of invidious.hub.ne.kr) -* [u2cvlit75owumwpy4dj2hsmvkq7nvrclkpht7xgyye2pyoxhpmclkrad.onion](http://u2cvlit75owumwpy4dj2hsmvkq7nvrclkpht7xgyye2pyoxhpmclkrad.onion) 🇺🇸 (Onion of inv.riverside.rocks) +* [u2cvlit75owumwpy4dj2hsmvkq7nvrclkpht7xgyye2pyoxhpmclkrad.onion](http://u2cvlit75owumwpy4dj2hsmvkq7nvrclkpht7xgyye2pyoxhpmclkrad.onion) 🇺🇸 (Onion of inv.riverside.rocks) * [euxxcnhsynwmfidvhjf6uzptsmh4dipkmgdmcmxxuo7tunp3ad2jrwyd.onion](http://euxxcnhsynwmfidvhjf6uzptsmh4dipkmgdmcmxxuo7tunp3ad2jrwyd.onion/) 🇩🇪 (Onion of invidious.sethforprivacy.com) -* [invidious.lqs5fjmajyp7rvp4qvyubwofzi6d4imua7vs237rkc4m5qogitqwrgyd.onion](http://invidious.lqs5fjmajyp7rvp4qvyubwofzi6d4imua7vs237rkc4m5qogitqwrgyd.onion) 🇨🇦 (Onion of invidious.esmailelbob.xyz) +* [ng27owmagn5amdm7l5s3rsqxwscl5ynppnis5dqcasogkyxcfqn7psid.onion](http://ng27owmagn5amdm7l5s3rsqxwscl5ynppnis5dqcasogkyxcfqn7psid.onion) 🇩🇪 (Onion of yt.artemislena.eu) -* [inv.vernccvbvyi5qhfzyqengccj7lkove6bjot2xhh5kajhwvidqafczrad.onion](http://inv.vernccvbvyi5qhfzyqengccj7lkove6bjot2xhh5kajhwvidqafczrad.onion/) 🇨🇦 (Onion of inv.vern.cc) +* [iv.odysfvr23q5wgt7i456o5t3trw2cw5dgn56vbjfbq2m7xsc5vqbqpcyd.onion](http://iv.odysfvr23q5wgt7i456o5t3trw2cw5dgn56vbjfbq2m7xsc5vqbqpcyd.onion) 🇫🇷 (Onion of inv.odyssey346.dev) -* [am74vkcrjp2d5v36lcdqgsj2m6x36tbrkhsruoegwfcizzabnfgf5zyd.onion](http://am74vkcrjp2d5v36lcdqgsj2m6x36tbrkhsruoegwfcizzabnfgf5zyd.onion) 🇺🇸 (Onion of invidious.slipfox.xyz) +* [invidious.g4c3eya4clenolymqbpgwz3q3tawoxw56yhzk4vugqrl6dtu3ejvhjid.onion](http://invidious.g4c3eya4clenolymqbpgwz3q3tawoxw56yhzk4vugqrl6dtu3ejvhjid.onion) 🇫🇷 (Onion of invidious.privacydev.net) + +* [http://inv.pjsfkvpxlinjamtawaksbnnaqs2fc2mtvmozrzckxh7f3kis6yea25ad.onion](http://inv.pjsfkvpxlinjamtawaksbnnaqs2fc2mtvmozrzckxh7f3kis6yea25ad.onion) 🇫🇷 (Onion of invidious.projectsegfau.lt) + +* [http://invbp.pjsfkvpxlinjamtawaksbnnaqs2fc2mtvmozrzckxh7f3kis6yea25ad.onion](http://invbp.pjsfkvpxlinjamtawaksbnnaqs2fc2mtvmozrzckxh7f3kis6yea25ad.onion) 🇱🇺 (Onion of inv.bp.projectsegfau.lt) + +* [invidiousge2cq2qegp4vdzsfu6mvpqdf6dtcyzmqbv7yx2spvkkajad.onion](http://invidiousge2cq2qegp4vdzsfu6mvpqdf6dtcyzmqbv7yx2spvkkajad.onion) 🇸🇬 (Onion of vid.priv.au) + +* [http://inv.zzlsghu6mvvwyy75mvga6gaf4znbp3erk5xwfzedb4gg6qqh2j6rlvid.onion](http://inv.zzlsghu6mvvwyy75mvga6gaf4znbp3erk5xwfzedb4gg6qqh2j6rlvid.onion) 🇨🇱 (Onion of inv.zzls.xyz) + +### I2P Eepsites: + +* [http://pjsfhqamc7k6htnumrvn4cwqqdoggeepj7u5viyimgnxg3gar72q.b32.i2p](http://pjsfhqamc7k6htnumrvn4cwqqdoggeepj7u5viyimgnxg3gar72q.b32.i2p) 🇫🇷 (Eepsite of invidious.projectsegfau.lt) + +* [http://pjsfi2szfkb4guqzmfmlyq4no46fayertjrwt4h2uughccrh2lvq.b32.i2p](http://pjsfi2szfkb4guqzmfmlyq4no46fayertjrwt4h2uughccrh2lvq.b32.i2p) 🇱🇺 (Eepsite of inv.bp.projectsegfau.lt) + +* [zzlsbhhfvwg3oh36tcvx4r7n6jrw7zibvyvfxqlodcwn3mfrvzuq.b32.i2p](http://zzlsbhhfvwg3oh36tcvx4r7n6jrw7zibvyvfxqlodcwn3mfrvzuq.b32.i2p) 🇨🇱 (Eepsite of inv.zzls.xyz) * [ng27owmagn5amdm7l5s3rsqxwscl5ynppnis5dqcasogkyxcfqn7psid.onion](http://ng27owmagn5amdm7l5s3rsqxwscl5ynppnis5dqcasogkyxcfqn7psid.onion) 🇩🇪 (Onion of yt.artemislena.eu) @@ -86,9 +124,10 @@ 9. Instances MUST NOT use any type of analytics. 10. Any system whose goal is to modify the content served to the user (i.e web server HTML rewrite) is considered the same as modifying the source code. 11. Instances running a modified source code: - - MUST respect the AGPL by publishing their source code and stating their changes **before** they are be added to the list + - MUST respect the AGPL by publishing their source code and stating their changes **before** they are added to the list - MUST publish any later modification in a timely manner - MUST contain a link to both the modified and original source code of Invidious in the footer. 12. Instances MUST NOT serve ads (sponsorship links in the banner are considered ads) NOR promote products. +13. Instances MUST NOT restrict or disallow the access / usage to any [natural person](https://en.wikipedia.org/wiki/Natural_person) (eg. a country's IP range MUST NOT be blocked, access by a natural person MUST NOT be disallowed for arbirary reason) - this rule doesn't apply to [juridical persons](https://en.wikipedia.org/wiki/Juridical_person). -**NOTE:** We reserve the right to decline any instance from being added to the list, and to remove or ban any instance that repeatedly breaks the aforementioned rules. +**NOTE:** We reserve the right to decline any instance from being added to the list, and to remove / ban any instance breaking the aforementioned rules. diff --git a/docs/ipv6-rotator.md b/docs/ipv6-rotator.md new file mode 100644 index 0000000..0aa4fa9 --- /dev/null +++ b/docs/ipv6-rotator.md @@ -0,0 +1,128 @@ +# Rotate your IPv6 address for escaping YouTube blocking + +This tutorial has been written by [unixfox](https://github.com/unixfox), owner of [yewtu.be](https://yewtu.be/). He is better suited when looking for help about this tutorial. + +## Synopsis + +YouTube has started to periodically block the public Invidious instances since the start of June 2023 ([iv-org/invidious/issues/3872](https://github.com/iv-org/invidious/issues/3872)) and they have become more aggressive about it since the start of August 2023 ([iv-org/invidious/issues/4045](https://github.com/iv-org/invidious/issues/4045)). + +Thanks to IPv6 you can easily escape this block because there are many IP addresses in a single /64 IPv6 range. (18,446,744,073,709,551,616 IP addresses to be precise) + +This tutorial will explain how to automatically and periodically rotate your IPv6 address. Also some notes about how to have IPv6 in case your provider does not offer it. + +## Requirements +#### 1) IPv6 support on your server +##### Testing +You can easily find out if you have IPv6 by executing the command: +``` +curl -m 5 ipv6.icanhazip.com +``` +If you do not have any errors, then congratulation, you can continue to [the second requirement](#2-system-packages-requirement)! + +If you do have an error (timeout or no route to host), then you will need to enable IPv6 support on your server. +Depending on your provider and if it does support IPv6, you may have to configure your server for IPv6. Check the documentation of your provider. + +##### Other solutions if you do not have IPv6 support + +###### 1) Switch to another provider + +If your provider does not support IPv6 then you can either switch to another provider that support IPv6. +There are many today that do support it, here is a non-exhaustive list of them (**this is not recommendation, just a list of the popular providers that support IPv6**): +Hetzner, BuyVM, Scaleway, OVH, DigitalOcean, Vultr, Incognet, Netcup and more. +Larger list: https://www.serverhunter.com/#query=ips%3Aipv6 + +###### 2) Use an IPv6 tunnelbroker or make one yourself + +The alternative, if you do not want to switch provider, is to use an IPv6 tunnelbroker, it allows to get IPv6 connectivity using another server. + +This website lists all the free and paid existing tunnelbrokers: https://tunnelbroker.services/. **We do not recommend running a public instance on a free tunnelbroker as this would put a lot of strain on their network because video streaming consumes a lot of bandwidth.** + +You can also use an external server (from another provider that do support IPv6) for acting as an IPV6 tunnel for your main server. Wireguard is perfectly suited for that. +All of this is out of scope of this tutorial, please consult the internet for tutorials. + +#### 2) System packages requirement +Please install: + +- python requests library. + Debian/Ubuntu: `sudo apt install python3-requests` + RHEL/CentOS/Fedora: `sudo dnf install python-requests` + Other Linux distributions: `sudo yourpackagemanager install python-requests` +- python pyroute2 library. + Debian/Ubuntu: `sudo apt install python3-pyroute2` + RHEL/CentOS/Fedora: `sudo dnf install python-pyroute2` + Other Linux distributions: `sudo yourpackagemanager install python-pyroute2` + +## Configure Invidious for IPv6 +### If you are running Invidious outside of Docker or using something else than Docker (K8s) +You probably have nothing to do! + +Except checking in your config.yml if you do not have this line set, if so remove it: +```yaml +force_resolve: ipv4 +``` + +Or if you are on Kubernetes, check that your pods have IPv6 connectivity. But you probably already know that if you are using Kubernetes. + +### If you are running Invidious in Docker +Note: Make sure you are running a recent version of Docker if you are running into IPv6 issues. + +1. Follow the steps 1 to 3 on the official documentation for Docker: https://docs.docker.com/config/daemon/ipv6/ +2. In your docker-compose file of invidious. Add these lines at the end of your docker-compose + ```yaml + networks: + default: + enable_ipv6: true + ipam: + config: + - subnet: fd01:db8:a::/64 + gateway: fd01:db8:a::1 + + ``` +3. Bring down your docker composition and bring it back up for recreating the network: + ``` + docker compose down + docker compose up -d + ``` +4. To check if everything went well then do: + ``` + docker compose exec invidious ping -c 1 ipv6.icanhazip.com + ``` + If you do not get any error then you can jump to the next step. +5. **Finally**, check if you do not have this line configured in your `config.yml`, if so remove it: + ```yaml + force_resolve: ipv4 + ``` + +## Configure the IPv6 rotator (made by Invidious team) +This tool was developed by the Invidious team, and it's the official tool for rotating your IPv6 address on Invidious: https://github.com/iv-org/smart-ipv6-rotator. +It may be used on other projects that depend on YouTube and/or Google (example: Piped or SearXNG). + +1. Make sure you have installed all the python libraries from [the "requirements"](#requirements). +2. Clone the repository somewhere that you like (not inside the invidious directory): + ``` + git clone https://github.com/iv-org/smart-ipv6-rotator.git + ``` +3. Find the IPv6 subnet of your server, usually it's written on your provider website. + But you can easily find it using this tool: http://www.gestioip.net/cgi-bin/subnet_calculator.cgi. + Enter the main IPv6 address, select IPv6 and change the prefix length only if it's not a /64. + Use the command `ip a` to get the detail of your IPv6 network configuration. +4. Run the script once like this (don't use sudo if you are already root): + ``` + sudo python smart-ipv6-rotator.py run --ipv6range=YOURIPV6SUBNET/64 + ``` +5. If everything went well, then configure a cron to periodically rotate your IPv6 range. Twice a day (noon and midnight) is enough for YouTube servers. Also at the reboot of the server! + Example crontab (`crontab -e -u root`): + ``` + @reboot sleep 30s && python /path/to/the/script/smart-ipv6-rotator.py run --ipv6range=YOURIPV6SUBNET/64 + 0 */12 * * * python /path/to/the/script/smart-ipv6-rotator.py run --ipv6range=YOURIPV6SUBNET/64 + ``` + The `sleep` command is used in case your network takes too much time time to be ready. + +That's it! + +If the script does not work for you, it could be that: + +- Your provider does not allow you to assign any arbitrary IPv6 address, it's common for cloud providers like AWS, Oracle Cloud, Google Cloud where you need to manually assign the IPv6 address from the panel. +- You have not correctly set your IPv6 subnet range. In such case, please ask for help on IRC or Matrix or in a GitHub issue. + +If you find any other issues, please open a bug report there: https://github.com/iv-org/smart-ipv6-rotator/issues diff --git a/docs/nginx.md b/docs/nginx.md index 08ce8d3..e327167 100644 --- a/docs/nginx.md +++ b/docs/nginx.md @@ -1,4 +1,4 @@ -# NginX Reverse Proxy +# NGINX reverse proxy setup This is a very basic config, secured with Let's Encrypt. Any log is disabled by default. Do not forget to replace `server_name` with your domain. diff --git a/docs/proxy-videos.md b/docs/proxy-videos.md index 967f295..6fb9d49 100644 --- a/docs/proxy-videos.md +++ b/docs/proxy-videos.md @@ -1,4 +1,4 @@ -# Always use "local" to proxy video through the server without creating an account +# UserScript to always proxy video Download ViolentMonkey for your Browser: [Firefox](https://addons.mozilla.org/en-US/firefox/addon/violentmonkey/) diff --git a/docs/redirector.md b/docs/redirector.md new file mode 100644 index 0000000..de24237 --- /dev/null +++ b/docs/redirector.md @@ -0,0 +1,111 @@ +# Redirector setup + +# What is Redirector? + +Redirector is a Browser extension for Firefox and Chromium that can manually be configured to redirect links, such as YouTube to Invidious or [Twitter to Nitter](https://github.com/zedeus/nitter/wiki/Extensions#redirector) + +Get Redirector: [Firefox](https://addons.mozilla.org/en-US/firefox/addon/redirector/) — [Chromium-based](https://chrome.google.com/webstore/detail/redirector/ocgpenflpmgnfapjedencafcfakcekcd) — [GitHub](https://github.com/einaregilsson/Redirector) + +All of these rules are made with Wildcard Processing. + +# How to use it for Invidious Redirects? + +For basic redirects, you will need the following rules set up. + +# Rule 1 (Redirect Video URLs) + +Redirect ```https://*youtube.com/watch?*v=*``` + to: ```https://[Invidious Domain Here]/watch?$2v=$3``` + Example: ```https://www.youtube.com/watch?v=Lz13cxZNTCo``` → https://[Invidious Domain Here]/watch?v=Lz13cxZNTCo + Applies to: Main window (address bar) + +# Rule 2 (Redirects the youtu.be domain, typically accociated with URLs generated by the "Share" button) + +Redirect: ```https://youtu.be/*``` +to: ```https://[Invidious Domain Here]/watch?v=$1``` +Example: ```https://youtu.be/Ae5yV4p7uh8?t=35``` → https://[Invidious Domain Here]/watch?v=Ae5yV4p7uh8?t=35 +Applies to: Main window (address bar) + +# Rule 3 (Redirects Search Results, useful for those who use DDG bangs or search extensions to search YouTube and would like those properly redirected to Invidious) + +Redirect: ```https://www.youtube.com/results?search_query=*&page``` +to: ```https://[Invidious Domain Here]/search?q=$1``` +Example: ```https://www.youtube.com/results?search_query=Smash+Bros+Trailer&page``` → https://[Invidious Domain Here]/search?q=Smash+Bros+Trailer +Applies to: Main window (address bar) + + +# Rule 4 (Redirects the YouTube Domain itself, IE: channel pages and the homepage) + +Redirect: ```https://*.youtube.com/*``` +to: ```https://[Invidious Domain Here]/$2``` +Example: ```https://www.youtube.com/channel/UCOkL7q2SeGZeZuj22njMYEA``` → https://[Invidious Domain Here]/channel/UCOkL7q2SeGZeZuj22njMYEA +Applies to: Main window (address bar) + +# How to use it for Invidious URL Parameters? + +If you would like to use URL Parameters in your redirects (see [here](https://github.com/cloudrac3r/invidious-documentation/blob/master/List-of-URL-parameters.md)), you will need to manually add them to the preceding rules (https://[Invidious Domain Here]/watch?v=$1[URL Parameters here] in place of https://[Invidious Domain Here]/watch?v=$1). + +For clarity, an example of a URL parameter would be &related_videos=false&comments=false to ensure that neither related videos nor comments are displayed on a video page, so ```https://[Invidious Domain Here]/watch?v=$1&related_videos=false&comments=false``` would be the destination of redirects. + +For redirects with ? in the URL, the Parameter string will start with &, while redirects without ? in the URL should have a Parameter string begining with ?, so https://[Invidious Domain Here]/$2 becomes ```https://[Invidious Domain Here]/$2?related_videos=false&comments=false``` + +Should you choose to use URL Parameters, I would reccomend adding the following rules to both ensure all invidious videos load with your preference, and to ensure that unnecesary parameters are not added when already applied. + +# Rule 5 (Redirects Invidious Video URLs with parameters) + +Redirect: ```https://[Invidious Domain Here]/watch?v=*``` +to: ```https://[Invidious Domain Here]/watch?v=$1[URL Parameters here]``` +excluding: ```https://[Invidious Domain Here]/watch?v=*[URL Parameters here]``` +Example: ```https://[Invidious Domain Here]/watch?v=Lz13cxZNTCo``` → https://[Invidious Domain Here]/watch?v=Lz13cxZNTCo[URL Parameters here] +Applies to: Main window (address bar) + +# Rule 6 (Redirects Invidious Domain URLs with parameters) + +Redirect: ```https://[Invidious Domain Here]/*``` +to: ```https://[Invidious Domain Here]/$1[URL Parameters here]``` +excluding: ```https://[Invidious Domain Here]/*[URL Parameters here]``` +Example: ```https://[Invidious Domain Here]/``` → https://[Invidious Domain Here]/[URL Parameters here] +Applies to: Main window (address bar) + +It is important that you add the exceptions so as not to create infinite repeats of the same URL Parameters when opening multiple Invidious Videos in a single session. When creating or editing rules in Redirector you must access "Advanced Options" in order to set exceptions. + +# How to use it for Redirecting Embeds? + +For redirecting embeds, you'll need the following two rules. (Note, it is imparative that you check these two roles apply to both the Main Window and IFrames, otherwise the rule won't apply to Embeds). + +# Rule 7 (For redirecting standard embed links) + +Redirect: ```https://www.youtube.com/embed/*``` +to: ```https://[Invidious Domain Here]/embed/$1``` +Example: ```https://www.youtube.com/embed/Lz13cxZNTCo``` → https://[Invidious Domain Here]/embed/Lz13cxZNTCo +Applies to: Main window (address bar), IFrames + +# Rule 8 (For redirecting nocookie embeds) + +Redirect: ```https://www.youtube-nocookie.com/embed/*``` +to: ```https://[Invidious Domain Here]/embed/$1``` +Example: ```https://www.youtube-nocookie.com/embed/Lz13cxZNTCo``` → https://[Invidious Domain Here]/embed/Lz13cxZNTCo +Applies to: Main window (address bar), IFrames + + + +# How to use it to redirect Invidious Feeds to YouTube Feeds? + +Finally, if you like to subscribe to channels using RSS feeds, the following two rules will redirect Invidious RSS feeds to their YouTube equivelants. This way you'll still have access to your feeds should you need to migrate to another instance. + +# Rule 9 (For redirecting channel feeds) + +Redirect: ```https://[Invidious Domain Here]/feed/channel/*``` +to: ```https://www.youtube.com/feeds/videos.xml?channel_id=$1``` +Example: ```https://[Invidious Domain Here]/feed/channel/UCOkL7q2SeGZeZuj22njMYEA``` → https://www.youtube.com/feeds/videos.xml?channel_id=UCOkL7q2SeGZeZuj22njMYEA +Applies to: Main window (address bar) + +# Rule 10 (For redirecting playlist feeds) + +Redirect: ```https://[Invidious Domain Here]/feed/playlist/*``` +to: ```https://www.youtube.com/feeds/videos.xml?playlist_id=$1``` +Example: ```https://[Invidious Domain Here]/feed/playlist/PLY_6uAtgkYXl1sPyzNa2UFQYgPj2qA-qj``` → https://www.youtube.com/feeds/videos.xml?playlist_id=PLY_6uAtgkYXl1sPyzNa2UFQYgPj2qA-qj +Applies to: Main window (address bar) + + + diff --git a/docs/reset-password.md b/docs/reset-password.md new file mode 100644 index 0000000..8147677 --- /dev/null +++ b/docs/reset-password.md @@ -0,0 +1,25 @@ +# Reset user password + +Resetting a user's invidious password needs you to edit the database. + +Firstly, generate a bcrypt-encrypted hash for the new password you want to set for the user. + +This can be done with the `bcrypt` python module, though there are other ways of doing the same. + +``` +python3 -c 'import bcrypt; print(bcrypt.hashpw(b"", bcrypt.gensalt(rounds=10)).decode("ascii"))' +``` + +To do so, first attach to the database: +``` +# su - postgres +$ psql +postgres=# \c invidious +``` + +Now, run the following SQL query: +``` +UPDATE users SET password = 'HASH' WHERE email = 'USERNAME'; +``` + +After that, the password should be reset. diff --git a/docs/search-filters.md b/docs/search-filters.md index 594df63..b5abdd1 100644 --- a/docs/search-filters.md +++ b/docs/search-filters.md @@ -1,4 +1,4 @@ -# Search operators +# Search filters Invidious supports the various search filters provided by YouTube. diff --git a/docs/takedown.md b/docs/takedown.md index 924ad07..3d92bfe 100644 --- a/docs/takedown.md +++ b/docs/takedown.md @@ -1,4 +1,4 @@ -# Takedown Notices +# Handling takedown notices If you are running a public Invidious instance, it is very possible that you will end up receiving a takedown notice at some point. A copyright agent will probably search the ID of an infringing video on a search engine and see your instance appear. At least in the United States and in Europe, Invidious instances are, in theory, legal. @@ -6,6 +6,8 @@ Do note that most requests are invalid and technically illegal since they aren't To counter them "easily", we decided to provide templates depending on where your instance is located. +Or if you want to hide your instance from takedown requests, you can also follow this tutorial: https://docs.invidious.io/hide-instance-behind-proxy-server/. + ## Template - United States ``` diff --git a/docs/umatrix.md b/docs/umatrix.md index 4f9d358..5ce7cb4 100644 --- a/docs/umatrix.md +++ b/docs/umatrix.md @@ -1,4 +1,4 @@ -# How to deal with uMatrix +# uMatrix setup If you're using [uMatrix](https://github.com/gorhill/uMatrix), you won't be able to automatically play a video served by Invidious on other websites without unblocking requests to Invidious instances. diff --git a/docs/url-parameters.md b/docs/url-parameters.md index 4301573..1caf7cd 100644 --- a/docs/url-parameters.md +++ b/docs/url-parameters.md @@ -1,4 +1,4 @@ -# List of URL parameters +# URL parameters A list of URL parameters for Invidious, which can automatically toggle various UI and player settings. @@ -52,8 +52,10 @@ _This list is incomplete. You can help by expanding it._ | `quality=dash` | [DASH](https://en.wikipedia.org/wiki/Dynamic_Adaptive_Streaming_over_HTTP) | | `quality=hd720` | 720p | | `quality=medium` | 480p | -| _Related Videos_ | Show "Related videos" tab on the right-hand side | -| `related_videos=false` | Disabled | +| _Related Videos_ | Show "Related videos" tab on the right-hand side | +| `related_videos=false` | Disabled | +| _Comments_ | Show comments below the video| +| `comments=false` | Disabled | | _Speed_ | Default player speed, can be any positive number | | `speed=0.5` | Play at 0.5x speed | | `speed=2` | Play at 2x speed | @@ -91,4 +93,4 @@ _This list is incomplete. You can help by expanding it._ | `region=DE` | Load videos that are trending in Germany | | **Player Style** | | | `player_style=invidious` | Invidious, the default | -| `player_style=youtube` | YouTube, using a centered play button and always visible video control bar | \ No newline at end of file +| `player_style=youtube` | YouTube, using a centered play button and always visible video control bar | diff --git a/mkdocs.yml b/mkdocs.yml index 6bd7587..2e5ee63 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -10,40 +10,64 @@ nav: - Home: 'index.md' - 'General': - 'instances.md' - - 'export-youtube-subscriptions.md' - - 'preferences.md' - 'applications.md' + - 'export-youtube-subscriptions.md' + - 'faq.md' + - 'For Advanced Users': + - 'preferences.md' - 'search-filters.md' - 'url-parameters.md' - 'proxy-videos.md' - 'geoblocking.md' - 'umatrix.md' - - 'known-exception.md' - - 'faq.md' + - 'redirector.md' - 'For Administrators': - 'installation.md' - 'configuration.md' - - 'apache2.md' - 'nginx.md' + - 'caddy.md' + - 'apache2.md' - 'db-maintenance.md' + - 'takedown.md' + - 'hide-instance-behind-proxy-server.md' + - 'ipv6-rotator.md' - 'captcha-bug.md' - 'anti-captcha.md' - - 'takedown.md' + - 'reset-password.md' + - 'known-exception.md' - 'For Developers': - 'api.md' - - 'authenticated-endpoints.md' + - 'api/common_types.md' + - 'api/channels_endpoint.md' + - 'api/authenticated-endpoints.md' theme: name: material font: false - palette: - primary: black + + palette: + # Light mode + - media: "(prefers-color-scheme: light)" + scheme: default + primary: black + toggle: + icon: material/brightness-7 + name: Switch to dark mode + # Dark mode + - media: "(prefers-color-scheme: dark)" + scheme: slate + primary: black + toggle: + icon: material/brightness-4 + name: Switch to light mode + logo: images/invidious.png # https://squidfunk.github.io/mkdocs-material/setup/changing-the-logo-and-icons/#logo favicon: images/favicon.ico # https://squidfunk.github.io/mkdocs-material/setup/changing-the-logo-and-icons/#favicon features: - navigation.tracking # https://squidfunk.github.io/mkdocs-material/setup/setting-up-navigation/#anchor-tracking - navigation.expand # https://squidfunk.github.io/mkdocs-material/setup/setting-up-navigation/#navigation-expansion - navigation.top # https://squidfunk.github.io/mkdocs-material/setup/setting-up-navigation/#back-to-top-button + - content.code.copy # https://squidfunk.github.io/mkdocs-material/reference/code-blocks/#code-copy-button extra: social: @@ -52,3 +76,9 @@ extra: markdown_extensions: - pymdownx.magiclink + - pymdownx.highlight: + anchor_linenums: true + - pymdownx.inlinehilite + - pymdownx.snippets + - pymdownx.superfences + - pymdownx.details # https://facelessuser.github.io/pymdown-extensions/extensions/details/