Skip to main content

Extract subjects from Prereg

You are viewing the steps to extract schedule information via Prereg website. For i-ma'luum, click here.

note

You'll need to access the browser's developer tools to follow this guide. Therefore, only desktop browsers is supported.

1. Open prereg website in desktop browser

and login with your credentials.

HEADS UP

The prereg site can only be accessed during prereg period.

2. Open Developer Tools

Press keyboard shortcut F12 or find the Developer Tools on your browser.

devtools firefox

Then, change to Console tab.

console firefox

IMPORTANT! Set the console execution context to ora6.php. The code wil fail to run if this step is missing. Shown below are the examples from Firefox and Chrome.

For Chrome (and other chromium based browser)

In the console, look for dropdown button that says Top. Then, change it to ora6.php as shown below.

Execution context chrome
For Firefox

In the console, below the log messages, look for dropdown button that says Top. Then, change it to ora6.php as shown below.

Execution context firefox

3. Run script

Next, copy the code below and paste to the console. Then press Enter.

tip

Firefox may have paste protection enabled as a security feature. To allow pasting, type allow pasting in the console before pasting the code below.

const tableBody =
document.querySelector("body > table > tbody > tr:nth-child(2) > td > table > tbody > tr > td > table > tbody");

const courseCodes = [];
const sections = [];
const combinedSubjectDatas = [];

const bodyChildren = tableBody.children;

for (let index = 2; index < bodyChildren.length - 1; index++) {
const element = bodyChildren[index].children;
const subject = element[1].textContent
const section = element[2].textContent
courseCodes.push(subject)
sections.push(section)
}

// combine code & section
for (let i = 0; i < sections.length; i++) {
combinedSubjectDatas.push({ courseCode: courseCodes[i], section: parseInt(sections[i]) });
}

const json = JSON.stringify(combinedSubjectDatas);
const myUrl = new URL('https://iiumschedule.iqfareez.com/qrcode');
myUrl.searchParams.append('data', json);
console.log(myUrl.href); // log target url
window.open(myUrl.href); // go to target url

site qrcode

4. Finish

Finally, paste the JSON result to the app's JSON input.

json input iium schedule