i want href link of website form onclick function here html code in onclick function call website
<div class="fl"> <span class="talnk" onclick="ta.trackeventonpage('eatery_listing', 'website', 594024, 1); ta.util.cookie.setpidcookie(15190); ta.call('ta.util.link.targetblank', event, this, {'ahref':'lqmwjqzzyuwjqpecygii26xombqqoqnqqqqoqnqgoqnqqqqoqnqqqqoqnqqqqoqnqgoqnqqqqoqnqquuuqqoqnqqqqoqnxioqnqqqqoqnqq2eissmvcnvcjqqoqnqqqqoqnxioqnqqqqoqnqqniaqqoqnqqqqoqnqgoqnqqqqoqnqqwjqzhymjkh3khvadjjh3vvdb', 'isasdf':true})">website</span> </div>
normaly use code href link span or element
geturl = soup.findsoup("span", {"class": "talnk"}) link in geturl: hreflink = link.get("href") print(hreflink)
but in case there no way directly call href because href exist in onclick function
please me now
you cannot directly parse ahref
attribute, need extract onclick
first.
>>> import re >>> data = soup.select('.talnk')[0].get('onclick') >>> href = re.search(r"(?is)'ahref':'(.*?)'",str(data)).group(1) 'lqmwjqzzyuwjqpecygii26xombqqoqnqqqqoqnqgoqnqqqqoqnqqqqoqnqqqqoqnqgoqnqqqqoqnqquuuqqoqnqqqqoqnxioqnqqqqoqnqq2eissmvcnvcjqqoqnqqqqoqnxioqnqqqqoqnqqniaqqoqnqqqqoqnqgoqnqqqqoqnqqwjqzhymjkh3khvadjjh3vvdb'
Comments
Post a Comment