From 307372c594f6c9847d94337cbbcb52e55c34b4c5 Mon Sep 17 00:00:00 2001 From: Jason Sadler Date: Mon, 23 Dec 2019 18:38:20 -0500 Subject: [PATCH] Fixes brave/brave-browser#5726 --- .../src/bat/ledger/internal/media/vimeo.cc | 17 ++++++++++++++--- .../bat/ledger/internal/media/vimeo_unittest.cc | 3 ++- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/vendor/bat-native-ledger/src/bat/ledger/internal/media/vimeo.cc b/vendor/bat-native-ledger/src/bat/ledger/internal/media/vimeo.cc index 0fe759f2c366..8f1ed8e940bf 100644 --- a/vendor/bat-native-ledger/src/bat/ledger/internal/media/vimeo.cc +++ b/vendor/bat-native-ledger/src/bat/ledger/internal/media/vimeo.cc @@ -11,6 +11,7 @@ #include "base/json/json_reader.h" #include "base/strings/string_util.h" #include "base/strings/stringprintf.h" +#include "bat/ledger/internal/bat_helper.h" #include "bat/ledger/internal/ledger_impl.h" #include "bat/ledger/internal/media/vimeo.h" #include "bat/ledger/internal/static_values.h" @@ -99,7 +100,14 @@ std::string Vimeo::GetNameFromVideoPage(const std::string& data) { return ""; } - return braveledger_media::ExtractData(data, ",\"display_name\":\"", "\""); + std::string publisher_name; + const std::string publisher_json_name = + braveledger_media::ExtractData(data, "\"display_name\":\"", "\""); + const std::string publisher_json = "{\"brave_publisher\":\"" + + publisher_json_name + "\"}"; + braveledger_bat_helper::getJSONValue( + "brave_publisher", publisher_json, &publisher_name); + return publisher_name; } // static @@ -250,9 +258,12 @@ std::string Vimeo::GetNameFromPublisherPage(const std::string& data) { if (data.empty()) { return ""; } - - return braveledger_media::ExtractData(data, + std::string publisher_name = GetNameFromVideoPage(data); + if (publisher_name == "") { + return braveledger_media::ExtractData(data, "Watch in our appOpen in app"; + "class=\"app_banner_button_text\">Open in app " + "