repl.it
@octavelr/

fetch dnb results

Nodejs

No description

fork
loading
Files
  • index.js
  • Packager files
  • package-lock.json
  • package.json
index.js
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
const express = require('express');
const nodefetch = require('node-fetch');

const app = express();

app.get('/', (req, res) => {
    var students_list = [
        'Adib',
        'Bernard',
        'Butuner',
        'Graff',
        'Huillet',
        'John Hassan Geshi',
        'Kaempfer',
        'Le Roy',
        'Mignot',
        'Mital',
        'Moreau',
        'Morel',
        'Ndjiki-Nya',
        'Quetin',
        'Richard',
        'Sentuc',
        'Schenk',
        'Vingas--Rauh',
        'Bhar',
        'Bestvater',
        'Ehone',
        'Kuszli',
        'Salemi',
        'Boullet',
        'Sanogo',
        'Svelka',
        'Trbovic'
    ]
    let body;
    students_list.forEach(function(student) {
        nodefetch('http://c-resultats.ac-strasbourg.fr/publication_A15/publication?filtre='+ student +'&domaine=DNB&groupeDecision=1&session=2019%3AB%3ADNB-2.1&entiteResponsable=R16&_=1562792009614/')
        .then(res => {
            res.text()
        })
        .then(student_data => {
            console.log(student_data)
            return body += student_data;
        }).then(body => {
            res.send(body);
        })
    });
    res.send(body);
});

app.listen(8080, () => {
  console.log('server started');
});
Fetching token
?