Trying some bugfix (scraping)
This commit is contained in:
@ -136,25 +136,31 @@ namespace BrowserHelper.Extensions
|
|||||||
//GlobalStopwatch.PrintSecs("Before scraplooping");
|
//GlobalStopwatch.PrintSecs("Before scraplooping");
|
||||||
foreach (var row in rows)
|
foreach (var row in rows)
|
||||||
{
|
{
|
||||||
var element = row.FindElement(By.XPath(".//td"));
|
try
|
||||||
if (!shareSet.Contains(element.Text)) { }
|
|
||||||
else
|
|
||||||
{
|
{
|
||||||
var colDatas = row.FindElements(By.TagName("td"));
|
var element = row.FindElement(By.XPath(".//td"));
|
||||||
if (colDatas.Count != 0 && shares.Contains(colDatas[0].Text))
|
if (!shareSet.Contains(element.Text)) { }
|
||||||
|
else
|
||||||
{
|
{
|
||||||
shareCollection.Add(new DiTraderStockRow
|
var colDatas = row.FindElements(By.TagName("td"));
|
||||||
|
if (colDatas.Count != 0 && shares.Contains(colDatas[0].Text))
|
||||||
{
|
{
|
||||||
StockName = colDatas[columnPos["Aktie"]].Text,
|
shareCollection.Add(new DiTraderStockRow
|
||||||
LatestPrice = decimal.Parse(colDatas[columnPos["Senast"]].Text==""?"-0,1": colDatas[columnPos["Senast"]].Text),
|
{
|
||||||
TimeOfDay = TimeSpan.Parse(colDatas[columnPos["Tid"]].Text)
|
StockName = colDatas[columnPos["Aktie"]].Text,
|
||||||
});
|
LatestPrice = decimal.Parse(colDatas[columnPos["Senast"]].Text == "" ? "-0,1" : colDatas[columnPos["Senast"]].Text),
|
||||||
|
TimeOfDay = TimeSpan.Parse(colDatas[columnPos["Tid"]].Text)
|
||||||
|
});
|
||||||
|
|
||||||
rowIndex++;
|
rowIndex++;
|
||||||
//antal--;
|
//antal--;
|
||||||
shareSet.Remove(element.Text);
|
shareSet.Remove(element.Text);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
catch (Exception)
|
||||||
|
{
|
||||||
|
}
|
||||||
//if (antal < 1) break;
|
//if (antal < 1) break;
|
||||||
if (shareSet.Count < 1) break;
|
if (shareSet.Count < 1) break;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user