Question 1
Here is the HTML code.
<div class="preferredContact paragraph">ph:<span preferredcontact="40">(02) 9540 9959</span></div>
I am trying to extract that phone number using xpath.
I have tried
data['phone'] = c.xpath('.//span[@preferredContact="40"]/text()')
and
data['phone'] = c.xpath('.//span[contains(@preferredContact,"40")]/text()')
Both of them return only null. Can someone show me the code to extract that phone number, please?
Question 2
HTML code is
<a rel="nofollow" title="View website for Ruth Newman Architect (in new window)" target="_blank" name="listing_website" id="websiteLink40" alreadysentorpevent="false" class="links ext-no-tooltip orpDuplicateEvent" href="/app/redirect?headingCode=27898&productId=473639214&productVersion=1&listingUrl=%2Fnsw%2Fgymea-bay%2Fruth-newman-architect-12781682-listing.html&webSite=http%3A%2F%2Fwww.ruthnewman.com.au&pt=w&context=businessTypeSearch&referredBy=YOL&eventType=websiteReferral">www.ruthnewman.com.au
</a>
I want to get the link which is located next to the string webSite=http%3A%2F%2F. This string is in the href attribute's value. So, in the above example, I want www.ruthnewman.com.au. I do not know how to get that using Xpath.
Can someone help out please?