{"id":14989338,"url":"https://github.com/jiamingla/mvdis_i18n","last_synced_at":"2026-01-04T10:46:53.884Z","repository":{"id":163373169,"uuid":"633517460","full_name":"jiamingla/mvdis_i18n","owner":"jiamingla","description":"機車駕照預約考試多語友善版 Non-official","archived":false,"fork":false,"pushed_at":"2023-08-09T22:43:40.000Z","size":179,"stargazers_count":1,"open_issues_count":2,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-26T15:47:53.814Z","etag":null,"topics":["crawler","jquery","koa","koajs","nodejs","supertest"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jiamingla.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-04-27T17:11:38.000Z","updated_at":"2023-07-18T05:39:53.000Z","dependencies_parsed_at":null,"dependency_job_id":"24265836-6302-4fd2-87a4-51f5aa13b394","html_url":"https://github.com/jiamingla/mvdis_i18n","commit_stats":{"total_commits":68,"total_committers":2,"mean_commits":34.0,"dds":"0.23529411764705888","last_synced_commit":"deefa18bcbaf757636e3453d1965390e34e7c03c"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jiamingla%2Fmvdis_i18n","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jiamingla%2Fmvdis_i18n/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jiamingla%2Fmvdis_i18n/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jiamingla%2Fmvdis_i18n/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jiamingla","download_url":"https://codeload.github.com/jiamingla/mvdis_i18n/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244868754,"owners_count":20523592,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["crawler","jquery","koa","koajs","nodejs","supertest"],"created_at":"2024-09-24T14:18:09.344Z","updated_at":"2026-01-04T10:46:53.854Z","avatar_url":"https://github.com/jiamingla.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# mvdis_i18n\n\n## (Non-Official)Taiwan(ROC) Motor Vehicle Driver Information Service (MVDIS)'s Registration Service for Ordinary Motorcycle License Test\n\n## (非官方)中華民國機車駕照預約考試多語友善版(名字超長可否幫我簡短)\n\n-   動機： 我曾經幫一位菲律賓朋友考到台灣的普通重型機車駕照，才發現原來預約考試的網站不太在意外國人的 UIUX，就寫出來這個專案了，雖然原本的考照預約對本國人也是很莫名其妙就是了 XD\n-   之前已經有幾個簡單網站爬蟲的經驗，一直都覺得有些網頁真的太舊，但又沒有經費翻新，這樣子爬蟲加上簡單的前後端其實也滿好的\n-   最近剛好去桃園搭一次火車遇到這些需要搭火車往返的移工朋友，多少有點補充動力了，尤其看到鶯歌火車站停車場有台爆改電單車，回顧在我找到工作後的這兩個月，遇到的移工真的不多。\n-   其實我還是有些擔心這個專案或許到最後能幫助的移工朋友不多或是真的被開吉了，但現在有認識自己出來執業的律師，這個擔心開始是多餘的了 XD\n-   我的猜想是：只要拿到機車駕照的外國人夠多，國際就會更重視台灣機車路權的問題，而且台灣的普通重型機車駕照取得也不算太難，除了對方很可能需要適應台灣獨有的特產：二段式左轉待轉區\n\n### 檔案架構\n\n-   test/server.test.js: 測試腳本\n-   view/index.ejs: 使用了模板引擎的前端頁面\n-   public/: 前端所需要的 JS,CSS 靜態文件\n-   mvdis_crawler.js: 爬蟲，打監理站 API，解析 html\n-   server.js: koa 框架的後端\n-   routes/ 負責路由功能\n-   utils/helper.js 負責各種雜事，例如時間格式處理\n-   session_category.js: 把處理過監理站給的結果再簡化處理的函式\n\n### 如何參與開發和本地執行\n\n-   安裝 Node, nvm\n-   `git clone https://github.com/jiamingla/mvdis_i18n.git`\n-   `cd mvdis_i18n`\n-   `npm i`\n-   `npm run dev` or `npm run run`\n\n### 如何部署\n\n-   TBD\n\n#### 開發注意事項:\n\n-   [Git commit message 要照這個規範寫](https://wadehuanglearning.blogspot.com/2019/05/commit-commit-commit-why-what-commit.html)\n-   測試前都要更新測試資料，因為開發和測試都是在別人家的正式環境上(無奈)\n-   可以使用身分證產生器來生成，目前測下來看起來是只會檢查這個身分證字號有沒有考過駕照，不會背後去抓身分證字號對應的生日(國家機器在這裡沒有動起來)\n-   如果對方服務壞掉，打 request 過去超過十幾秒沒回來，回 502 可能會回這個，之後加個錯誤處理看看 -\u003e 錯誤處理如果多了，其實也可以寫成一個 func 去固定檢查\n    ```\n    \u003ctable width=\"10%\" border=\"0\" align=\"center\" cellpadding=\"0\" cellspacing=\"0\" summary=\"排版表格:Header\" class=\"header_tb\"\u003e\n        \u003ctr\u003e\n            \u003ctd\u003e\u003cimg src=\"/m3/images/space.gif\" width=\"1000\" height=\"1\" alt=\"排版用圖\" name=\"imgSpace\" /\u003e\u003c/td\u003e\n        \u003c/tr\u003e\n        \u003ctr\u003e\n            \u003ctd class=\"err_bk\"\u003e\n                \u003cdiv class=\"err_box\"\u003e\n                    \u003cdiv class=\"err_msg\"\u003e\n                        \u003cspan\u003e抱歉!!\u003c/span\u003e\u003cbr /\u003e\n                        您前往的網頁出現異常,我們已盡速處理中,造成您的不便,懇請見諒。\n                    \u003c/div\u003e\n                \u003c/div\u003e\n            \u003c/td\u003e\n        \u003c/tr\u003e\n    \u003c/table\u003e\n    ```\n-   開發時記得關 VPN，監理站會 Ban 掉 VPN\n\n#### 翻譯注意事項\n\n-   可以使用英文版的 Google Map 蒐集所有監理站的名稱、地址、Google Map 網址\n-   [公路總局 - 雙語詞彙](https://www.thb.gov.tw/News.aspx?n=5877\u0026sms=13420\u0026page=1\u0026PageSize=200)\n    -   雖然只有兩種駕照可以在這預約，但還是要分清楚\n        -   普通輕型機器腳踏車(51-125cc)： Ordinary Light Motorcycle\n        -   普通重型機器腳踏車(低於 50cc)： Ordinary Heavy Motorcycle\n-   [臺北市區監理所 - 英文網站 - 地區](https://tpcmv.thb.gov.tw/en/cp.aspx?n=10225)\n    -   我也很氣為什麼明明臺北市底下有好幾個監理站，這上面只有三個\n    -   士林監理站 Shilin Station\n    -   基隆監理站 Keelung Staion\n    -   臺北市區監理所 Taipei City Motor Vehicles Office\n\n#### 如何使用 Google Sheet\n\n-   [使用 Node.js 操作 Google Sheets API 讀寫試算表資料庫](https://www.wfublog.com/2023/04/nodejs-google-sheets-api-read-write.html)\n-   申請一個 Oauth 權證放到資料夾命名為 credentials.json\n-   `node .\\utils\\google_sheet.js`\n\n### Todo\n\n-   [x] 可以查詢、取消報名\n-   [x] 把取消報名的一包結果分成四個資料\n-   [ ] 補足 Test case，雖然後端開發好中文版了，之後還有 i18n，在完成後端 i18n 之前，我要先補測試，並開始實踐 TDD\n-   [x] 使用 Ajv or JOI 驗證後端的資料，阻擋不該進來的格式\n-   [ ] 對身分證字號這個欄位要加上對本國人和外籍人士的複合驗證 -\u003e 可用開源專案\n-   [x] 使用某個函式庫讓我回傳 response 有固定的格式(後來使用中間鍵處理)\n-   [ ] 新增 Swagger API 文檔，就可以把 mvdis_crawler.js 開發用的 log 拿掉\n-   [ ] 前端改變排列邏輯或新增 filter，或是也改變後端回傳邏輯，讓後端不用傳這麼多一部分重複的資料(例如說回傳的 50 筆有 25 筆都是早上初試場，其實可以改回傳早上初試場的每一天還有多少名額)\n-   [ ] 前端畫面做好 RWD\n-   [ ] -測試前自動化更新測試資料\n-   [ ] CICD\n-   [ ] 部署上去 Azure 的免費額度機器\n-   [ ] i18n -\u003e 白白建議先從一個監理站的搜尋結果能改成中文，再慢慢把所有的監理站的翻譯給補上\n    -   [x] 蒐集字串\n    -   [x] 將這些字串上傳到 Google Sheet\n    -   [ ] 翻譯\n    -   [ ] 從 Google Sheet 讀取\n    -   [ ] 後端 i18n -\u003e 多回傳字串的代號讓前端可以照著去找 json 檔案翻譯?\n    -   [ ] 前端 i18n -\u003e 拿著後端給的字串代號去照著 json 檔案翻譯\n\n#### 用了什麼\n\n後端使用 koa，並使用 axios 打 API，使用 cheerio 解析 html 取得監理站的資料，以 REST 的格式代替原本監理站不 REST 的 API，讓開發者可以以 REST 的方式開發，前端則使用 JQuery 和 Bootstrap，填寫表單送資料給後端去 call 監理站的服務\n\n#### 具體做了什麼\n\n-   不透過模擬瀏覽器控制元素或操控 JS，而是解析交通監理網的 API 回傳的 html response\n    -   [https://www.mvdis.gov.tw/m3-emv-trn/exm/](https://www.mvdis.gov.tw/m3-emv-trn/exm/)\n    -   所以這個專案沒有資料庫，是靜態網站，不打算用 MVC 寫的很抽象，如果之後測試需要會再改寫\n    -   原本的前端其實用 google 翻譯整個網頁還算能用，不算太有必要再刻一個前端，所以前端打算只用 JQuery 寫\n-   用中間鍵讓 response 回傳的 json 有一個固定的格式\n-   照著中華民國交通部公路總局 MOTC 給的雙語對照詞彙進行簡單的中翻英，如果有其他語言，會再邀請人一起參與(希望你可以幫我們翻得更好)\n\n#### 過程當中有幫助的網路資源\n\n-   如何用 JQuery 做除了...以外的選取[Hide all but $(this) via :not in jQuery selector](https://stackoverflow.com/questions/1328314/hide-all-but-this-via-not-in-jquery-selector)\n-   koa ctx.message 不能為中文[koa 踩坑日记（一）](https://juejin.cn/post/7052712021573402631)\n-   [Web 開發學習筆記 20 — Express、EJS](https://teagan-hsu.coderbridge.io/2021/01/13/express-ejs/)\n-   [koa2 中使用 ejs 读取外部 js 文件问题](https://blog.51cto.com/u_15155081/2720719)\n-   [RythmRune/i18n_sample](https://github.com/RythmRune/i18n_sample)\n-   [使用 Node.js 操作 Google Sheets API 讀寫試算表資料庫](https://www.wfublog.com/2023/04/nodejs-google-sheets-api-read-write.html)\n-   [使用 Azure Functions 開發 Node.js 無伺服器解決方案](https://learn.microsoft.com/zh-tw/azure/developer/javascript/how-to/develop-serverless-apps?tabs=v4-ts)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjiamingla%2Fmvdis_i18n","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjiamingla%2Fmvdis_i18n","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjiamingla%2Fmvdis_i18n/lists"}