The MASM Forum

Members Gallery => Showcase => Topic started by: jj2007 on May 31, 2022, 08:51:03 PM

Title: Extract tables from web pages
Post by: jj2007 on May 31, 2022, 08:51:03 PM
A little tool to extract tables from web pages and view them in Excel (or whatever application handles *.tab files on your machine):

include \masm32\MasmBasic\MasmBasic.inc         ; download (http://masm32.com/board/index.php?topic=94.0)
  Init
  Let edi="https://en.wikipedia.org/wiki/List_of_countries_by_income_equality"  ; for example
  .While 1
        Let edi=Input$("URL: ", edi)
        .Break .if Len(edi)==0
        Let esi=FileRead$(edi)  ; get html from the URL
        FileWrite "~tmp.tab", NoTag$(esi)       ; write to disk without HTML tags
       ShEx "~tmp.tab"         ; launch the application associated with *.tab (often Excel)
  .Endw
EndOfCode


About a second after you hit Return, M$ Excel should show you something like this (if not, let me know):

(https://www.jj2007.eu/pics/LifeExpectancyExcel.png)