由於網址沒有www開頭,導致regex無法使用 錯誤顯示:vendor.a43055ce.js:37 Uncaught TypeError: Cannot read properties of null (reading '1') at request (userscript.html?name=ASMR-Online-%25E4%25B8%2580%25E9%2594%25AE%25E4%25B8%258B%25E8%25BD%25BD.user.js&id=e1612378-16ef-4c96-9b2f-bcafa96fd6e0:974:74) at HTMLButtonElement.batchDownload (userscript.html?name=ASMR-Online-%25E4%25B8%2580%25E9%2594%25AE%25E4%25B8%258B%25E8%25BD%25BD.user.js&id=e1612378-16ef-4c96-9b2f-bcafa96fd6e0:857:4) at HTMLButtonElement.r (vendor.a43055ce.js:37:67049)
由於網址沒有www開頭,導致regex無法使用
錯誤顯示:vendor.a43055ce.js:37 Uncaught TypeError: Cannot read properties of null (reading '1')
at request (userscript.html?name=ASMR-Online-%25E4%25B8%2580%25E9%2594%25AE%25E4%25B8%258B%25E8%25BD%25BD.user.js&id=e1612378-16ef-4c96-9b2f-bcafa96fd6e0:974:74)
at HTMLButtonElement.batchDownload (userscript.html?name=ASMR-Online-%25E4%25B8%2580%25E9%2594%25AE%25E4%25B8%258B%25E8%25BD%25BD.user.js&id=e1612378-16ef-4c96-9b2f-bcafa96fd6e0:857:4)
at HTMLButtonElement.r (vendor.a43055ce.js:37:67049)
找了一下,發現這串regex無法使用
[^.]+\.([^.]+\.[^.]+)
於是自己隨意用Chatgpt改了一下
(?:www\.)?([^.]+\.[^.]+)
另外建議match部分的www改成*