aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2020-09-08 16:13:06 +0200
committerdec05eba <dec05eba@protonmail.com>2020-09-08 16:13:06 +0200
commitdcaf432136c481be792b64ef23efca7ab4360847 (patch)
tree2c41f64e47724de72e52b992d34ffcab10df3935
parent8201f4ab2ca0eb0c247406f642cd08f368611973 (diff)
Remove invidous fallback since invidious website is dead and youtube-dl now works with age restricted videos
-rw-r--r--src/QuickMedia.cpp36
1 files changed, 1 insertions, 35 deletions
diff --git a/src/QuickMedia.cpp b/src/QuickMedia.cpp
index f35b35d..27926cb 100644
--- a/src/QuickMedia.cpp
+++ b/src/QuickMedia.cpp
@@ -1033,13 +1033,6 @@ namespace QuickMedia {
bool added_recommendations = false;
bool video_loaded = false;
- int fallback_count = 0;
- const int max_fallbacks = 3;
- /* itags from: https://gist.github.com/sidneys/7095afe4da4ae58694d128b1034e01e2 */
- /* 1080p, 720p, 360p */
- /* TODO: Use invidious api instead (/api/v1/videos/<video_id>, formatStreams) https://github.com/iv-org/invidious/wiki/API */
- const char *fallback_itags[max_fallbacks] = { "37", "22", "18" };
-
Page previous_page = pop_page_stack();
std::unique_ptr<VideoPlayer> video_player;
@@ -1101,7 +1094,7 @@ namespace QuickMedia {
};
bool has_video_started = true;
- auto video_event_callback = [this, &video_player, &load_video_error_check, previous_page, &has_video_started, &fallback_count, &time_watched_timer, &video_loaded](const char *event_name) mutable {
+ auto video_event_callback = [this, &video_player, &load_video_error_check, previous_page, &has_video_started, &time_watched_timer, &video_loaded](const char *event_name) mutable {
bool end_of_file = false;
if(strcmp(event_name, "pause") == 0) {
double time_remaining = 9999.0;
@@ -1111,7 +1104,6 @@ namespace QuickMedia {
video_player->set_paused(false);
} else if(strcmp(event_name, "file-loaded") == 0) {
has_video_started = true;
- fallback_count = 0;
time_watched_timer.restart();
video_loaded = true;
} else if(strcmp(event_name, "end-file") == 0) {
@@ -1190,32 +1182,6 @@ namespace QuickMedia {
show_notification("Video player", "Failed to connect to mpv ipc after 10 seconds", Urgency::CRITICAL);
current_page = previous_page;
break;
- } else if(is_youtube && update_err == VideoPlayer::Error::EXITED && fallback_count < max_fallbacks) {
- ++fallback_count;
- std::string youtube_video_id;
- if(youtube_url_extract_id(content_url, youtube_video_id)) {
- fprintf(stderr, "Failed to play youtube video (maybe because of age verification?), trying with invidio.us...\n");
- // This can fail for example if the video requires age vertification...
- // Im sorry invidio.us server... this will be removed later and it only happens when youtube-dl fails!
- // TODO: Remove this when youtube-dl is modified to work with videos that require age verification.
- video_player_window = None;
- has_video_started = true;
- video_player.reset();
- video_player = std::make_unique<VideoPlayer>(current_plugin->use_tor, use_system_mpv_config, video_event_callback, on_window_create);
-
- std::string new_video_url = "https://www.invidio.us/latest_version?id=" + youtube_video_id + "&itag=" + fallback_itags[fallback_count - 1];
- VideoPlayer::Error err = video_player->load_video(new_video_url.c_str(), window.getSystemHandle(), current_plugin->name);
- if(err != VideoPlayer::Error::OK) {
- std::string err_msg = "Failed to play url: ";
- err_msg += content_url;
- show_notification("Video player", err_msg.c_str(), Urgency::CRITICAL);
- current_page = previous_page;
- }
- } else {
- show_notification("Video player", "The video player failed to play the video", Urgency::CRITICAL);
- current_page = previous_page;
- return;
- }
} else if(update_err != VideoPlayer::Error::OK) {
show_notification("Video player", "The video player failed to play the video", Urgency::CRITICAL);
current_page = previous_page;