Author Topic: Extract tables from web pages  (Read 174 times)

jj2007

  • Member
  • *****
  • Posts: 12479
  • Assembler is fun ;-)
    • MasmBasic
Extract tables from web pages
« 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
  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):