From f8fa412de92e518b40455ec252c7e12e1c05285e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=90=B3=E5=85=83=E7=9A=93?= Date: Sun, 11 May 2025 17:31:37 +0800 Subject: [PATCH] feat: update README with folder structure and execution instructions; add scraping scripts for news articles --- README.md | 47 +++++++++++++++++++++- pages/app/index.vue | 55 +++++++++---------------- scraping/findText/README.md | 7 ++++ scraping/findText/cna.py | 56 ++++++++++++++++++++++++++ scraping/findText/setn.py | 58 +++++++++++++++++++++++++++ scraping/{main.py => hot_articles.py} | 3 +- scraping/requirements.txt | 3 +- 7 files changed, 188 insertions(+), 41 deletions(-) create mode 100644 scraping/findText/README.md create mode 100644 scraping/findText/cna.py create mode 100644 scraping/findText/setn.py rename scraping/{main.py => hot_articles.py} (95%) diff --git a/README.md b/README.md index 6d1d20d..0ca1b9e 100644 --- a/README.md +++ b/README.md @@ -33,4 +33,49 @@ App Design: [Freeform](https://www.icloud.com/freeform/026AxB798cViZ9jJ2DkNsXUCQ - BunJS - Groq - Clerk -- Custom Infra \ No newline at end of file +- Custom Infra + +## Folder Structure + +``` +├── .github/ +│ └── workflows/ +├── .nuxt/ +├── .output/ +├── components/ +│ ├── app/ +│ │ └── newsOrgAbout/ +│ └── ui/ +├── i18n/ +├── layouts/ +├── lib/ +├── pages/ +│ └── app/ +├── public/ +├── scraping/ +├── server/ +│ ├── api/ +│ │ └── objectstorage/ +│ ├── components/ +│ └── routes/ +├── styles/ +├── app.vue +├── createDatabase.ts +├── nuxt.config.ts +├── package.json +├── tailwind.config.js +└── tsconfig.json +``` + +## 如何執行 + +1. First, rename `.env.example` to `.env` and fill in the blanks. +2. Run `bun install` to install dependencies. +3. Run `bun run createDatabase` to create the database. +4. Run `ps1 clone-env.ps1` or `bash clone-env.sh` to clone the `.env` file to the `scraping` folder. +5. Run `bun run build` to build the project. +6. Run `bun run preview` to start the preview server. +7. Open `http://localhost:3000` in your browser. + +### For scaping +First, Run `ps1 clone-env.ps1` or `bash clone-env.sh` to clone the `.env` file to the `scraping` folder, then cd into the `scraping` folder. Run `python main.py` to start scraping in Google News. \ No newline at end of file diff --git a/pages/app/index.vue b/pages/app/index.vue index 0b559c8..d9f3558 100644 --- a/pages/app/index.vue +++ b/pages/app/index.vue @@ -10,20 +10,30 @@ gsap.registerPlugin(TextPlugin); // Import Windows import SignIn from "~/components/app/windows/login.vue"; +// Import Shadcn/UI components +import AlertComponent from "~/components/ui/alert/Alert.vue"; +import ButtonComponent from "~/components/ui/button/Button.vue"; +import DialogComponent from "~/components/ui/dialog/Dialog.vue"; +import ProgressComponent from "~/components/ui/progress/Progress.vue"; +import HoverCardComponent from "~/components/ui/hover-card/HoverCard.vue"; + // Icons -import { ComputerDesktopIcon, UserIcon, LanguageIcon, ChevronRightIcon} from "@heroicons/vue/24/outline"; +import { ComputerDesktopIcon, UserIcon, LanguageIcon, ChevronRightIcon } from "@heroicons/vue/24/outline"; // i18n const { t, locale, locales } = useI18n(); const switchLocalePath = useSwitchLocalePath(); const localePath = useLocalePath(); + // Router const router = useRouter(); + // values const popMessage = ref(null); const menuOpen = ref(false); const langMenuOpen = ref(false); const lang = ref(locale.value); + // Date const currentDate = ref( new Date().toLocaleDateString("zh-TW", { @@ -51,35 +61,6 @@ onMounted(() => { }); // functions -const showLogin = () => { - const desktopEl = document.getElementById('desktop'); - if (!desktopEl) return; - - const loginWindow = document.createElement("div"); - loginWindow.className = "login-window absolute top-1/2 left-1/2 transform -translate-x-1/2 -translate-y-1/2"; - desktopEl.appendChild(loginWindow); - const app = createApp(SignIn); - app.mount(loginWindow); - - setTimeout(() => { - gsap.fromTo( - loginWindow, - { opacity: 0, scale: 0.5 }, - { opacity: 1, scale: 1, duration: 0.5 }, - ); - }, 100); - - setTimeout(() => { - gsap.to(loginWindow, { - opacity: 0, - scale: 0.5, - duration: 0.5, - onComplete: () => { - desktopEl.removeChild(loginWindow); - }, - }); - }, 5000); -} const openWindow = (windowName?: string) => { console.log(windowName); menuOpen.value = false; @@ -103,15 +84,15 @@ const toggleLangMenu = () => {