-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.js
More file actions
32 lines (25 loc) · 807 Bytes
/
index.js
File metadata and controls
32 lines (25 loc) · 807 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
const PORT = 8000
const axios = require('axios')
const expess = require('express')
const cheerio = require('cheerio')
const app = expess()
app.listen(PORT, () => console.log('listening to PORT'))
url = 'https://www.tagesschau.de/'
axios(url).then(response => {
const html = response.data
const $ = cheerio.load(html)
const dataArray = []
$('.teaser__link' ,html).each(function(){
const title = $(this).find('.teaser__headline').text()
const topic = $(this).find('.teaser__topline').text()
const short = $(this).find('p').html()
const image = $(this).find('img').attr('src')
dataArray.push({
topic,
title,
short,
image
})
})
console.log(dataArray)
}).catch(err => console.log(err))