# 與 ChatGPT 一起產出 config
1. 首先複製貼上這段話貼給 ChatGPT
You are an outsourced contractor to help create crawler config json file based on the HTML of the target website. I will provide you with examples and I would like you to summarize how each properties in the config json file is generated from the HTML. The crawler uses python beautiful soup for the parsing so some of the config properties are in exact beautiful soup syntax. I will provide you with a markdown file of the instructions on how to come up with the config json file based on the HTML. Are you good to go?
2. 接著把 [社區資源爬蟲config撰寫教學.md](https://jubohealthtw-my.sharepoint.com/personal/fqcherng_jubo_health/_layouts/15/onedrive.aspx?id=%2Fpersonal%2Ffqcherng%5Fjubo%5Fhealth%2FDocuments%2F%E7%A4%BE%E5%8D%80%E8%B3%87%E6%BA%90%20%E7%88%AC%E8%9F%B2%20config%20%E6%92%B0%E5%AF%AB%E6%95%99%E5%AD%B8%2Emd&parent=%2Fpersonal%2Ffqcherng%5Fjubo%5Fhealth%2FDocuments&ct=1716197890250&or=Teams%2DHL&ga=1)下載下來,並上傳到 ChatGPT。

他會開始分析然後吐出他的理解。
3. 接著貼上這個咒語,在傳送之前需要先去取得公告網站的 HTML檔案。
I need you to create a config json for the following HTML. I will provide you directly with the county, the district, and the department. And I'll leave the rest to you. The county is "填上縣市", the district is "填上行政區", and the department is "填上單位"; "" indicates an empty string please fill in as is. For the key of the json object just use the file name of the HTML file provided.
縣市、行政區、單位這些欄位直接從 excel 表格複製貼上就好。
如果 excel 行政區為空白,則不用填上任何內容,保留""即可。
__如何取得 HTML檔案?__
跟著 excel 裡面的連結,到了網站之後,點擊右鍵後選儲存為... (不確定中文是什麼,但英文是 Save As...)如下圖

然後在 format 那邊選擇 HTML Only,儲存的檔名要寫縣市的英文縮寫加上底線及編號,像是 "tpe_1" 往後以此類推。編號直接取 excel 的編號即可。如下圖。

上傳完檔案就可以送出。
4. ChatGPT 應該就會開始產出
會有類似這樣的 JSON ,如下圖。

現在需要把這個產出複製貼上到存放設定的檔案,可以用電腦的文字編輯器或是直接用這個 [線上編輯器](https://vscode.dev/) 我下面會用這個編輯器做示範。
左上角有一個三條線的選單可以選,File -> New File,如下圖。

他會先問你檔案名稱要什麼:就填上 config.json 之後按 enter,如下圖。

之後他會開啟電腦的檔案管理,就存在一個你自己知道的地方就好,這個是最後要交的成品。
把上面剛剛 ChatGPT 的產出全部複製下來,貼上在編輯器裡。如下圖。

這邊要注意的是因為我們最後會把全部的網站都集中到這個 config.json 裡面,因此除了第一個可以全部複製之外,其他剩下的都只需要複製其中一部分。
第一個網站之後都只要把匡起來的地方複製就好,最外面的大括號就不用複製了,如下圖,只需要把紅線部份複製就好。

__貼上去的時候要注意在前一個 config 的大括號後面會需要加上逗點__,如下圖。

然後就往下繼續接著,最後一個 config 後面就不用加上逗號了。