Keyword Data Not Fetching

#1

Hi
Our Crawlers name is Ahref
I have try crawlers data on ahrefs
I want crawlers on keyword and volume. – https://www.screencast.com/t/uXsykX7hp
I have used follow code.
function pageFunction(context) {
// called on every page the crawler visits, use it to extract data from it
var = context.jQuery; var result = { keyword: (’. pe__metrics__row’).text(),
keyword:$(this).find(".text-xs-right").text().trim()
};
return result;
}
But Display on error - https://www.screencast.com/t/tt86yiQC
What is the issue?

#2

Hi @developerguru99,

You need to iterate over all tr element on that table. You have to do something like:

var data = [];
$('table#main_se_data_table tr').each(function() {
   data.push({
      key: $(this).find('#the_key_work_1').text().trim(),
      value: $(this).find('.text-xs-right').eq(0).text().trim()
   })
})

It is just pseudo code, I hope it helps. It hard to write example without access to HTML.