Skip to content
This repository has been archived by the owner on Dec 12, 2018. It is now read-only.

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
Jason Sadler committed Sep 26, 2018
1 parent 0ac4ce5 commit 7a53721
Showing 1 changed file with 5 additions and 11 deletions.
16 changes: 5 additions & 11 deletions src/bat_get_media.cc
Original file line number Diff line number Diff line change
Expand Up @@ -95,14 +95,8 @@ void BatGetMedia::getPublisherInfoDataCallback(const std::string& mediaId, const
return;
}

std::vector<std::string> split = braveledger_bat_helper::split(mediaId, '_');
std::string new_media_id = mediaId;
if (!split.empty()) {
new_media_id = split[0];
}

if (!publisher_info.get()) {
std::string mediaURL = getMediaURL(new_media_id, providerName);
std::string mediaURL = getMediaURL(mediaId, providerName);
if (YOUTUBE_MEDIA_TYPE == providerName) {
auto request = ledger_->LoadURL((std::string)YOUTUBE_PROVIDER_URL + "?format=json&url=" + ledger_->URIEncode(mediaURL),
std::vector<std::string>(), "", "", ledger::URL_METHOD::GET, &handler_);
Expand All @@ -118,12 +112,12 @@ void BatGetMedia::getPublisherInfoDataCallback(const std::string& mediaId, const
_2,
_3));
} else if (TWITCH_MEDIA_TYPE == providerName) {
const std::string mediaUrl = getMediaURL(new_media_id, providerName);
const std::string mediaUrl = getMediaURL(mediaId, providerName);
std::unique_ptr<ledger::PublisherInfo> new_publisher_info(new ledger::PublisherInfo());
new_publisher_info->favicon_url = "";
new_publisher_info->url = mediaUrl + "/videos";
std::string id = providerName + "#author:" + new_media_id;
new_publisher_info->name = new_media_id;
std::string id = providerName + "#author:" + mediaId;
new_publisher_info->name = mediaId;
new_publisher_info->id = id;

ledger::TwitchEventInfo oldEvent;
Expand Down Expand Up @@ -344,7 +338,7 @@ void BatGetMedia::getPublisherInfoCallback(const uint64_t& duration, const std::

std::string BatGetMedia::getMediaURL(const std::string& mediaId, const std::string& providerName) {
std::string res;

DCHECK(!mediaId.empty());
if (YOUTUBE_MEDIA_TYPE == providerName) {
res = "https://www.youtube.com/watch?v=" + mediaId;
Expand Down

0 comments on commit 7a53721

Please sign in to comment.