Parser code is available
try
{
id_source = await ParsingAll(0, "#adv_id", "");
foto_path = await ParsingAll(1, "img[id='print_user_photo']", "src");
position = await ParsingAll(0, "div.title.adv-title.newTitle > h1", "");
catch (Exception ex)
{
Error?.Invoke(id_source + "- Error - ");
}
How to do if an error occurs in the string "foto_path", then after processing the try / catch error, the program continued to work and began to execute the string "position"?
One way is that to add try catch inside your ParseAll method :
ParsingAll()
{
try
{
}
catch(Exception e)
{
}
}
and you can call them normally:
id_source = await ParsingAll(0, "#adv_id", "");
foto_path = await ParsingAll(1, "img[id='print_user_photo']", "src");
position = await ParsingAll(0, "div.title.adv-title.newTitle > h1", "");
and return some status with result to tell if it was successful or not.
Or you will need to wrap it separately each of them so that the next statements should execute in case of that one fails:
try
{
foto_path = await ParsingAll(1, "img[id='print_user_photo']", "src");
}
catch(Exception e)
{
}
position = await ParsingAll(0, "div.title.adv-title.newTitle > h1", "");
But this all depends on the program requirements how the flow will go.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With