Я привязываю к очистке веб-страницы с помощью nodejs (request или axios), push-запроса.И ответ я получу так:
<div class="some"> {{ some }} </div>
Ответ Exampel
Как убрать этот 'некоторый' текст значения?
Сначала установите эти npm модули:
npm. Я запрашиваю запрос-обещание cheerio
Ключевой момент - cheerio *Модуль 1010 *, позволяющий использовать jQuery на сервере.Вот пример кода, который извлекает текст из первого найденного тега div.
const cheerio = require('cheerio') const request = require('request-promise') request('https://google.com') .then(htmlResponse => { // Here you html comes // Lets assume that returned html is that follows htmlResponse = '<div class="some">{{ some }}</div>' const $ = cheerio.load(htmlResponse) const [firstFoundDiv] = $('div').toArray() console.log(firstFoundDiv.children[0].data); // {{ some }} is an output }) .catch(console.error)
PS Используйте любой нужный вам URL сайта вместо google.com