mati365 / librus-api Goto Github PK
View Code? Open in Web Editor NEWUnofficial advanced node.js Librus scraping API(http://synergia.librus.pl/)
Home Page: http://synergia.librus.pl/
Unofficial advanced node.js Librus scraping API(http://synergia.librus.pl/)
Home Page: http://synergia.librus.pl/
W readme, w przykładzie mamy client.homework.listHomeworks
tymczasem w API jest listHomework (bez s na końcu).
PS super kod pozdrawiam
Podczas próby połączenia z librusem, wyskakują same błedy na temat axiosa.
Aktualny kod
const Librus = require("librus-api");
let client = new Librus();
client.authorize(name, password).then(() => {
console.log("Logged in");
}).catch((err: any) => {
console.error(err);
});
Błąd
(Login in daje siępoprzez kod, ale nie wiem czemu bo nie chce się zalogować defacto)
getMessage()
bezproblemowo podaje tytuł, treść czy inne pierdoły ale nie ma pola file które pozwalało by na pobranie plików
propozycja zmiany w inbox.js
173c173
< , "form[name='formOgloszenia'] table.decorated.form"
---
> , "table.decorated"
Po invokowaniu
client.authorize('*******', '*******').then( client.inbox.listReceivers("nauczyciel").then(data => {console.log(data)}) )
otrzymuje
Unhandled rejection StatusCodeError: 500 - "" at new StatusCodeError (C:\Users\nate2463\Desktop\nwd-rel-zwln\node_modules\request-promise-core\lib\errors.js:32:15) at Request.plumbing.callback (C:\Users\nate2463\Desktop\nwd-rel-zwln\node_modules\request-promise-core\lib\plumbing.js:104:33) at Request.RP$callback [as _callback] (C:\Users\nate2463\Desktop\nwd-rel-zwln\node_modules\request-promise-core\lib\plumbing.js:46:31) at Request.self.callback (C:\Users\nate2463\Desktop\nwd-rel-zwln\node_modules\request\request.js:185:22) at Request.emit (events.js:210:5) at Request.EventEmitter.emit (domain.js:498:23) at Request.<anonymous> (C:\Users\nate2463\Desktop\nwd-rel-zwln\node_modules\request\request.js:1161:10) at Request.emit (events.js:210:5) at Request.EventEmitter.emit (domain.js:498:23) at IncomingMessage.<anonymous> (C:\Users\nate2463\Desktop\nwd-rel-zwln\node_modules\request\request.js:1083:12) at Object.onceWrapper (events.js:299:28) at IncomingMessage.emit (events.js:215:7) at IncomingMessage.EventEmitter.emit (domain.js:498:23) at endReadableNT (_stream_readable.js:1184:12) at processTicksAndRejections (internal/process/task_queues.js:80:21)
Wszystko inne działa
Zaktualizujesz projekt na NPM? Bo tam nadal jest wersja z przed fixa getNotifications()
Nie mam pojecia jak ma dzialac to api, probuje recznie robic requesty do librusa ale nie dostaje nic w odpowiedzi
natomiast tutaj listInbox(5) zwraca bardzo malo wiadomosci, da sie jakos zrobic zeby zwracal wszystkie?
nie ważne? zachowanie sie zmienia z czasem, raz zwraca niepelna liste raz pelna
Jak to włączyć
Hello,
I tried to use client.calendar.getTimetable()
and got a 404 AxiosError.
Code:
"use strict";
const Librus = require('librus-api');
const client = new Librus();
client.authorize('<login>', '<password>').then(function ()
{
client.calendar.getTimetable().then((data) => {console.log(data)});
});
Error:
C:\Users\jozek\Developer\librus\node_modules\axios\dist\node\axios.cjs:1913
reject(new AxiosError(
^
AxiosError: Request failed with status code 404
...
The response also has this html content (part of it):
' <h3>Błąd HTTP 404.0 — Not Found</h3> \n' +
' <h4>Zasób, do którego chcesz uzyskać dostęp, został usunięty, jego nazwa uległa zmianie lub jest okresowo niedostępny.</h4> \n' +
I don't know if this is a Librus configuration issue by my school administrator or a librus-api bug...? Please let me know!
Po zmianach tego lata - logowanie do Librusa przestało działać.
Poprawiłem w swoim forku:
mccartney@732d73f
(niezbyt elegancko, bo hardcode'ując URLe)
Ale może komuś się przyda...
Could you create a function that retrieves data from the student information page (https://synergia.librus.pl/information).
Page source: https://gist.github.com/jakubrekowski/ae7e0649ceca1076e91fec8dc1cb40c4
Is there any way to add support for https://wiadomosci.librus.pl/nowy/inbox
There seems to be an api behind it. Example call for a message: https://wiadomosci.librus.pl/api/inbox/messages/7705268
I also see calls to some api
/home/norbi/Development/RadioBON/RadioBON-API/node_modules/librus-api/lib/tools.js:15
cheerio.prototype.trim = function() {
^
TypeError: Cannot set properties of undefined (setting 'trim')
at Object.<anonymous> (/home/norbi/Development/RadioBON/RadioBON-API/node_modules/librus-api/lib/tools.js:15:24)
at Module._compile (node:internal/modules/cjs/loader:1120:14)
at Module._extensions..js (node:internal/modules/cjs/loader:1174:10)
at Module.load (node:internal/modules/cjs/loader:998:32)
at Module._load (node:internal/modules/cjs/loader:839:12)
at Module.require (node:internal/modules/cjs/loader:1022:19)
at require (node:internal/modules/cjs/helpers:102:18)
at Object.<anonymous> (/home/norbi/Development/RadioBON/RadioBON-API/node_modules/librus-api/lib/resources/inbox.js:3:18)
at Module._compile (node:internal/modules/cjs/loader:1120:14)
at Module._extensions..js (node:internal/modules/cjs/loader:1174:10)
at Module.load (node:internal/modules/cjs/loader:998:32)
at Module._load (node:internal/modules/cjs/loader:839:12)
at Module.require (node:internal/modules/cjs/loader:1022:19)
at require (node:internal/modules/cjs/helpers:102:18)
at /home/norbi/Development/RadioBON/RadioBON-API/node_modules/librus-api/lib/api.js:86:20
at arrayEach (/home/norbi/Development/RadioBON/RadioBON-API/node_modules/lodash/lodash.js:530:11)
at Function.forEach (/home/norbi/Development/RadioBON/RadioBON-API/node_modules/lodash/lodash.js:9410:14)
at Librus._loadModules (/home/norbi/Development/RadioBON/RadioBON-API/node_modules/librus-api/lib/api.js:85:7)
at new Librus (/home/norbi/Development/RadioBON/RadioBON-API/node_modules/librus-api/lib/api.js:32:10)
at fetchLibrusData (/home/norbi/Development/RadioBON/RadioBON-API/utils.js:6:11)
at Object.<anonymous> (/home/norbi/Development/RadioBON/RadioBON-API/utils.js:14:1)
at Module._compile (node:internal/modules/cjs/loader:1120:14)
Node.js v18.6.0
[nodemon] app crashed - waiting for file changes before starting...
Node: v18.6.0
Cześć. Jest szansa zrobić z tego moduł do Node-Red?
https://www.npmjs.com/package/request-promise podaje:
request-promise has been deprecated because it extends the now deprecated request package, see request/request#3142
Na razie nie wiem, czy to w czymś przeszkadza. Przez wakacje przestało mi działać - jestem w trakcie debugowania.
Przydały by się definicje typów do TypeScript. Jeśli jest potrzeba mogę sam zrobić i dać PR :)
Is there any option for getting account name? For example I have account with login 138372972892782, but my name is DiaxManPl.
Przy poproszeniu o wszystkie oceny, zwracane jest "kurwa nic"
const Librus = require("librus-api");
require('dotenv').config()
const env = process.env
let client = new Librus();
client.authorize(process.env.LIBRUS_LOGIN, process.env.LIBRUS_PASSWD).then(function () {
client.info.getGrades().then(data => console.log(data));
})
Potrzebuje szybko tych danych, żebym mógł ich używać w integracji 🥶
Szybka odpowiedz będzie mile widziana oraz doceniona ⭐
Hi, i executed file (usage.js) with command node usege.js
and those are the things which were shown to me.
How to check if i am really connected, logged in and i am in librus panel? How can i retrieve entire body from there?
/.../Librus-Frequency/librus_api/node_modules/axios/dist/node/axios.cjs:836
AxiosError.call(axiosError, error.message, code, config, request, response);
^
AxiosError: connect ECONNREFUSED ::1:80
at AxiosError.from (/.../Librus-Frequency/librus_api/node_modules/axios/dist/node/axios.cjs:836:14)
at RedirectableRequest.handleRequestError (/.../Developer/Librus-Frequency/librus_api/node_modules/axios/dist/node/axios.cjs:3010:25)
at RedirectableRequest.emit (node:events:513:28)
at eventHandlers.<computed> (/.../Librus-Frequency/librus_api/node_modules/follow-redirects/index.js:14:24)
at ClientRequest.emit (node:events:513:28)
at req.emit (/.../Librus-Frequency/librus_api/node_modules/http-cookie-agent/dist/http/create_cookie_agent.js:84:16)
at Socket.socketErrorListener (node:_http_client:494:9)
at Socket.emit (node:events:513:28)
at emitErrorNT (node:internal/streams/destroy:151:8)
at emitErrorCloseNT (node:internal/streams/destroy:116:3)
Thank you very much for sharing this api <3
Możliwość pobierania ocen z II semestru, funkcja pobiera tylko I semestr
title, lmk if i should provide more info
Api z niewiadomych przyczyn nie jest w stanie odczytać poprawnie powiadomień. Mnie na librusie pokazuje, że mam 3 powiadomienia, a api pokazuje 1. Próbowałem to naprawić, lecz nie umiem.
Hi, today I wanted to read message content, but the API returning undefined
My code:
client.inbox.listInbox(5).then(data => {
const latestMessage = data[0]
client.inbox.getMessage(5, latestMessage.id).then(data => console.log(data));
console.log(latestMessage.content)
}
Zablokowano żądanie do zasobu innego pochodzenia: zasady „Same Origin Policy” nie pozwalają wczytywać zdalnych zasobów z „https://api.librus.pl/OAuth/Authorization?client_id=46” (nagłówek CORS „Access-Control-Allow-Origin” nie pasuje do „https://portal.librus.pl”).
Cześć!
Co trzeba zrobić poza zainstalowaniem node.js i npm install librus-api? Potrzebne jest coś jeszcze?
By w konsoli uzyskać np. szczęśliwy numerek utworzyłem taki skrypt:
'use strict'; const Librus = require("librus-api"); let client = new Librus(); client.authorize("mojlogin", "haslo").then(function () { console.log(client.info.getLuckyNumber().then(data => {})); });
I wyświetla zamiast tej liczby masę tekstu:
Unhandled rejection StatusCodeError: 403 - "<!DOCTYPE html PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\"
...
</body>\r\n </html>\r\n "
at new StatusCodeError (C:\Users\Tomek\node_modules\request-promise-core\lib\errors.js:32:15)
at Request.plumbing.callback (C:\Users\Tomek\node_modules\request-promise-core\lib\plumbing.js:104:33)
at Request.RP$callback [as _callback] (C:\Users\Tomek\node_modules\request-promise-core\lib\plumbing.js:46:31)
at Request.self.callback (C:\Users\Tomek\node_modules\request\request.js:185:22)
at Request.emit (events.js:400:28)
at Request.<anonymous> (C:\Users\Tomek\node_modules\request\request.js:1154:10)
at Request.emit (events.js:400:28)
at Gunzip.<anonymous> (C:\Users\Tomek\node_modules\request\request.js:1076:12)
at Object.onceWrapper (events.js:519:28)
at Gunzip.emit (events.js:400:28)
at endReadableNT (internal/streams/readable.js:1334:12)
at processTicksAndRejections `(internal/process/task_queues.js:82:21)`
Te wyniki mają być jakoś przekierowane na stronę www z konsoli? Totalnie nie znam się na js ani na node.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.