CA
stormy-gold
Web Scraper
From the console I can get the text I want
$('span.val').get(0).textContext;
However when I try the following Apify doesn't seem toe like the get
WARN PuppeteerCrawler: Reclaiming failed request back to the list or queue. $(...).get(...).text is not a function
Any pointers to get me past this point are most welcome
async function pageFunction(context) {
// This statement works as a breakpoint when you're trying to debug your code. Works only with Run mode: DEVELOPMENT!
// debugger;
// jQuery is handy for finding DOM elements and extracting data from them.
// To use it, make sure to enable the "Inject jQuery" option.
const $ = context.jQuery;
const pageTitle = $('title').first().text();
const length = $('span.val').get(0).text();
7 Replies
optimistic-gold•3y ago
Perhaps
$('span.val').get(0)
return nothing/undefinedWould help if you share what you want to get from what page.
stormy-goldOP•3y ago
I seem unable to append to my original message Seems very dumb...
stormy-goldOP•3y ago
https://www.jeanneau.com/en-gb/boats/sailboat/2-sun-odyssey/37-sun-odyssey-349/ The get boat details length etc
Sun Odyssey 349 | Jeanneau Boats
An enormous success in the Sun Odyssey line, this sailboat is responsive at the helm and easy to handle, for experienced sailors and motivated beginners,...
@Deleted User just advanced to level 1! Thanks for your contributions! 🎉
and
get(0)
should return first element? it does not work for me on the page, normal syntax is $('span.val').eq(0).text()
stormy-goldOP•3y ago
OK Let me check that Thanks for the reply
That worked Great thanks Honza