Skip to content

Instantly share code, notes, and snippets.

@alik472
Created March 30, 2023 07:50
Show Gist options
  • Save alik472/5cfd22e55ffb16143b3f3994d4300ff5 to your computer and use it in GitHub Desktop.
Save alik472/5cfd22e55ffb16143b3f3994d4300ff5 to your computer and use it in GitHub Desktop.
cron.js
const { XMLParser, XMLBuilder, XMLValidator } = require("fast-xml-parser");
const axios = require('axios')
const cheerio = require('cheerio');
axios.post("https://www.besoccer.com/rss_en.xml").then(data => {
const parser = new XMLParser();
let xml = parser.parse(data.data);
const readyData = xml.rss.channel.item
// title/link/guid/pubDate/author/description/content:encoded
firstData=readyData[0]['content:encoded']
const $ = cheerio.load(firstData);
const figcaption=$('figcaption').text()
const img=$('img').attr('src')
const h1=$('h1').first().text()
const h2=$('h2').first().text()
let pTags=[]
console.log("figcaption",figcaption)
console.log("img",img)
console.log("h1",h1)
console.log("h2",h2)
$('p').each((index,item)=>{
pTags.push($(item).text())
})
console.log("pTags",pTags)
// IMAGE
// figcaption
// H1
// H2
// p tags icinden strong/a/ falan taglari temizleyecik.
// temizlenen taglari textleri qalacaq
// VIDEO-larda problem olar biler
// lIVE COVERAGE problem ola biler
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment