Browse Source

Fixed exception when no description found for youtube.

tags/3.1.0
Teknikode 4 years ago
parent
commit
94064ebb18
1 changed files with 6 additions and 0 deletions
  1. 6
    0
      Modules/YouTube/YouTube.cs

+ 6
- 0
Modules/YouTube/YouTube.cs View File

@@ -80,6 +80,12 @@ namespace Combot.Modules.Plugins
string page = web.DownloadString(searchUrl);

JObject parsed = (JObject) JsonConvert.DeserializeObject(page);

if (!parsed["items"].Any())
{
return "\u0002No Results\u0002";
}

var data = parsed["items"].First();

description = string.Format("\u0002{0}\u000F", data["snippet"]["title"]);

Loading…
Cancel
Save