scrapy / scrapely

A pure-python HTML screen-scraping library
1.86k stars 315 forks source link

Extract from javascript? #108

Open randy-girard opened 6 years ago

randy-girard commented 6 years ago

Would it be possible to pull values out of javascript off a page? For example, I'm looking to pull some content that is contained within a string, such as "Here is some string with my value 1998". I want to annotate the 1998, however a lot of times I get a bunch of html with it too. But in the JS, there is a variable that holds what I need:

<script>
data['item'] = {
  "year": "1998"
};
</script>

Would this be possible?

Thx