Lấy dữ liệu nhiều trang từ web
Trang web https://www.cophieu68.vn/companylist.php?currentPage=1&o=s&ud=a với số 1 là số thứ tự trang muốn lấy.
Code lấy 20 trang từ 1 đến 20 như sau:
Trang web https://www.cophieu68.vn/companylist.php?currentPage=1&o=s&ud=a với số 1 là số thứ tự trang muốn lấy.
Code lấy 20 trang từ 1 đến 20 như sau:
PHP:
let
InitialWeb = "https://www.cophieu68.vn/companylist.php?currentPage=",
EndWeb = "&o=s&ud=a",
Pages = {1..20},
Source = List.Transform(Pages, (p)=>
let
Source0 = Web.Page(Web.Contents(InitialWeb & Text.From(p) & EndWeb)){0}[Data]
in Source0),
ColumnList = Table.ColumnNames(Source{0}),
Source1= Table.FromList(Source,Splitter.SplitByNothing()),
Result =Table.ExpandTableColumn(Source1,"Column1",ColumnList)
in
Result
Lần chỉnh sửa cuối: