Skip to content

Commit

Permalink
fixed youtu.be links not working
Browse files Browse the repository at this point in the history
  • Loading branch information
bl4ckscor3 committed Sep 28, 2016
1 parent 663752c commit 1351202
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/bl4ckscor3/bot/bl4ckb0t/misc/YouTubeStats.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import org.pircbotx.Colors;

import bl4ckscor3.bot.bl4ckb0t.localization.L10N;
import bl4ckscor3.bot.bl4ckb0t.logging.Logging;
import bl4ckscor3.bot.bl4ckb0t.util.Utilities;

public class YouTubeStats
Expand Down Expand Up @@ -40,10 +41,14 @@ public static void sendVideoStats(String link, String channel) throws MalformedU
}
}
else if(link.contains("youtu.be/"))
yt = link;
yt = "www.youtube.com/watch?v=" + link.split("youtu.be/")[1];

//shouldn't happen
if(yt == null)
{
Logging.warn("YouTube link is null - " + link);
return;
}

//if someone posts the link without a space between the link and the word before it
if(!yt.startsWith("w"))
Expand Down

0 comments on commit 1351202

Please sign in to comment.