Extract data only from the last webpage in the search results


/ Published in: C#
Save to your folder(s)

uses a PageArea template to extract data from each page in the search results, but I will cancel the PageArea template if it is not on the last page.
I add a condition script to the template. The condition script checks to see whether there is a Next Page link on the webpage and, if so, cancels the template element.


Copy this code and paste it in your HTML
  1. using System;
  2. 02.using mshtml;
  3. 03.using VisualWebRipper;
  4. 04.public class Script
  5. 05.{
  6. 06. public static bool IsCondition(WrConditionArguments args)
  7. 07. {
  8. 08. try
  9. 09. {
  10. 10. if(args.InternalDataRow["navigationLink"] != "")
  11. 11. return false;
  12. 12. return true;
  13. 13. }
  14. 14. catch(Exception exp)
  15. 15. {
  16. 16. args.WriteDebug(exp.Message);
  17. 17. return true;
  18. 18. }
  19. 19. }
  20. 20.}

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.