Refactor Instagram login process to handle session data and improve error handling
This commit is contained in:
parent
7653fb924b
commit
48f66773c7
4 changed files with 79 additions and 88 deletions
|
|
@ -1,63 +1,22 @@
|
|||
//import { Discord } from "./lib/discord";
|
||||
import { CreateImage } from "./lib/image";
|
||||
// //import { Discord } from "./lib/discord";
|
||||
// import {getAllSchedules} from "./lib/schedules";
|
||||
// import { CreateImage } from "./lib/image";
|
||||
// await CreateImage.PostSchedule();
|
||||
|
||||
//const YYMMDD = new Date().toISOString().slice(0, 10).replace(/-/g, "").toString();
|
||||
const YYMMDD = "20250530"
|
||||
//console.log(YYMMDD);
|
||||
// import { Login, Upload } from "./lib/instagram";
|
||||
// try {
|
||||
// const data = await Login();
|
||||
// console.log("✨ | Instagram login successful");
|
||||
// console.log(`🤔 | Login as ${data.currentUser.full_name}`);
|
||||
// } catch (error) {
|
||||
// console.error("❌ | Instagram login failed:", error);
|
||||
// } finally {
|
||||
// console.timeEnd("🔓 | Instagram login");
|
||||
// }
|
||||
|
||||
//Discord("20250509")
|
||||
async function run() {
|
||||
console.time("Post");
|
||||
const post = await CreateImage.PostMeal(YYMMDD);
|
||||
console.timeEnd("Post");
|
||||
console.log("Post created:", post);
|
||||
let NutritionInfoText = "";
|
||||
const entries = Object.entries(post ?? {}).filter(([_, value]) => value.toString().length > 0);
|
||||
entries.forEach(([name, value], idx) => {
|
||||
NutritionInfoText += `${name} : ${value.toString().replace(",", ", ")}`;
|
||||
if (idx !== entries.length - 1) {
|
||||
NutritionInfoText += "\n";
|
||||
}
|
||||
});
|
||||
console.log("Nutrition Info Text:", NutritionInfoText);
|
||||
|
||||
console.time("Story");
|
||||
await CreateImage.ConvertToStory(`./temp/${YYMMDD}.png`);
|
||||
console.timeEnd("Story");
|
||||
}
|
||||
|
||||
run();
|
||||
|
||||
import { getAllSchedules } from "./lib/schedule";
|
||||
|
||||
|
||||
//import { CreateImage } from "./lib/image";
|
||||
|
||||
//CreateImage.PostSchedule()
|
||||
|
||||
//const tomorrow = new Date();
|
||||
//tomorrow.setDate(tomorrow.getDate() + 1);
|
||||
|
||||
// 내일이 1일이면
|
||||
//console.log(tomorrow.getDate());
|
||||
|
||||
|
||||
/*import { VTSList } from "./lib/vts";
|
||||
|
||||
VTSList().then(results => {
|
||||
if (results.length > 0) {
|
||||
console.log("\n5번째 행의 노란색 셀 내용 리스트:");
|
||||
results.forEach(value => console.log(value));
|
||||
} else {
|
||||
console.log("\n5번째 행에서 노란색 배경의 셀을 찾지 못했거나, 'V.T.S.' 조건 불충족.");
|
||||
}
|
||||
});*/
|
||||
/*
|
||||
getAllSchedules()
|
||||
.then((schedules) => {
|
||||
console.log("학사 일정:", schedules);
|
||||
})
|
||||
.catch((error) => {
|
||||
console.error("Error fetching schedules:", error);
|
||||
});
|
||||
*/
|
||||
// await Upload.Post(
|
||||
// `/home/neko/today.isangjeong/app/temp/schedule-2025-06.png`,
|
||||
// `#인천상정중학교 #상정중학교 #학사일정 \n${new Date().getFullYear()}년도 ${
|
||||
// new Date().getMonth() + 1
|
||||
// }월 학사 일정`
|
||||
// );
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue