Skip to content

Latest commit

 

History

History
117 lines (104 loc) · 6.34 KB

README.md

File metadata and controls

117 lines (104 loc) · 6.34 KB

Icarus-Sef parser

GitHub version npm version npm npm GitHub issues Libraries.io for GitHub Known Vulnerabilities GitHub stars GitHub forks GitHub issues Build StatusCoverage Status codecov Code Climate Issue Count Twitter Dependency Status devDependency Status semantic-release Bundle Phobia Bundle Phobia

A simple module to parse https://icarus-icsd.aegean.gr and https://sef.math.aegean.gr websites to get students marks or send requests to each department's office. This currently only works with icarus and sef. In the future i'm gonna add functionality for all the departments of the Aegean University.

NPM

Install

npm install --save icarus-sef-parser

How to use

Create a new object of parser and give username and password to initialize.

require('icarus-sef-parser');

var parser = new auth(USERNAME, PASSWORD);

Below is an example of how to use some of the api functionality.

parser.printStudent();
console.log(parser.getSessionInfo());
console.log(parser.getDepartmentName());

// authenticate and test the other api
parser.authenticate(function (error, response) {
    console.log(response);
    console.log((response.authenticated) ? "Authenticated" : "Authentication Failed.");

    parser.getUserDetails(response.document, response.cookie, function (err, data) {
        if (err) {
            return console.log(err.message)
        }
        console.log(data)
    });
    parser.getSucceededGrades(response.document, function (err, value) {
        if (err) {
            return console.log(err.message)
        }
        console.log(value)
    });
    parser.getAnalyticGrades(response.document, function (err, value) {
        if (err) {
            return console.log(err.message)
        }
        console.log(value)
    });
    parser.getExamGrades(response.document, function (err, value) {
        if (err) {
            return console.log(err.message)
        }
        console.log(value)
    });
    parser.getIntercalaryExamGrades(response.document, function (err, value) {
        if (err) {
            return console.log(err.message)
        }
        console.log(value)
    });
    parser.getCurriculumToDeclare(response.cookie, function (err, value) {
            if (err) {
                console.log('error:', err.message); // Print the error if one occurred
            }
    
            var formData = [];
            for (var i in value) {
                formData.push(value[i].id);
            }
    
            // call postCurriculumToDeclare(formData,  (err, value) {....}) to post them
        });
    parser.postCurriculumToDeclare(['321-2450',
        '331-2205',
        '321-4120',
        '311-0116',
        '311-0238',
        '311-0327',
        '311-0437',
        '331-2708'], response.cookie, function (err, value) {
        if (err) {
            console.log('error:', err.message); // Print the error if one occurred
        }

        console.log(value);
    });
    parser.postRequestToDepartment({
        id: 'test',
        surname: 'test',
        name: 'test',
        father: 'test',
        semester: 'test',
        address2: 'test',
        address: 'test',
        phone: 'test',
        emergency: 'test',
        method: 'test',
        sent_address: 'test',
        other: 'test',
        requests: [
                    {name: 'Βεβαίωση Σπουδών', amount: '1'},
                    {name: 'Βεβαίωση Διαγραφής', amount: '3'},
                    {name: 'Αλλο', amount: '9', what: 'κάτι άλλο'}
                ]
    }, response.cookie, function (err, value) {
        if (err) {
            console.log('error:', err.message); // Print the error if one occurred
        }

        console.log(value);
    })
});

Coding Activity

wakatime