Extract email address from Java script in html source using python

Joel Goldstick joel.goldstick at gmail.com
Sat May 23 10:29:27 EDT 2015


On Sat, May 23, 2015 at 10:15 AM, savitha devi <savithad8 at gmail.com> wrote:
> What I exactly want is the java script is in the html code. I am trying for
> a regular expression to find the email address embedded with in the java
> script.
>
> On Sat, May 23, 2015 at 2:31 PM, Chris Angelico <rosuav at gmail.com> wrote:
>>
>> On Sat, May 23, 2015 at 4:46 PM, savitha devi <savithad8 at gmail.com> wrote:
>> > I am developing a web scraper code using HTMLParser. I need to extract
>> > text/email address from java script with in the HTMLCode.I am beginner
>> > level
>> > in python coding and totally lost here. Need some help on this. The java
>> > script code is as below:
>> >
>> > <script type='text/javascript'>
>> >  //<!--
>> >  document.getElementById('cloak48218').innerHTML = '';
>> >  var prefix = 'ma' + 'il' + 'to';
>> >  var path = 'hr' + 'ef' + '=';
>> >  var addy48218 = 'info' + '@';
>> >  addy48218 = addy48218 + 'tsv-neuried' + '.' +
>> > 'de';
>> >  document.getElementById('cloak48218').innerHTML += '<a ' + path + '\''
>> > +
>> > prefix + ':' + addy48218 + '\'>' + addy48218+'<\/a>';
>> >  //-->
>>
>> This is deliberately being done to prevent scripted usage. What
>> exactly are you needing to do this for?
>>
>> You're basically going to have to execute the entire block of
>> JavaScript code, and then decode the entities to get to what you want.
>> Doing it manually is pretty easy; doing it automatically will
>> virtually require a language interpreter.
>>
>> ChrisA
>> --
>> https://mail.python.org/mailman/listinfo/python-list
>
>
>
> --
> https://mail.python.org/mailman/listinfo/python-list
>
I've not used it, but doesn't Selenium help do this?  From what I
understand it gets the resultant html of a web page after the
javascript has run


-- 
Joel Goldstick
http://joelgoldstick.com



More information about the Python-list mailing list