Recent

Author Topic: Is there any library that would make process of making a website scrapper easier  (Read 1106 times)

Rave

  • Full Member
  • ***
  • Posts: 170
Basically I want to make a web scraper for one of the sites I love that has awful UI so that I can interact with it better. Is there any Lazarus/Free Pascal library that would make this process easier? I'd rather not parse HTML by hand.

Thaddy

  • Hero Member
  • *****
  • Posts: 15747
  • Censorship about opinions does not belong here.
Our member benibela has a good library for that:
https://www.benibela.de/sources_en.html#internettools
Simple example that extracts all hrefs from a page:
Code: Pascal  [Select][+][-]
  1. uses simpleinternet, xquery;
  2.  
  3. var a: IXQValue;
  4. begin
  5.   for a in process('https://freepascal.org', '//a/@href') do
  6.     writeln(a.toString);
  7. end.
You need to undefine USE_PASDBLSTRUTILS_FOR_JSON in internettoolsconfig.inc.
« Last Edit: August 10, 2024, 01:52:43 pm by Thaddy »
If I smell bad code it usually is bad code and that includes my own code.

 

TinyPortal © 2005-2018