NodeでPrivateなscrapboxの情報を取得する
ログインではない気がする。
code:js
require("dotenv").config();
const request = require("request");
const host = process.env.PRIVATE_SCRAP_BOX_URL;
var jar = request.jar();
const cookies = request.cookie(connect.sid=${process.env.CONNECT_ID});
jar.setCookie(cookies, ${host});
const requestOption = {
headers: {
"content-type": "application/json"
},
jar
};
const fetchScrapBoxText = () => {
request.get(
{
...requestOption,
url: ${host}/your_page/text
},
(error, res, body) => {
console.log(body);
}
);
};
fetchScrapBoxText();