private static int GetIntResultScore(this XElement results, string selector)
{
int res = 0;
try
{
string value = (from p in results.Elements("result") where p.Attribute("value").Value == selector select p.Attribute("numvotes").Value).FirstOrDefault();
if (value != null)
int.TryParse(value, out res);
}
catch (Exception)
{
return 0;
}
return res;
}
public static int GetRanking(this XElement rankingElement)