Skip to content

Commit

Permalink
pretest section2 qestion3
Browse files Browse the repository at this point in the history
  • Loading branch information
lordbenz committed Feb 21, 2021
0 parents commit c7245f2
Show file tree
Hide file tree
Showing 4 changed files with 228 additions and 0 deletions.
46 changes: 46 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# See http://help.github.com/ignore-files/ for more about ignoring files.

# compiled output
/dist
/tmp
/out-tsc
# Only exists if Bazel was run
/bazel-out

# dependencies
/node_modules

# profiling files
chrome-profiler-events*.json
speed-measure-plugin*.json

# IDEs and editors
/.idea
.project
.classpath
.c9/
*.launch
.settings/
*.sublime-workspace

# IDE - VSCode
.vscode/*
!.vscode/settings.json
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json
.history/*

# misc
/.sass-cache
/connect.lock
/coverage
/libpeerconnection.log
npm-debug.log
yarn-error.log
testem.log
/typings

# System Files
.DS_Store
Thumbs.db
28 changes: 28 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
const arg = process.argv[2];

const axios = require("axios");
const cheerio = require("cheerio");

axios
.get("https://codequiz.azurewebsites.net/", {
headers: { Cookie: "hasCookie=true" },
})
.then((res) => {
$ = cheerio.load(res.data);

let fundNav = `not found.`;
for (let i = 0; i < $("table tr").length; i++) {
let rowData = $(`table tr`).eq(i);
if (
rowData.find(`td:nth-of-type(1)`).text().trim() == `${process.argv[2]}`
) {
fundNav = rowData.find(`td:nth-of-type(2)`).text();
break;
}
}

console.log(fundNav);
})
.catch((e) => {
console.log(e);
});
139 changes: 139 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 15 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"name": "s2q3",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "",
"license": "ISC",
"dependencies": {
"axios": "^0.21.1",
"cheerio": "^1.0.0-rc.5"
}
}

0 comments on commit c7245f2

Please sign in to comment.