Brandon Peffer
Brandon Peffer

Reputation: 1

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

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.

Upvotes: 0

Views: 250

Answers (1)

LetsScrapeData
LetsScrapeData

Reputation: 106

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 {}/[]

Upvotes: 0

Related Questions