# NTPU 法規彙編 - 爬蟲 https://new.ntpu.edu.tw/compilation-of-regulations ## 爬取所有 pdf 檔案的網址 in postman 使用此網址`https://api-carrier.ntpu.edu.tw/strapi` 並將狀態改為 Post 再把 body 的格式改為 raw 並輸入 ```= { "query": "{\n documents(\n sort: \"createdAt:desc\"\n start: 0\n limit: 100\n where: {\n \n lang: \"zh\"\n tags_contains: \"法規\"\n }\n ) {\n _id\n createdAt\n name\n tags\n lang\n site\n file {\n url\n name\n mime\n }\n }}" } ``` 其中 limit 最大為 100 ,就是一次抓取最大的範圍,學校網址看起來大概有 1300 個法規,所以需要抓 13 次,並每次把 start 加 100 取到的 json 會長 ```= { "data": { "documents": [ { "_id": "673d37404e66ca086677b1a6", "createdAt": "2024-11-20T01:11:28.461Z", "name": "國立臺北大學計畫專任助理人員工作酬金表", "tags": [ "法規", "計畫專任助理人員" ], "lang": "zh", "site": "op_ntpu", "file": { "url": "/uploads/113_09_7951ffd9fc.pdf", "name": "國立臺北大學計畫專任助理人員工作酬金表(113.09).pdf", "mime": "application/pdf" } }, { "_id": "673d36da4e66ca086677b1a3", "createdAt": "2024-11-20T01:09:46.622Z", "name": "國立臺北大學博士後研究工作酬金表", "tags": [ "法規", "計畫專任助理人員" ], "lang": "zh", "site": "op_ntpu", "file": { "url": "/uploads/113_09_99da1f4edb.pdf", "name": "國立臺北大學博士後研究工作酬金表(113.09).pdf", "mime": "application/pdf" } }, . . . ] } } ``` 其中網址在 `"url": "/uploads/113_09_7951ffd9fc.pdf"` 把它加上`https://cms-carrier.ntpu.edu.tw` 就會變成 https://cms-carrier.ntpu.edu.tw/uploads/113_09_7951ffd9fc.pdf 就可以抓到資料網址了 透過網址下載並上傳到 anythingLLm 中 到這邊看 https://hackmd.io/@k0217/S1TPkv43Je