kaelinator / skyward-rest Goto Github PK
View Code? Open in Web Editor NEWUnofficial Rest API for Skyward
License: MIT License
Unofficial Rest API for Skyward
License: MIT License
Puppeteer is huge and clunky compared to simply making requests. Eliminating puppeteer would reduce the dependency size and required runtime resources.
The goal is to make the library fit for a Functions-as-a-service (Faas) architecture.
How can I access more information on Skyward? For example when I reach this page with the url ../sfacademichistory001.w
, I can only access the names of the courses that I've taken through the skyward-rest program. However, when I actually go to skyward, I am able to click on the class names for more information. When I click on the classname, I am not redirected to a new page with a link. It is just a pop-up with no link. How can I get the information in the pop-up?
When I do the line scrapeReport
, I get a 5-digit number with key value "course". The comments in the README say that it is the 5-digit course number for the class, but I don't know how this course number was created. I can't find this number anywhere in skyward.
Thanks!!
When running,
scraper.scrapeReport(username, password)
.then(({ data, raw }) => {
//console.log(data) // array of reports
console.log(raw) // fetched html before parsing
});
This error occurs:
(node:7867) UnhandledPromiseRejectionWarning: Error: stuGradesGrid not found
at module.exports (/home/alex/Documents/Programming/IA Ideas/node_modules/skyward-rest/src/reportcard/condense.js:28:39)
at Object.getData (/home/alex/Documents/Programming/IA Ideas/node_modules/skyward-rest/src/reportcard/index.js:13:19)
at authenticate.then.then.response (/home/alex/Documents/Programming/IA Ideas/node_modules/skyward-rest/index.js:13:26)
at process._tickCallback (internal/process/next_tick.js:68:7)
for earned points, * out of 0
returns { earned: '*', total: '0' }
, expected: { earned: null, total: 0 }
When I go to the condense.js file in the history folder and I write console.log(data)
under the export default (data) => {
line, I get lines of data from the "Academic History" part of skyward. Then, it prints information about each class. It has values such as data-pStudent, data-pClassMeetRecID, etc. When I click on the information for each class, those values are not given. Where is it getting this information? In addition, the line console.log(data)
also doesn't print some values that are available when I click on more information for each class. How can I evoke this information from the "Academic History" tab? I don't really understand what is happening with the code in the condense, scrape, and chunk files.
.scrape()
should accept an array of lit
s, returning an array of all that was specified.
Also, instead of returning an empty array as the current .scrape()
does when invoked without any arguments, it should scrape everything.
A friendly api is necessary for deploying to npm. A readme to go along with it would also be nice.
Example: 38.5 out of 50
currently returns { earned: 38, total: 5}
, expected: { earned: 38.5, total: 50}
Could you create a better README or create a wiki to explain how to use this?
After idling for about five minutes, an account will be prompted to stay logged in.
Pressing OK sends a GET request:
In case a specific user must be logged in for an extended amount of time, a request must be sent periodically.
In the case that the user logs in whilst the scraper is still scraping, the session expires and an unhandled exception is thrown.
In order to calculate a student's GPA, their entire academic history must be accounted for.
All grades are featured under the Academic History
tab in Skyward, and therefore can be accessed.
The report parser should ignore empty courses, instead of placing a null value.
go this error while trying to scrape my gradebook: Uncaught (in promise) EvalError: Refused to evaluate a string as JavaScript because 'unsafe-eval' is not an allowed source of script in the following Content Security Policy directive: "script-src 'self' 'unsafe-inline'".
On src/reportcard/parse.js line 10:
return (results === null) ? {} : eval(`0 || ${results[1]}`);
My code:
// Skyward API things
const skyward = require('skyward-rest');
const url = 'https://skyward-lisdprod.iscorp.com/scripts/wsisa.dll/WService=wsedulewisvilletx/fwemnu01.w';
const scraper = skyward(url); // the scraper!
// login info
const user = 'user';
const pass = 'pass';
scraper.scrapeReport(user, pass)
I saw your comment on that line and tried to fix it myself, but no luck; it was way too complicated for me
Just wanted to know if there are any plans for continuing this project or plans to port it to other languages.
Your README says that we can install the library from the npm repos using npm install skyward-rest
. Are there plans to put it there?
For now, I would suggest changing it to
npm install https://github.com/FruitsNVeggies/skyward-rest
The documentation for the API contains a naming error in the .scrapeReportcard function.
.scrapeReportcard( user, pass )
Fetches and parses a student's report card, returning a promise which results in an object that's data property is an array of Reports. Note that this differs from .scrapeGradebook in that individual assignments in a course are not scraped, only the bucket's score.user string - the username or Login ID of the student who's grades will be retrieved
pass string - the password of the student
scraper.scrapeReportcard(user, pass)
.then(({ data, raw }) => {
console.log(data) // array of reports
console.log(raw) // fetched html before parsing
})
=======================
.scrapeReportcard is a invalid function.
TypeError: scraper.scrapeReportcard is not a function
at Object.<anonymous> (C:\Users\Trent Hardy\Desktop\skywardTest\main.js:10:9)
at Module._compile (internal/modules/cjs/loader.js:689:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:700:10)
at Module.load (internal/modules/cjs/loader.js:599:32)
at tryModuleLoad (internal/modules/cjs/loader.js:538:12)
at Function.Module._load (internal/modules/cjs/loader.js:530:3)
at Function.Module.runMain (internal/modules/cjs/loader.js:742:12)
at startup (internal/bootstrap/node.js:283:19)
at bootstrapNodeJSCore (internal/bootstrap/node.js:743:3)
=======================
The documention should read .scrapeReport, which is the actual function defined in the API under the index.js:
As shown:
module.exports = skywardURL => ({
scrapeReport: (user, pass) => (
authenticate(skywardURL)(user, pass)
.then(auth => reportcard.fetch(skywardURL)(auth))
.then(response => ({
raw: response.data,
data: reportcard.getData(response),
}))
),
Current semester scrapes specify the points received out of the total for specific lit
s:
"score": [
{"earned": 1114, "lit": "Q2", "total": 1200},
{"earned": 951, "lit": "Q1", "total": 1000}
]
Using these totals, the assignment totals, and the order in which they were scored, it is possible to assign a lit
value to each individual assignment.
It'd be nice to have a lit
's begin and end date, e.g. S1: (08/21/2017 - 12/21/2017)
.
This is also a potential fix for issue #6.
C:\Users\Trent Hardy\Desktop\skywardtest\node_modules\skyward-rest\lib\scrape.js:53
const referer = url.split('/')
^
TypeError: Cannot read property 'split' of undefined
at Scraper (C:\Users\Trent Hardy\Desktop\skywardtest\node_modules\skyward-rest\lib\scrape.js:53:25)
at Object. (C:\Users\Trent Hardy\Desktop\skywardtest\node_modules\skyward-rest\index.js:14:27)
at Module._compile (internal/modules/cjs/loader.js:689:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:700:10)
at Module.load (internal/modules/cjs/loader.js:599:32)
at tryModuleLoad (internal/modules/cjs/loader.js:538:12)
at Function.Module._load (internal/modules/cjs/loader.js:530:3)
at Module.require (internal/modules/cjs/loader.js:637:17)
at require (internal/modules/cjs/helpers.js:22:18)
at Object. (C:\Users\Trent Hardy\Desktop\skywardtest\main.js:1:79)
at Module._compile (internal/modules/cjs/loader.js:689:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:700:10)
at Module.load (internal/modules/cjs/loader.js:599:32)
at tryModuleLoad (internal/modules/cjs/loader.js:538:12)
at Function.Module._load (internal/modules/cjs/loader.js:530:3)
at Function.Module.runMain (internal/modules/cjs/loader.js:742:12)
const skyward = require('skyward-rest')
const url = "https://skyward.kleinisd.net/scripts/wsisa.dll/WService=wsEAplus/seplog01.w"
const userId = '*********'
const password = '**********'
skyward(url)(userId, password)
.then(student => {
student.scrape('S1')
.then(console.log) // => [Object Array]
.then(() => student.close())
})
User and password are correct, but censored for obvious reasons.
it appears to me that the scrape.js file of your module isn't taking in the url parameter from the main.js file that is calling the node module.
const Scraper = (url) =>
(sId, pass) => {
let loginInfo, secretCode, gradebook, browser, args
const referer = url.split('/')
.slice(0, -1)
.concat('httploader.p?file=sfgradebook001.w')
.join('/')
There also appears to be an unused import of Promise from bluebird in your index.js here:
const Promise = require('bluebird')
Proposed functionality to correctly handle assignments which are marked missing.
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.