Importxml data-href to GSheet - google-sheets-formula

Good day everyone;
I am trying to import the data-href attribute from this url. I tried using importxml in gsheet but nothing works. Please helpp
https://www.softwareadvice.com/manufacturing/exact-jobboss-profile/
<a id="visit-website" class="button primary md visit-website ppc " rel="nofollow noopener" data-href="https://jobboss.com/job-shop-manufacturing-software/jobboss" data-text="Visit Website" target="_blank">Visit Website
Thanks in advance
I tried using this formula but can't seem to figure out.
=IMPORTXML(https://www.softwareadvice.com/manufacturing/exact-jobboss-profile/,"//section[#class='button-cta']")

Related

Trouble grabbing background image url with importxml / xpath

I'm trying to scrape some background image urls into a google sheet. Here is an example of the container-
<div class="_rs9 _1xcn">
<div class="_1ue-">
<section class="_4gsw _7of _1ue_" style="background-image: url(https://scontent.x.com/v/t64.5771-25/38974906_464042117451453_1752137156853235712_n.png?_nc_cat=100&_nc_ht=scontent.x.com&oh=c19f15536205be2e1eedb7f7fc7cb61b&oe=5C4442FD)">
<div class="_7p2">
</div>
</section>
I need to get from the https to the question mark after png. I know there's a way to use substring-before/-after but I am having a tough time, particular with escaping quotes.
Here is my attempt. This just gets me an "#N/A":
=IMPORTXML(B2,"substring-before(substring-after(//section[#class='_4gsw _7of _1ue_']/#style, """"background-image: url(""""), """")"""")")
Could anyone help with the full importxml statement? Much appreciated, thanks.
Your approach was close. Try the following XPath expression:
substring-before(substring-after(//section[#class='_4gsw _7of _1ue_']/#style, 'background-image: url('),'?')
The whole expression could look like this:
=IMPORTXML(B2,"substring-before(substring-after(//section[#class='_4gsw _7of _1ue_']/#style, 'background-image: url('),'?')")

Selecting with Xpath in Scrapy

I'm using Scapy to scrape some data from a site and I need help using Xpath to select "data" from the following.
<span class="result_item"><span class="text3"><span class="header_text3">**data**</span><br />
**data**<br />
**data**</span> <span class="phone_button_out"><span class="phone_button" style="margin-top: 0"
onclick="pageTracker._trackEvent('USDSearch','Call Now!F');phone_win.open('name','**data**',27101650,0)">
Call Now!<br />
</span></span>
What statements can I use to select the necessary data? I hope this isn't a stupid question. If it is, please point me in the right direction.
There are multiple data elements to get in the posted html. Assuming that <span class="result_item"> is parent of the items, you can try the following:
To get header:
//span[#class='result_item']/span[#class='header_text3']/text()
To get anchor link data:
//span[#class='result_item']/a/text()
Also, to help with xpaths, install Firebug Addon in Firefox, then FirePath addon on Firebug. Pointing to elements will give you autogenerated xpaths (good for beginners. sometime needs xpath tuning)

DataTables warning: Attempted to initialise DataTables on a node which is not a table: FORM

I have this error message coming up after I have deployed DataTables inside of my application. I cannot see where this would be coming from as I haven't declared anything in my JS that would cause it. All the tables have got unique names and so do my divs. I have found this which was the same issue but his workaround doesn't seem to apply to my problem:
http://www.datatables.net/forums/discussion/7668/datatables-warning-attempted-to-initialise-datatables-on-a-node-which-is-not-a-table-div/p1
Anyone have any pointers? Google doesn't seem to be able to help so looking at you guys for assistance.
Cheers
Nick
UPDATE:
This is still causing me an issue. could anyone assist or point in the right direction?
You are probably using an id on the datatable whereas you are also declaring another item in the same page with the same id.
I had the same problem:
I had this in my code:
<div class="modal fade span3 ui-corner-all" id="cheques" style="display: none">
and I also had
<table class="table table-nomargin dataTable table-bordered" id="cheques">
I renamed on of the element's id and it worked ;)

HtmlUnit - getTextContent()

I´m working whith HTMLUnit, I need get text content of a HtmlAnchor but only text no more tags html have.
<a class="subjectPrice" href="http://www.terra.es/?ca=28_s&st=a&c=4" title="Opel Zafira Tourer 2.0 Cdti 165 Cv Excellence 5p. -12">
<span class="old_price">32.679€</span>
24.395€
If I execute htmlAnchor.getTextContent() it´s return 32.679€ 24.395€, but I only need 24.395€
Anybody can help me? thanks.
Just use XPath to get the appropriate DomText node. It seems that ./text() taking as a reference the HtmlAnchor should be enough.

Beginner: Refreshing a part of a site using AJAX

I want to refresh with ajax just a part of a site.I searched protorypjs and i found ajax.updater but i am having trobule making it work.
this is part of my page
<li id="Home">Home</li>
Can anyone tell me how i can implement this : Ajax.Updater(container, url[, options]) ?
and make it work?
I linked prototype.js in the html.
One solution to update content is by using
$('#refreshMe').innerHtml(_new_ajax_content_);
where element is i.e. a
<div id="refreshMe">
If you want more specific help, you should post more information/code from your project.
thank you for the help. i made it work
here is what i wanted to do :)
<li id="Servicii"><a href=# onclick="new Ajax.Updater('container', 'servicii.html',
{asynchronous:true});">Servicii

Resources