How to can extract data from a <script>window.Flourish

70 Views Asked by At

I am trying to extract data from a website that uses Flourish. It uses JavaScript to load the data via Flourish link (iframe) I believe. The data is in a script tag.

Full Xpath" /html/body/main/div[1]/div/div/div[2]/div/script

and then iframe Full Xpath: /html/body/script[4]

The data is after

"var _Flourish_data_column_names" and "_Flourish_data ="

I have had success using selenium, but having issues using it on my main computer. I would like to be able to use BeatuifulSoup.

1

There are 1 best solutions below

0
LetsScrapeData On

what's the url?

Potential Solutions: (in javascript)

  • Solution 1: find the start and end index (String.indexOf) and get substring between them (String.slice)
  • Solution 2: use regular express (String.match)
  • Solution 3: find the open and close character, such as {}/[]