summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.github/workflows/stale.yml2
-rw-r--r--README.md2
-rw-r--r--assets/css/default.css2
-rw-r--r--assets/css/player.css11
-rw-r--r--locales/ar.json3
-rw-r--r--locales/cs.json3
-rw-r--r--locales/en-US.json3
-rw-r--r--locales/es.json4
-rw-r--r--locales/fr.json2
-rw-r--r--locales/hr.json3
-rw-r--r--locales/id.json7
-rw-r--r--locales/it.json3
-rw-r--r--locales/ko.json79
-rw-r--r--locales/sl.json3
-rw-r--r--locales/tr.json3
-rw-r--r--locales/uk.json3
-rw-r--r--locales/zh-CN.json3
-rw-r--r--locales/zh-TW.json3
-rw-r--r--src/invidious/comments.cr11
-rw-r--r--src/invidious/routes/embed.cr10
-rw-r--r--src/invidious/views/licenses.ecr18
-rw-r--r--src/invidious/views/template.ecr2
-rw-r--r--src/invidious/views/watch.ecr2
-rw-r--r--src/invidious/yt_backend/connection_pool.cr17
-rw-r--r--src/invidious/yt_backend/youtube_api.cr207
25 files changed, 311 insertions, 95 deletions
diff --git a/.github/workflows/stale.yml b/.github/workflows/stale.yml
index ff28d49b..11168aea 100644
--- a/.github/workflows/stale.yml
+++ b/.github/workflows/stale.yml
@@ -22,3 +22,5 @@ jobs:
stale-issue-label: "stale"
stale-pr-label: "stale"
ascending: true
+ # Never mark feature requests/enhancements as stale
+ exempt-issue-labels: "feature-request,enhancement"
diff --git a/README.md b/README.md
index 6068a66b..8d668a29 100644
--- a/README.md
+++ b/README.md
@@ -147,7 +147,7 @@ Weblate also allows you to log-in with major SSO providers like Github, Gitlab,
- [FreeTube](https://github.com/FreeTubeApp/FreeTube): A libre software YouTube app for privacy.
- [CloudTube](https://sr.ht/~cadence/tube/): A JavaScript-rich alternate YouTube player.
-- [PeerTubeify](https://gitlab.com/Cha_deL/peertubeify): On YouTube, displays a link to the same video on PeerTube, if it exists.
+- [PeerTubeify](https://gitlab.com/Cha_de_L/peertubeify): On YouTube, displays a link to the same video on PeerTube, if it exists.
- [MusicPiped](https://github.com/deep-gaurav/MusicPiped): A material design music player that streams music from YouTube.
- [HoloPlay](https://github.com/stephane-r/HoloPlay): Funny Android application connecting on Invidious API's with search, playlists and favorites.
- [WatchTube](https://github.com/WatchTubeTeam/WatchTube): Powerful YouTube client for Apple Watch.
diff --git a/assets/css/default.css b/assets/css/default.css
index 9ffff960..ab2b79e6 100644
--- a/assets/css/default.css
+++ b/assets/css/default.css
@@ -213,7 +213,7 @@ img.thumbnail {
}
.searchbar input[type="search"]:focus {
- margin: 0 0 0.5px 0;
+ margin: 0;
border: 2px solid;
border-color: rgba(0,0,0,0);
border-bottom-color: #FED;
diff --git a/assets/css/player.css b/assets/css/player.css
index 8a7cfdab..50c7a748 100644
--- a/assets/css/player.css
+++ b/assets/css/player.css
@@ -34,7 +34,7 @@
.video-js.player-style-youtube .vjs-control-bar > .vjs-spacer {
flex: 1;
order: 2;
-}
+}
.video-js.player-style-youtube .vjs-play-progress .vjs-time-tooltip {
display: none;
@@ -175,11 +175,14 @@ ul.vjs-menu-content::-webkit-scrollbar {
.video-js.player-style-invidious .vjs-play-progress {
background-color: rgba(0, 182, 240, 1);
}
-vjs-menu-content
+
/* Overlay */
.video-js .vjs-overlay {
- background-color: rgba(35, 35, 35, 0.75);
- color: rgba(255, 255, 255, 1);
+ background-color: rgba(35, 35, 35, 0.75) !important;
+}
+.video-js .vjs-overlay * {
+ color: rgba(255, 255, 255, 1) !important;
+ text-align: center;
}
/* ProgressBar marker */
diff --git a/locales/ar.json b/locales/ar.json
index 38963281..fbe88b03 100644
--- a/locales/ar.json
+++ b/locales/ar.json
@@ -535,5 +535,6 @@
"generic_count_seconds_2": "{{count}} ثانية",
"generic_count_seconds_3": "{{count}} ثانية",
"generic_count_seconds_4": "{{count}} ثوانٍ",
- "generic_count_seconds_5": "{{count}} ثانية"
+ "generic_count_seconds_5": "{{count}} ثانية",
+ "error_video_not_in_playlist": "الفيديو المطلوب غير موجود في قائمة التشغيل هذه. <a href=\"`x`\"> انقر هنا للحصول على الصفحة الرئيسية لقائمة التشغيل. </a>"
}
diff --git a/locales/cs.json b/locales/cs.json
index 97f108d7..7538365a 100644
--- a/locales/cs.json
+++ b/locales/cs.json
@@ -487,5 +487,6 @@
"search_filters_sort_label": "Řadit dle",
"search_filters_sort_option_relevance": "Relevantnost",
"search_filters_apply_button": "Použít vybrané filtry",
- "Popular enabled: ": "Populární povoleno: "
+ "Popular enabled: ": "Populární povoleno: ",
+ "error_video_not_in_playlist": "Požadované video v tomto playlistu neexistuje. <a href=\"`x`\">Klikněte sem pro navštívení domovské stránky playlistu.</a>"
}
diff --git a/locales/en-US.json b/locales/en-US.json
index 9701a621..5554b928 100644
--- a/locales/en-US.json
+++ b/locales/en-US.json
@@ -471,5 +471,6 @@
"crash_page_switch_instance": "tried to <a href=\"`x`\">use another instance</a>",
"crash_page_read_the_faq": "read the <a href=\"`x`\">Frequently Asked Questions (FAQ)</a>",
"crash_page_search_issue": "searched for <a href=\"`x`\">existing issues on GitHub</a>",
- "crash_page_report_issue": "If none of the above helped, please <a href=\"`x`\">open a new issue on GitHub</a> (preferably in English) and include the following text in your message (do NOT translate that text):"
+ "crash_page_report_issue": "If none of the above helped, please <a href=\"`x`\">open a new issue on GitHub</a> (preferably in English) and include the following text in your message (do NOT translate that text):",
+ "error_video_not_in_playlist": "The requested video doesn't exist in this playlist. <a href=\"`x`\">Click here for the playlist home page.</a>"
}
diff --git a/locales/es.json b/locales/es.json
index 0958a736..c427e81a 100644
--- a/locales/es.json
+++ b/locales/es.json
@@ -470,5 +470,7 @@
"tokens_count": "{{count}} token",
"tokens_count_plural": "{{count}} tokens",
"search_message_use_another_instance": " También puede <a href=\"`x`\">buscar en otra instancia</a>.",
- "search_filters_duration_option_medium": "Medio (4 - 20 minutes)"
+ "search_filters_duration_option_medium": "Medio (4 - 20 minutes)",
+ "Popular enabled: ": "¿Habilitar la sección popular? ",
+ "error_video_not_in_playlist": "El vídeo solicitado no existe en esta lista de reproducción. <a href=\"`x`\">Haga clic aquí para acceder a la página de inicio de la lista de reproducción.</a>"
}
diff --git a/locales/fr.json b/locales/fr.json
index 928a4400..e526648f 100644
--- a/locales/fr.json
+++ b/locales/fr.json
@@ -116,7 +116,7 @@
"preferences_default_home_label": "Page d'accueil par défaut : ",
"preferences_feed_menu_label": "Préferences des abonnements : ",
"preferences_show_nick_label": "Afficher le nom d'utilisateur en haut à droite : ",
- "Popular enabled: ": "Page \"populaire\" activée: ",
+ "Popular enabled: ": "Page \"populaire\" activée : ",
"Top enabled: ": "Top activé : ",
"CAPTCHA enabled: ": "CAPTCHA activé : ",
"Login enabled: ": "Autoriser l'ouverture de sessions utilisateur : ",
diff --git a/locales/hr.json b/locales/hr.json
index 54eef7f9..e42cc4f5 100644
--- a/locales/hr.json
+++ b/locales/hr.json
@@ -487,5 +487,6 @@
"search_filters_duration_option_medium": "Srednje (4 – 20 minuta)",
"search_filters_apply_button": "Primijeni odabrane filtre",
"search_filters_type_option_all": "Bilo koja vrsta",
- "Popular enabled: ": "Popularni aktivirani: "
+ "Popular enabled: ": "Popularni aktivirani: ",
+ "error_video_not_in_playlist": "Traženi video ne postoji u ovoj zbirci. <a href=\"`x`\">Pritisni ovdje za početnu stranicu zbirke.</a>"
}
diff --git a/locales/id.json b/locales/id.json
index ad80efcf..a30f0ad4 100644
--- a/locales/id.json
+++ b/locales/id.json
@@ -448,5 +448,10 @@
"search_filters_date_option_none": "Tanggal berapa pun",
"search_filters_duration_option_none": "Durasi berapa pun",
"search_filters_duration_option_medium": "Sedang (4 - 20 menit)",
- "Cantonese (Hong Kong)": "Bahasa Kanton (Hong Kong)"
+ "Cantonese (Hong Kong)": "Bahasa Kanton (Hong Kong)",
+ "crash_page_refresh": "mencoba untuk <a href=\"`x`\">memuat ulang halaman</a>",
+ "crash_page_switch_instance": "mencoba untuk <a href=\"`x`\">menggunakan peladen lainnya</a>",
+ "crash_page_read_the_faq": "baca <a href=\"`x`\">Soal Sering Ditanya (SSD/FAQ)</a>",
+ "crash_page_search_issue": "mencari <a href=\"`x`\">isu yang ada di GitHub</a>",
+ "crash_page_report_issue": "Jika yang di atas tidak membantu, <a href=\"`x`\">buka isu baru di GitHub</a> (sebaiknya dalam bahasa Inggris) dan sertakan teks berikut dalam pesan Anda (JANGAN terjemahkan teks tersebut):"
}
diff --git a/locales/it.json b/locales/it.json
index facf2594..63a8e8d4 100644
--- a/locales/it.json
+++ b/locales/it.json
@@ -471,5 +471,6 @@
"search_filters_duration_option_medium": "Media (4 - 20 minuti)",
"search_filters_features_option_vr180": "VR180",
"search_filters_apply_button": "Applica filtri selezionati",
- "crash_page_refresh": "provato a <a href=\"`x`\">ricaricare la pagina</a>"
+ "crash_page_refresh": "provato a <a href=\"`x`\">ricaricare la pagina</a>",
+ "error_video_not_in_playlist": "Il video richiesto non esiste in questa playlist. <a href=\"`x`\">Fai clic qui per la pagina iniziale della playlist.</a>"
}
diff --git a/locales/ko.json b/locales/ko.json
index 12c2b31f..0964a563 100644
--- a/locales/ko.json
+++ b/locales/ko.json
@@ -12,8 +12,8 @@
"Dark mode: ": "다크 모드: ",
"preferences_player_style_label": "플레이어 스타일: ",
"preferences_category_visual": "시각 설정",
- "preferences_vr_mode_label": "인터랙티브 360도 비디오: ",
- "preferences_extend_desc_label": "자동으로 비디오 설명 확장: ",
+ "preferences_vr_mode_label": "360도 비디오와 상호작용하기(WebGL를 요구함): ",
+ "preferences_extend_desc_label": "자동으로 비디오 설명을 확장: ",
"preferences_annotations_label": "기본적으로 주석 표시: ",
"preferences_related_videos_label": "관련 동영상 보기: ",
"Fallback captions: ": "대체 자막: ",
@@ -58,7 +58,7 @@
"Import NewPipe subscriptions (.json)": "NewPipe 구독을 가져오기 (.json)",
"Import FreeTube subscriptions (.db)": "FreeTube 구독 가져오기 (.db)",
"Import YouTube subscriptions": "YouTube 구독 가져오기",
- "Import Invidious data": "Invidious 데이터 가져오기",
+ "Import Invidious data": "Invidious JSON 데이터 가져오기",
"Import": "가져오기",
"Import and Export Data": "데이터 가져오기 및 내보내기",
"No": "아니요",
@@ -91,7 +91,7 @@
"Japanese": "일본어",
"Greek": "그리스어",
"German": "독일어",
- "Chinese (Traditional)": "중국어 (정자)",
+ "Chinese (Traditional)": "중국어 (정체자)",
"Chinese (Simplified)": "중국어 (간체자)",
"French": "프랑스어",
"Finnish": "핀란드어",
@@ -183,9 +183,9 @@
"Russian": "러시아어",
"Romanian": "루마니아어",
"Punjabi": "펀자브어",
- "Portuguese": "포르투갈어(포어)",
+ "Portuguese": "포르투갈어",
"Polish": "폴란드어",
- "Persian": "페르시아어(파사어)",
+ "Persian": "페르시아어",
"Pashto": "파슈토어",
"Nyanja": "체와어",
"Norwegian Bokmål": "보크몰",
@@ -225,7 +225,7 @@
"Kazakh": "카자흐어",
"Kannada": "칸나다어",
"Javanese": "자바어",
- "Italian": "이탈리아어(이태리어)",
+ "Italian": "이탈리아어",
"Irish": "아일랜드어",
"Indonesian": "인도네시아어",
"Igbo": "이보어",
@@ -256,7 +256,7 @@
},
"Haitian Creole": "아이티 크레올어",
"Gujarati": "구자라트어",
- "Esperanto": "에스페란토(에스페란토어)",
+ "Esperanto": "에스페란토",
"Georgian": "조지아어",
"Galician": "갈리시아어",
"Filipino": "타갈로그어(필리핀어)",
@@ -374,12 +374,69 @@
"search_filters_date_option_hour": "지난 1시간",
"search_filters_sort_label": "정렬기준",
"search_filters_features_label": "기능별",
- "search_filters_duration_option_short": "4분 미만",
- "search_filters_duration_option_long": "20분 초과",
+ "search_filters_duration_option_short": "짧음 (4분 미만)",
+ "search_filters_duration_option_long": "김 (20분 초과)",
"footer_documentation": "문서",
"footer_source_code": "소스 코드",
"footer_original_source_code": "원본 소스 코드",
"footer_modfied_source_code": "수정된 소스 코드",
"adminprefs_modified_source_code_url_label": "수정된 소스 코드 저장소의 URL",
- "search_filters_title": "필터"
+ "search_filters_title": "필터",
+ "preferences_quality_dash_option_4320p": "4320p",
+ "Popular enabled: ": "인기 급상승 활성화: ",
+ "Dutch (auto-generated)": "네덜란드어 (자동 생성됨)",
+ "Chinese (Hong Kong)": "중국어 (홍콩)",
+ "Chinese (Taiwan)": "중국어 (대만)",
+ "German (auto-generated)": "독일어 (자동 생성됨)",
+ "Interlingue": "Interlingue",
+ "search_filters_date_label": "업로드 날짜",
+ "search_filters_date_option_none": "모든 날짜",
+ "search_filters_duration_option_none": "모든 기간",
+ "search_filters_features_option_three_sixty": "360°",
+ "search_filters_features_option_purchased": "구입한 항목",
+ "search_filters_apply_button": "선택한 필터 적용하기",
+ "preferences_quality_dash_option_240p": "240p",
+ "preferences_region_label": "콘텐트 국가: ",
+ "preferences_quality_dash_option_1440p": "1440p",
+ "French (auto-generated)": "프랑스어 (자동 생성됨)",
+ "Indonesian (auto-generated)": "인도네시아어 (자동 생성됨)",
+ "Turkish (auto-generated)": "터키어 (자동 생성됨)",
+ "Vietnamese (auto-generated)": "베트남어 (자동 생성됨)",
+ "preferences_quality_dash_option_2160p": "2160p",
+ "Italian (auto-generated)": "이탈리아어 (자동 생성됨)",
+ "preferences_quality_option_medium": "중간",
+ "preferences_quality_dash_option_720p": "720p",
+ "search_filters_duration_option_medium": "중간 (4 - 20분)",
+ "preferences_quality_dash_option_best": "최고",
+ "Portuguese (auto-generated)": "포르투갈어 (자동 생성됨)",
+ "Spanish (Spain)": "스페인어 (스페인)",
+ "preferences_quality_dash_label": "선호하시는 DASH 비디오 품질: ",
+ "preferences_quality_option_hd720": "HD720",
+ "Spanish (auto-generated)": "스페인어 (자동 생성됨)",
+ "preferences_quality_dash_option_1080p": "1080p",
+ "preferences_quality_dash_option_worst": "최저",
+ "preferences_watch_history_label": "시청 기록 활성화: ",
+ "invidious": "Invidious",
+ "preferences_quality_option_small": "낮음",
+ "preferences_quality_dash_option_auto": "자동",
+ "preferences_quality_dash_option_480p": "480p",
+ "preferences_quality_dash_option_144p": "144p",
+ "English (United Kingdom)": "영어 (영국)",
+ "search_filters_features_option_vr180": "VR180",
+ "Cantonese (Hong Kong)": "광동어 (홍콩)",
+ "Portuguese (Brazil)": "포르투갈어 (브라질)",
+ "search_message_no_results": "결과가 없습니다.",
+ "search_message_change_filters_or_query": "필터를 변경하시거나 검색어를 넓게 시도해보세요.",
+ "search_message_use_another_instance": " 당신은 <a href=\"`x`\">다른 인스턴스에서 검색</a>할 수도 있습니다.",
+ "English (United States)": "영어 (미국)",
+ "Chinese": "중국어",
+ "Chinese (China)": "중국어 (중국)",
+ "Japanese (auto-generated)": "일본어 (자동 생성됨)",
+ "Korean (auto-generated)": "한국어 (자동 생성됨)",
+ "Russian (auto-generated)": "러시아어 (자동 생성됨)",
+ "Spanish (Mexico)": "스페인어 (멕시코)",
+ "search_filters_type_option_all": "모든 유형",
+ "footer_donate_page": "기부하기",
+ "preferences_quality_option_dash": "DASH (적절한 화질)",
+ "preferences_quality_dash_option_360p": "360p"
}
diff --git a/locales/sl.json b/locales/sl.json
index 288f8da5..5994ca1a 100644
--- a/locales/sl.json
+++ b/locales/sl.json
@@ -503,5 +503,6 @@
"crash_page_before_reporting": "Preden prijaviš napako, se prepričaj, da si:",
"crash_page_search_issue": "preiskal/a <a href=\"`x`\">obstoječe težave na GitHubu</a>",
"crash_page_report_issue": "Če nič od navedenega ni pomagalo, prosim <a href=\"`x`\">odpri novo težavo v GitHubu</a> (po možnosti v angleščini) in v svoje sporočilo vključi naslednje besedilo (tega besedila NE prevajaj):",
- "Popular enabled: ": "Priljubljeni omogočeni: "
+ "Popular enabled: ": "Priljubljeni omogočeni: ",
+ "error_video_not_in_playlist": "Zahtevani videoposnetek ne obstaja na tem seznamu predvajanja. <a href=\"`x`\">Klikni tukaj za domačo stran seznama predvajanja.</a>"
}
diff --git a/locales/tr.json b/locales/tr.json
index bd499746..77aacb40 100644
--- a/locales/tr.json
+++ b/locales/tr.json
@@ -471,5 +471,6 @@
"search_filters_features_option_vr180": "VR180",
"search_filters_title": "Filtreler",
"search_message_change_filters_or_query": "Arama sorgunuzu genişletmeyi ve/veya filtreleri değiştirmeyi deneyin.",
- "Popular enabled: ": "Popüler etkin: "
+ "Popular enabled: ": "Popüler etkin: ",
+ "error_video_not_in_playlist": "İstenen video bu oynatma listesinde yok. <a href=\"`x`\">Oynatma listesi ana sayfası için buraya tıklayın.</a>"
}
diff --git a/locales/uk.json b/locales/uk.json
index 0cc14579..b6994c56 100644
--- a/locales/uk.json
+++ b/locales/uk.json
@@ -487,5 +487,6 @@
"search_filters_sort_option_relevance": "Відповідні",
"search_filters_sort_option_rating": "Рейтингові",
"search_filters_sort_option_views": "Популярні",
- "Popular enabled: ": "Популярне ввімкнено: "
+ "Popular enabled: ": "Популярне ввімкнено: ",
+ "error_video_not_in_playlist": "Запитуваного відео в цьому списку відтворення не існує. <a href=\"`x`\">Клацніть тут, щоб переглянути домашню сторінку списку відтворення.</a>"
}
diff --git a/locales/zh-CN.json b/locales/zh-CN.json
index ff48e101..7e749dc9 100644
--- a/locales/zh-CN.json
+++ b/locales/zh-CN.json
@@ -455,5 +455,6 @@
"search_filters_duration_option_none": "任意时长",
"search_filters_type_option_all": "任意类型",
"search_filters_features_option_vr180": "VR180",
- "Popular enabled: ": "已启用流行度: "
+ "Popular enabled: ": "已启用流行度: ",
+ "error_video_not_in_playlist": "此播放列表中不存在请求的视频。 <a href=\"`x`\">单击析出查看播放列表主页。</a>"
}
diff --git a/locales/zh-TW.json b/locales/zh-TW.json
index 90614e48..54933701 100644
--- a/locales/zh-TW.json
+++ b/locales/zh-TW.json
@@ -455,5 +455,6 @@
"search_filters_date_label": "上傳日期",
"search_filters_type_option_all": "任何類型",
"search_filters_date_option_none": "任何日期",
- "Popular enabled: ": "已啟用人氣: "
+ "Popular enabled: ": "已啟用人氣: ",
+ "error_video_not_in_playlist": "此播放清單不存在請求的影片。<a href=\"`x`\">點擊此處檢視播放清單首頁。</a>"
}
diff --git a/src/invidious/comments.cr b/src/invidious/comments.cr
index 5112ad3d..d691ca36 100644
--- a/src/invidious/comments.cr
+++ b/src/invidious/comments.cr
@@ -201,15 +201,6 @@ def fetch_youtube_comments(id, cursor, format, locale, thin_mode, region, sort_b
end
if node_replies && !response["commentRepliesContinuation"]?
- if node_replies["moreText"]?
- reply_count = (node_replies["moreText"]["simpleText"]? || node_replies["moreText"]["runs"]?.try &.[0]?.try &.["text"]?)
- .try &.as_s.gsub(/\D/, "").to_i? || 1
- elsif node_replies["viewReplies"]?
- reply_count = node_replies["viewReplies"]["buttonRenderer"]["text"]?.try &.["runs"][1]?.try &.["text"]?.try &.as_s.to_i? || 1
- else
- reply_count = 1
- end
-
if node_replies["continuations"]?
continuation = node_replies["continuations"]?.try &.as_a[0]["nextContinuationData"]["continuation"].as_s
elsif node_replies["contents"]?
@@ -219,7 +210,7 @@ def fetch_youtube_comments(id, cursor, format, locale, thin_mode, region, sort_b
json.field "replies" do
json.object do
- json.field "replyCount", reply_count
+ json.field "replyCount", node_comment["replyCount"]? || 1
json.field "continuation", continuation
end
end
diff --git a/src/invidious/routes/embed.cr b/src/invidious/routes/embed.cr
index 84da9993..e6486587 100644
--- a/src/invidious/routes/embed.cr
+++ b/src/invidious/routes/embed.cr
@@ -2,11 +2,16 @@
module Invidious::Routes::Embed
def self.redirect(env)
+ locale = env.get("preferences").as(Preferences).locale
if plid = env.params.query["list"]?.try &.gsub(/[^a-zA-Z0-9_-]/, "")
begin
playlist = get_playlist(plid)
offset = env.params.query["index"]?.try &.to_i? || 0
videos = get_playlist_videos(playlist, offset: offset)
+ if videos.empty?
+ url = "/playlist?list=#{plid}"
+ raise NotFoundException.new(translate(locale, "error_video_not_in_playlist", url))
+ end
rescue ex : NotFoundException
return error_template(404, ex)
rescue ex
@@ -26,6 +31,7 @@ module Invidious::Routes::Embed
end
def self.show(env)
+ locale = env.get("preferences").as(Preferences).locale
id = env.params.url["id"]
plid = env.params.query["list"]?.try &.gsub(/[^a-zA-Z0-9_-]/, "")
@@ -62,6 +68,10 @@ module Invidious::Routes::Embed
playlist = get_playlist(plid)
offset = env.params.query["index"]?.try &.to_i? || 0
videos = get_playlist_videos(playlist, offset: offset)
+ if videos.empty?
+ url = "/playlist?list=#{plid}"
+ raise NotFoundException.new(translate(locale, "error_video_not_in_playlist", url))
+ end
rescue ex : NotFoundException
return error_template(404, ex)
rescue ex
diff --git a/src/invidious/views/licenses.ecr b/src/invidious/views/licenses.ecr
index 25b24ed4..667cfa37 100644
--- a/src/invidious/views/licenses.ecr
+++ b/src/invidious/views/licenses.ecr
@@ -25,6 +25,20 @@
<tr>
<td>
+ <a href="/js/handlers.js?v=<%= ASSET_COMMIT %>">handlers.js</a>
+ </td>
+
+ <td>
+ <a href="https://www.gnu.org/licenses/agpl-3.0.html">AGPL-3.0</a>
+ </td>
+
+ <td>
+ <a href="/js/handlers.js?v=<%= ASSET_COMMIT %>"><%= translate(locale, "source") %></a>
+ </td>
+ </tr>
+
+ <tr>
+ <td>
<a href="/js/community.js?v=<%= ASSET_COMMIT %>">community.js</a>
</td>
@@ -169,7 +183,7 @@
</td>
<td>
- <a href="https://choosealicense.com/licenses/mit/">MIT</a>
+ <a href="https://choosealicense.com/licenses/mit/">Expat</a>
</td>
<td>
@@ -253,7 +267,7 @@
</td>
<td>
- <a href="https://choosealicense.com/licenses/mit">MIT</a>
+ <a href="https://choosealicense.com/licenses/mit">Expat</a>
</td>
<td>
diff --git a/src/invidious/views/template.ecr b/src/invidious/views/template.ecr
index caf5299f..98f72eba 100644
--- a/src/invidious/views/template.ecr
+++ b/src/invidious/views/template.ecr
@@ -67,7 +67,7 @@
</a>
</div>
<% if env.get("preferences").as(Preferences).show_nick %>
- <div class="pure-u-1-4">
+ <div class="pure-u-1-4" style="overflow: hidden; white-space: nowrap;">
<span id="user_name"><%= HTML.escape(env.get("user").as(Invidious::User).email) %></span>
</div>
<% end %>
diff --git a/src/invidious/views/watch.ecr b/src/invidious/views/watch.ecr
index 50c63d21..243ea3a4 100644
--- a/src/invidious/views/watch.ecr
+++ b/src/invidious/views/watch.ecr
@@ -270,7 +270,7 @@ we're going to need to do it here in order to allow for translations.
<% video.related_videos.each do |rv| %>
<% if rv["id"]? %>
- <a href="/watch?v=<%= rv["id"] %>">
+ <a href="/watch?v=<%= rv["id"] %>&listen=<%= params.listen %>">
<% if !env.get("preferences").as(Preferences).thin_mode %>
<div class="thumbnail">
<img loading="lazy" class="thumbnail" src="/vi/<%= rv["id"] %>/mqdefault.jpg">
diff --git a/src/invidious/yt_backend/connection_pool.cr b/src/invidious/yt_backend/connection_pool.cr
index 3feb9233..46e5bf85 100644
--- a/src/invidious/yt_backend/connection_pool.cr
+++ b/src/invidious/yt_backend/connection_pool.cr
@@ -7,17 +7,16 @@
{% end %}
def add_yt_headers(request)
- request.headers["user-agent"] ||= "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.97 Safari/537.36"
- request.headers["accept-charset"] ||= "ISO-8859-1,utf-8;q=0.7,*;q=0.7"
- request.headers["accept"] ||= "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"
- request.headers["accept-language"] ||= "en-us,en;q=0.5"
- return if request.resource.starts_with? "/sorry/index"
- request.headers["x-youtube-client-name"] ||= "1"
- request.headers["x-youtube-client-version"] ||= "2.20200609"
+ if request.headers["User-Agent"] == "Crystal"
+ request.headers["User-Agent"] ||= "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/104.0.0.0 Safari/537.36"
+ end
+ request.headers["Accept-Charset"] ||= "ISO-8859-1,utf-8;q=0.7,*;q=0.7"
+ request.headers["Accept"] ||= "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"
+ request.headers["Accept-Language"] ||= "en-us,en;q=0.5"
# Preserve original cookies and add new YT consent cookie for EU servers
- request.headers["cookie"] = "#{request.headers["cookie"]?}; CONSENT=YES+"
+ request.headers["Cookie"] = "#{request.headers["cookie"]?}; CONSENT=YES+"
if !CONFIG.cookies.empty?
- request.headers["cookie"] = "#{(CONFIG.cookies.map { |c| "#{c.name}=#{c.value}" }).join("; ")}; #{request.headers["cookie"]?}"
+ request.headers["Cookie"] = "#{(CONFIG.cookies.map { |c| "#{c.name}=#{c.value}" }).join("; ")}; #{request.headers["cookie"]?}"
end
end
diff --git a/src/invidious/yt_backend/youtube_api.cr b/src/invidious/yt_backend/youtube_api.cr
index 30d7613b..02327025 100644
--- a/src/invidious/yt_backend/youtube_api.cr
+++ b/src/invidious/yt_backend/youtube_api.cr
@@ -7,9 +7,17 @@ module YoutubeAPI
private DEFAULT_API_KEY = "AIzaSyAO_FJ2SlqU8Q4STEHLGCilw_Y9_11qcW8"
- private ANDROID_APP_VERSION = "17.29.35"
- private ANDROID_SDK_VERSION = 30_i64
- private IOS_APP_VERSION = "17.30.1"
+ private ANDROID_APP_VERSION = "17.33.42"
+ # github.com/TeamNewPipe/NewPipeExtractor/blob/943b7c033bb9d07ead63ddab4441c287653e4384/extractor/src/main/java/org/schabi/newpipe/extractor/services/youtube/YoutubeParsingHelper.java#L1308
+ private ANDROID_USER_AGENT = "com.google.android.youtube/17.33.42 (Linux; U; Android 12; US) gzip"
+ private ANDROID_SDK_VERSION = 31_i64
+ private ANDROID_VERSION = "12"
+ private IOS_APP_VERSION = "17.33.2"
+ # github.com/TeamNewPipe/NewPipeExtractor/blob/943b7c033bb9d07ead63ddab4441c287653e4384/extractor/src/main/java/org/schabi/newpipe/extractor/services/youtube/YoutubeParsingHelper.java#L1330
+ private IOS_USER_AGENT = "com.google.ios.youtube/17.33.2 (iPhone14,5; U; CPU iOS 15_6 like Mac OS X;)"
+ # github.com/TeamNewPipe/NewPipeExtractor/blob/943b7c033bb9d07ead63ddab4441c287653e4384/extractor/src/main/java/org/schabi/newpipe/extractor/services/youtube/YoutubeParsingHelper.java#L1224
+ private IOS_VERSION = "15.6.0.19G71"
+ private WINDOWS_VERSION = "10.0"
# Enumerate used to select one of the clients supported by the API
enum ClientType
@@ -33,80 +41,130 @@ module YoutubeAPI
# List of hard-coded values used by the different clients
HARDCODED_CLIENTS = {
ClientType::Web => {
- name: "WEB",
- version: "2.20220804.07.00",
- api_key: DEFAULT_API_KEY,
- screen: "WATCH_FULL_SCREEN",
+ name: "WEB",
+ name_proto: "1",
+ version: "2.20220804.07.00",
+ api_key: DEFAULT_API_KEY,
+ screen: "WATCH_FULL_SCREEN",
+ os_name: "Windows",
+ os_version: WINDOWS_VERSION,
+ platform: "DESKTOP",
},
ClientType::WebEmbeddedPlayer => {
- name: "WEB_EMBEDDED_PLAYER", # 56
- version: "1.20220803.01.00",
- api_key: DEFAULT_API_KEY,
- screen: "EMBED",
+ name: "WEB_EMBEDDED_PLAYER",
+ name_proto: "56",
+ version: "1.20220803.01.00",
+ api_key: DEFAULT_API_KEY,
+ screen: "EMBED",
+ os_name: "Windows",
+ os_version: WINDOWS_VERSION,
+ platform: "DESKTOP",
},
ClientType::WebMobile => {
- name: "MWEB",
- version: "2.20220805.01.00",
- api_key: DEFAULT_API_KEY,
+ name: "MWEB",
+ name_proto: "2",
+ version: "2.20220805.01.00",
+ api_key: DEFAULT_API_KEY,
+ os_name: "Android",
+ os_version: ANDROID_VERSION,
+ platform: "MOBILE",
},
ClientType::WebScreenEmbed => {
- name: "WEB",
- version: "2.20220804.00.00",
- api_key: DEFAULT_API_KEY,
- screen: "EMBED",
+ name: "WEB",
+ name_proto: "1",
+ version: "2.20220804.00.00",
+ api_key: DEFAULT_API_KEY,
+ screen: "EMBED",
+ os_name: "Windows",
+ os_version: WINDOWS_VERSION,
+ platform: "DESKTOP",
},
# Android
ClientType::Android => {
name: "ANDROID",
+ name_proto: "3",
version: ANDROID_APP_VERSION,
api_key: "AIzaSyA8eiZmM1FaDVjRy-df2KTyQ_vz_yYM39w",
android_sdk_version: ANDROID_SDK_VERSION,
+ user_agent: ANDROID_USER_AGENT,
+ os_name: "Android",
+ os_version: ANDROID_VERSION,
+ platform: "MOBILE",
},
ClientType::AndroidEmbeddedPlayer => {
- name: "ANDROID_EMBEDDED_PLAYER", # 55
- version: ANDROID_APP_VERSION,
- api_key: DEFAULT_API_KEY,
+ name: "ANDROID_EMBEDDED_PLAYER",
+ name_proto: "55",
+ version: ANDROID_APP_VERSION,
+ api_key: DEFAULT_API_KEY,
},
ClientType::AndroidScreenEmbed => {
- name: "ANDROID", # 3
+ name: "ANDROID",
+ name_proto: "3",
version: ANDROID_APP_VERSION,
api_key: DEFAULT_API_KEY,
screen: "EMBED",
android_sdk_version: ANDROID_SDK_VERSION,
+ user_agent: ANDROID_USER_AGENT,
+ os_name: "Android",
+ os_version: ANDROID_VERSION,
+ platform: "MOBILE",
},
# IOS
ClientType::IOS => {
- name: "IOS", # 5
- version: IOS_APP_VERSION,
- api_key: "AIzaSyB-63vPrdThhKuerbB2N_l7Kwwcxj6yUAc",
+ name: "IOS",
+ name_proto: "5",
+ version: IOS_APP_VERSION,
+ api_key: "AIzaSyB-63vPrdThhKuerbB2N_l7Kwwcxj6yUAc",
+ user_agent: IOS_USER_AGENT,
+ device_make: "Apple",
+ device_model: "iPhone14,5",
+ os_name: "iPhone",
+ os_version: IOS_VERSION,
+ platform: "MOBILE",
},
ClientType::IOSEmbedded => {
- name: "IOS_MESSAGES_EXTENSION", # 66
- version: IOS_APP_VERSION,
- api_key: DEFAULT_API_KEY,
+ name: "IOS_MESSAGES_EXTENSION",
+ name_proto: "66",
+ version: IOS_APP_VERSION,
+ api_key: DEFAULT_API_KEY,
+ user_agent: IOS_USER_AGENT,
+ device_make: "Apple",
+ device_model: "iPhone14,5",
+ os_name: "iPhone",
+ os_version: IOS_VERSION,
+ platform: "MOBILE",
},
ClientType::IOSMusic => {
- name: "IOS_MUSIC", # 26
- version: "4.32",
- api_key: "AIzaSyBAETezhkwP0ZWA02RsqT1zu78Fpt0bC_s",
+ name: "IOS_MUSIC",
+ name_proto: "26",
+ version: "5.21",
+ api_key: "AIzaSyBAETezhkwP0ZWA02RsqT1zu78Fpt0bC_s",
+ user_agent: "com.google.ios.youtubemusic/5.21 (iPhone14,5; U; CPU iOS 15_6 like Mac OS X;)",
+ device_make: "Apple",
+ device_model: "iPhone14,5",
+ os_name: "iPhone",
+ os_version: IOS_VERSION,
+ platform: "MOBILE",
},
# TV app
ClientType::TvHtml5 => {
- name: "TVHTML5", # 7
- version: "7.20220325",
- api_key: DEFAULT_API_KEY,
+ name: "TVHTML5",
+ name_proto: "7",
+ version: "7.20220325",
+ api_key: DEFAULT_API_KEY,
},
ClientType::TvHtml5ScreenEmbed => {
- name: "TVHTML5_SIMPLY_EMBEDDED_PLAYER", # 85
- version: "2.0",
- api_key: DEFAULT_API_KEY,
- screen: "EMBED",
+ name: "TVHTML5_SIMPLY_EMBEDDED_PLAYER",
+ name_proto: "85",
+ version: "2.0",
+ api_key: DEFAULT_API_KEY,
+ screen: "EMBED",
},
}
@@ -160,6 +218,10 @@ module YoutubeAPI
HARDCODED_CLIENTS[@client_type][:name]
end
+ def name_proto : String
+ HARDCODED_CLIENTS[@client_type][:name_proto]
+ end
+
# :ditto:
def version : String
HARDCODED_CLIENTS[@client_type][:version]
@@ -179,6 +241,30 @@ module YoutubeAPI
HARDCODED_CLIENTS[@client_type][:android_sdk_version]?
end
+ def user_agent : String?
+ HARDCODED_CLIENTS[@client_type][:user_agent]?
+ end
+
+ def os_name : String?
+ HARDCODED_CLIENTS[@client_type][:os_name]?
+ end
+
+ def device_make : String?
+ HARDCODED_CLIENTS[@client_type][:device_make]?
+ end
+
+ def device_model : String?
+ HARDCODED_CLIENTS[@client_type][:device_model]?
+ end
+
+ def os_version : String?
+ HARDCODED_CLIENTS[@client_type][:os_version]?
+ end
+
+ def platform : String?
+ HARDCODED_CLIENTS[@client_type][:platform]?
+ end
+
# Convert to string, for logging purposes
def to_s
return {
@@ -226,6 +312,26 @@ module YoutubeAPI
client_context["client"]["androidSdkVersion"] = android_sdk_version
end
+ if device_make = client_config.device_make
+ client_context["client"]["deviceMake"] = device_make
+ end
+
+ if device_model = client_config.device_model
+ client_context["client"]["deviceModel"] = device_model
+ end
+
+ if os_name = client_config.os_name
+ client_context["client"]["osName"] = os_name
+ end
+
+ if os_version = client_config.os_version
+ client_context["client"]["osVersion"] = os_version
+ end
+
+ if platform = client_config.platform
+ client_context["client"]["platform"] = platform
+ end
+
return client_context
end
@@ -361,8 +467,18 @@ module YoutubeAPI
)
# JSON Request data, required by the API
data = {
- "videoId" => video_id,
- "context" => self.make_context(client_config),
+ "contentCheckOk" => true,
+ "videoId" => video_id,
+ "context" => self.make_context(client_config),
+ "racyCheckOk" => true,
+ "user" => {
+ "lockedSafetyMode" => false,
+ },
+ "playbackContext" => {
+ "contentPlaybackContext" => {
+ "html5Preference": "HTML5_PREF_WANTS",
+ },
+ },
}
# Append the additional parameters if those were provided
@@ -460,10 +576,17 @@ module YoutubeAPI
url = "#{endpoint}?key=#{client_config.api_key}&prettyPrint=false"
headers = HTTP::Headers{
- "Content-Type" => "application/json; charset=UTF-8",
- "Accept-Encoding" => "gzip, deflate",
+ "Content-Type" => "application/json; charset=UTF-8",
+ "Accept-Encoding" => "gzip, deflate",
+ "x-goog-api-format-version" => "2",
+ "x-youtube-client-name" => client_config.name_proto,
+ "x-youtube-client-version" => client_config.version,
}
+ if user_agent = client_config.user_agent
+ headers["User-Agent"] = user_agent
+ end
+
# Logging
LOGGER.debug("YoutubeAPI: Using endpoint: \"#{endpoint}\"")
LOGGER.trace("YoutubeAPI: ClientConfig: #{client_config}")