1

I am parsing a HTML Page using Python + lxml etree and I am able to extract all data present within HTML tags. Few static data is embedded within javascript and I am unable to parse it. E.g

 <td valign="top" width="80%">
    <script language="javascript" type="text/javascript">


    function AddItem() { 
    .
    .
    .
    if (st.value == 'VAL1') {
    strValues = document.getElementById('Element1').value;
                        }
    else if (st.value == 'VAL2') {
    strValues = document.getElementById('Element2').value;
                        }
    else if (st.value == 'VAL3') {
    strValues = document.getElementById('Element3').value;
                        }
    .
    .
    .
    </script>
  </td>

I would like to extract data as follows

{ VAL1 : Element1 , VAL2 : Element2 , VAL3 : Element3 }

Let me know if this is possible using python

Manuel
  • 287
  • 5
  • 15
  • 1
    [These pynarcissus answers](http://stackoverflow.com/a/8752573/20394) describe a Python library form dealing with JS source (and there's an [sexp](https://code.google.com/p/pynarcissus/source/browse/trunk/sexp.py) translation) and you seem to already know about lxml to parse the HTML. – Mike Samuel May 19 '14 at 15:05

0 Answers0