Home > Blockchain >  Web Scraping Using Power Query
Web Scraping Using Power Query

Time:09-20

Trying to access PubChem via Power BI however I am running into the following issue:

This application requires Javascript. Please turn on Javascript in order to use this application.

Just wondering if anyone knows why this occurs and if there is any workarounds to it?

Appears to be somewhat of a local issue to PubChem however, I have successfully accessed pages here before via Power BI/Query.

M Code:

let
    Source = Web.BrowserContents("https://pubchem.ncbi.nlm.nih.gov/compound/311"),
    #"Extracted Table From Html" = Html.Table(Source, {{"Column1", "BODY"}}),
    Column1 = #"Extracted Table From Html"[Column1]{0}
in
    Column1

This question here appears to also run into this isue: Selenium Chrome web driver inconsistently executes JS scripts on webpages

CodePudding user response:

It is loading JSON from an API in the background so needs the JS to load it. Just access the API directly.

let
    Source = Json.Document(Web.Contents("https://pubchem.ncbi.nlm.nih.gov/rest/pug_view/data/compound/311/JSON/")),
    Record = Source[Record],
    Section = Record[Section]
in
    Section
  • Related