Forum Discussion

Hitesh's avatar
Hitesh
New Member
4 years ago

Web scraping all columns in POWER Query

Dear PowerBI Experts,

 

I am trying to import all columns from the below link which is just show timings from each theatre in movie ticketing website but its showing only 26 columns , is there any way to import all columns ? 

 

Please refer M code below


let
Source = Web.BrowserContents("https://in.bookmyshow.com/buytickets/james-bengaluru/movie-bang-ET00312373-MT/20220315"),
#"Extracted Table From Html" = Html.Table(Source, {{"Column1", ".__venue-name"}, {"Column2", ".showtime-pill-container:nth-child(1) .__text"}, {"Column3", ".showtime-pill-container:nth-child(2) .__text"}, {"Column4", ".showtime-pill-container:nth-child(3) .__text"}, {"Column5", ".venue-info-text"}, {"Column6", ".showtime-pill-container:nth-child(4) .__text"}, {"Column7", ".showtime-pill-container:nth-child(5) .__text"}, {"Column8", ".__mticket-info LABEL"}, {"Column9", ".__fnb-info LABEL"}, {"Column10", ".showtime-pill-container:nth-child(6) .__text"}, {"Column11", ".venue-flags-details"}, {"Column12", ".showtime-pill-container:nth-child(7) .__text"}, {"Column13", ".showtime-pill-container:nth-child(8) .__text"}, {"Column14", ".showtime-pill-container:nth-child(9) .__text"}, {"Column15", ".showtime-pill-container:nth-child(10) .__text"}, {"Column16", ".showtime-pill-container:nth-child(11) .__text"}, {"Column17", ".showtime-pill-container:nth-child(4) .attribute"}, {"Column18", ".showtime-pill-container:nth-child(1) .attribute"}, {"Column19", ".showtime-pill-container:nth-child(12) .__text"}, {"Column20", ".showtime-pill-container:nth-child(5) .attribute"}, {"Column21", ".offer-text:nth-child(2)"}, {"Column22", ".offer-text:nth-child(4)"}, {"Column23", ".showtime-pill-container:nth-child(13) .__text"}, {"Column24", ".showtime-pill-container:nth-child(6) .attribute"}, {"Column25", "._sold + ._filling .attribute"}, {"Column26", "._sold + ._sold .attribute"}}, [RowSelector=".wrapper .list"]),
#"Changed Type" = Table.TransformColumnTypes(#"Extracted Table From Html",{{"Column1", type text}, {"Column2", type time}, {"Column3", type time}, {"Column4", type time}, {"Column5", type text}, {"Column6", type time}, {"Column7", type time}, {"Column8", type text}, {"Column9", type text}, {"Column10", type time}, {"Column11", type text}, {"Column12", type time}, {"Column13", type time}, {"Column14", type time}, {"Column15", type time}, {"Column16", type time}, {"Column17", type text}, {"Column18", type text}, {"Column19", type time}, {"Column20", type text}, {"Column21", type text}, {"Column22", type text}, {"Column23", type time}, {"Column24", type text}, {"Column25", type text}, {"Column26", type text}}),
#"Unpivoted Other Columns" = Table.UnpivotOtherColumns(#"Changed Type", {"Column1"}, "Attribute", "Value"),
#"Changed Type1" = Table.TransformColumnTypes(#"Unpivoted Other Columns",{{"Value", type time}}),
#"Removed Errors" = Table.RemoveRowsWithErrors(#"Changed Type1", {"Value"}),
#"Removed Columns" = Table.RemoveColumns(#"Removed Errors",{"Attribute"}),
#"Renamed Columns" = Table.RenameColumns(#"Removed Columns",{{"Column1", "Theatre"}})
in
#"Renamed Columns"

 

 

 

1 Reply

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi Hitesh ,

     

    You may try Extract data from a Web page by example in Power BI Desktop - Power BI | Microsoft Docs  So you can essentially show Power BI Desktop which data you want to extract by providing one or more examples within the connector dialog. Power BI Desktop gathers other data on the page that match your examples. With this solution you can extract all sorts of data from Web pages, including data found in tables and other non-table data.

     

    Best Regards,
    Eyelyn Qin
    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.