Answer the question
In order to leave comments, you need to log in
How to display a link from parsing in NODEJS?
Help out guys.
I'm doing something like a parse, below is the code:
const osmosis = require('osmosis');
const fs = require('fs');
let savedData = [];
osmosis
.get('https://##########//profi')
.find('.user-preview')
.set({
'Name': '.user-preview_name',
'Specialization': '.user-preview_specialization',
'City': '.user-preview_city',
'URL': '.data-url',
})
.data(function(data) {
console.log(data);
savedData.push(data);
})
.done(function() {
fs.writeFile('data.json', JSON.stringify( savedData, null, 4), function(err) {
if(err) console.error(err);
else console.log('Data Saved to data.json file');
})
});
<div class="user-contacts" data-component="userContacts" data-url="https://www.###########/contacts" data-component-ready="true"><a class="js-userContactsShow" href="#">Показать контакты</a></div>
Answer the question
In order to leave comments, you need to log in
I was looking for this answer myself and finally found it.
if you need to take values from which "tag" then before the name you just need to insert @ - dog and then the name of the "tag", for example @href
Option 1: stupidly follow the link
.follow('[email protected]')
.find(.....)
.set(.....)
....
.click('.js-userContactsShow')
.delay(500)
.find(......)
.set(.....)
....
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question