Merge branch 'master' of github.com:iv-org/invidious

このコミットが含まれているのは:
守矢諏訪子 2022-09-19 13:43:41 +09:00
コミット f48b1133eb
17個のファイルの変更276行の追加79行の削除

ファイルの表示

@ -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;

ファイルの表示

@ -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 */

ファイルの表示

@ -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>"
}

ファイルの表示

@ -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>"
}

ファイルの表示

@ -471,5 +471,6 @@
"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)",
"Popular enabled: ": "¿Habilitar la sección popular? "
"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>"
}

ファイルの表示

@ -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>"
}

ファイルの表示

@ -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):"
}

ファイルの表示

@ -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>"
}

ファイルの表示

@ -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"
}

ファイルの表示

@ -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>"
}

ファイルの表示

@ -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>"
}

ファイルの表示

@ -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>"
}

ファイルの表示

@ -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>"
}

ファイルの表示

@ -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>"
}

ファイルの表示

@ -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">

ファイルの表示

@ -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

ファイルの表示

@ -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}")