w-dwdata-hub 1.0.0 → 1.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (47) hide show
  1. package/README.md +16 -0
  2. package/dist/w-dwdata-hub.umd.js +2 -2
  3. package/dist/w-dwdata-hub.umd.js.map +1 -1
  4. package/docs/WDwdataHub.mjs.html +2 -2
  5. package/docs/decodeEntities.mjs.html +2 -2
  6. package/docs/extractDivContent.mjs.html +2 -2
  7. package/docs/fetchAiNewsAggregator.mjs.html +2 -2
  8. package/docs/fetchAisixiang.mjs.html +2 -2
  9. package/docs/fetchCnyes.mjs.html +2 -2
  10. package/docs/fetchGuancha.mjs.html +3 -7
  11. package/docs/fetchHackerNews.mjs.html +2 -2
  12. package/docs/fetchMoneydj.mjs.html +2 -2
  13. package/docs/fetchMops.mjs.html +2 -2
  14. package/docs/fetchRSS.mjs.html +106 -8
  15. package/docs/fetchStatementdog.mjs.html +2 -2
  16. package/docs/fetchTaifex.mjs.html +2 -2
  17. package/docs/fetchTpex3insti.mjs.html +2 -2
  18. package/docs/fetchTpexMargin.mjs.html +2 -2
  19. package/docs/fetchTpexStock.mjs.html +2 -2
  20. package/docs/fetchTwDataHoliday.mjs.html +2 -2
  21. package/docs/fetchTwseMargin.mjs.html +2 -2
  22. package/docs/fetchTwseStock.mjs.html +2 -2
  23. package/docs/fetchTwseT86.mjs.html +2 -2
  24. package/docs/fetchWithRetry.mjs.html +2 -2
  25. package/docs/getOptFetch.mjs.html +2 -2
  26. package/docs/global.html +807 -151
  27. package/docs/htmlToMarkdown.mjs.html +2 -2
  28. package/docs/index.html +2 -2
  29. package/docs/isYmd.mjs.html +2 -2
  30. package/docs/parseIntComma.mjs.html +2 -2
  31. package/docs/safeFilename.mjs.html +2 -2
  32. package/docs/stripHtml.mjs.html +130 -0
  33. package/docs/toDatetimeUTC8.mjs.html +26 -9
  34. package/docs/toRocDate.mjs.html +2 -2
  35. package/g.mjs +5 -0
  36. package/package.json +4 -5
  37. package/src/fetchGuancha.mjs +1 -5
  38. package/src/fetchRSS.mjs +104 -6
  39. package/src/stripHtml.mjs +58 -0
  40. package/src/toDatetimeUTC8.mjs +24 -7
  41. package/test/WDwdataHub.test.mjs +1 -1
  42. package/test/fetchRSS.test.mjs +78 -0
  43. package/test/stripHtml.test.mjs +58 -0
  44. package/test/toDatetimeUTC8.test.mjs +32 -0
  45. package/test/tools/fixtures.mjs +43 -0
  46. package/test/tools/serverForTest.mjs +12 -0
  47. package/toolg/gDistRollup.mjs +2 -2
package/docs/global.html CHANGED
@@ -29,7 +29,7 @@
29
29
  <nav >
30
30
 
31
31
 
32
- <h2><a href="index.html">Home</a></h2><h3>Global</h3><ul><li><a href="global.html#KNOWN_TOPICS">KNOWN_TOPICS</a></li><li><a href="global.html#WDwdataHub">WDwdataHub</a></li><li><a href="global.html#assertTpexFieldShape">assertTpexFieldShape</a></li><li><a href="global.html#decodeEntities">decodeEntities</a></li><li><a href="global.html#extractAuthorFromContent">extractAuthorFromContent</a></li><li><a href="global.html#extractDivContent">extractDivContent</a></li><li><a href="global.html#extractHtmlTitle">extractHtmlTitle</a></li><li><a href="global.html#extractPubTime">extractPubTime</a></li><li><a href="global.html#extractTitle">extractTitle</a></li><li><a href="global.html#fetchAiNewsAggregator">fetchAiNewsAggregator</a></li><li><a href="global.html#fetchAisixiang">fetchAisixiang</a></li><li><a href="global.html#fetchAllListPages">fetchAllListPages</a></li><li><a href="global.html#fetchAllSearchPages">fetchAllSearchPages</a></li><li><a href="global.html#fetchArticle">fetchArticle</a></li><li><a href="global.html#fetchAuthorArticles">fetchAuthorArticles</a></li><li><a href="global.html#fetchAuthorsList">fetchAuthorsList</a></li><li><a href="global.html#fetchCnyes">fetchCnyes</a></li><li><a href="global.html#fetchFuturesData">fetchFuturesData</a></li><li><a href="global.html#fetchGuancha">fetchGuancha</a></li><li><a href="global.html#fetchHackerNews">fetchHackerNews</a></li><li><a href="global.html#fetchHtml">fetchHtml</a></li><li><a href="global.html#fetchInstitutionalData">fetchInstitutionalData</a></li><li><a href="global.html#fetchKeywordArticles">fetchKeywordArticles</a></li><li><a href="global.html#fetchMoneydj">fetchMoneydj</a></li><li><a href="global.html#fetchMops">fetchMops</a></li><li><a href="global.html#fetchOnce">fetchOnce</a></li><li><a href="global.html#fetchPCRatio">fetchPCRatio</a></li><li><a href="global.html#fetchRSS">fetchRSS</a></li><li><a href="global.html#fetchStatementdog">fetchStatementdog</a></li><li><a href="global.html#fetchTaifex">fetchTaifex</a></li><li><a href="global.html#fetchTargetWithRetry">fetchTargetWithRetry</a></li><li><a href="global.html#fetchTitleArticles">fetchTitleArticles</a></li><li><a href="global.html#fetchTopicArticles">fetchTopicArticles</a></li><li><a href="global.html#fetchTopicsList">fetchTopicsList</a></li><li><a href="global.html#fetchTpex3insti">fetchTpex3insti</a></li><li><a href="global.html#fetchTpexMargin">fetchTpexMargin</a></li><li><a href="global.html#fetchTpexStock">fetchTpexStock</a></li><li><a href="global.html#fetchTwDataHoliday">fetchTwDataHoliday</a></li><li><a href="global.html#fetchTwseMargin">fetchTwseMargin</a></li><li><a href="global.html#fetchTwseStock">fetchTwseStock</a></li><li><a href="global.html#fetchTwseT86">fetchTwseT86</a></li><li><a href="global.html#fetchWithRetry">fetchWithRetry</a></li><li><a href="global.html#getCfg">getCfg</a></li><li><a href="global.html#getOptFetch">getOptFetch</a></li><li><a href="global.html#getPayload">getPayload</a></li><li><a href="global.html#htmlToMarkdown">htmlToMarkdown</a></li><li><a href="global.html#isHomepageHtml">isHomepageHtml</a></li><li><a href="global.html#isNonHolidayEntry">isNonHolidayEntry</a></li><li><a href="global.html#isRetryableError">isRetryableError</a></li><li><a href="global.html#isYmd">isYmd</a></li><li><a href="global.html#lookupAuthor">lookupAuthor</a></li><li><a href="global.html#lookupTopic">lookupTopic</a></li><li><a href="global.html#parseAuthorColumnPage">parseAuthorColumnPage</a></li><li><a href="global.html#parseAuthorIndex">parseAuthorIndex</a></li><li><a href="global.html#parseCSV">parseCSV</a></li><li><a href="global.html#parseCSVLine">parseCSVLine</a></li><li><a href="global.html#parseIntComma">parseIntComma</a></li><li><a href="global.html#parseListPage">parseListPage</a></li><li><a href="global.html#parseNum">parseNum</a></li><li><a href="global.html#parseSearchResults">parseSearchResults</a></li><li><a href="global.html#parseSearchTotalPages">parseSearchTotalPages</a></li><li><a href="global.html#parseZhuantiArticles">parseZhuantiArticles</a></li><li><a href="global.html#pickPint">pickPint</a></li><li><a href="global.html#rocToWestern">rocToWestern</a></li><li><a href="global.html#safeFilename">safeFilename</a></li><li><a href="global.html#toDatetimeUTC8">toDatetimeUTC8</a></li><li><a href="global.html#toRocDate">toRocDate</a></li></ul>
32
+ <h2><a href="index.html">Home</a></h2><h3>Global</h3><ul><li><a href="global.html#KNOWN_TOPICS">KNOWN_TOPICS</a></li><li><a href="global.html#WDwdataHub">WDwdataHub</a></li><li><a href="global.html#assertTpexFieldShape">assertTpexFieldShape</a></li><li><a href="global.html#decodeEntities">decodeEntities</a></li><li><a href="global.html#extractAuthorFromContent">extractAuthorFromContent</a></li><li><a href="global.html#extractDivContent">extractDivContent</a></li><li><a href="global.html#extractHtmlTitle">extractHtmlTitle</a></li><li><a href="global.html#extractPubTime">extractPubTime</a></li><li><a href="global.html#extractTitle">extractTitle</a></li><li><a href="global.html#fetchAiNewsAggregator">fetchAiNewsAggregator</a></li><li><a href="global.html#fetchAisixiang">fetchAisixiang</a></li><li><a href="global.html#fetchAllListPages">fetchAllListPages</a></li><li><a href="global.html#fetchAllSearchPages">fetchAllSearchPages</a></li><li><a href="global.html#fetchArticle">fetchArticle</a></li><li><a href="global.html#fetchAuthorArticles">fetchAuthorArticles</a></li><li><a href="global.html#fetchAuthorsList">fetchAuthorsList</a></li><li><a href="global.html#fetchCnyes">fetchCnyes</a></li><li><a href="global.html#fetchFuturesData">fetchFuturesData</a></li><li><a href="global.html#fetchGuancha">fetchGuancha</a></li><li><a href="global.html#fetchHackerNews">fetchHackerNews</a></li><li><a href="global.html#fetchHtml">fetchHtml</a></li><li><a href="global.html#fetchInstitutionalData">fetchInstitutionalData</a></li><li><a href="global.html#fetchKeywordArticles">fetchKeywordArticles</a></li><li><a href="global.html#fetchMoneydj">fetchMoneydj</a></li><li><a href="global.html#fetchMops">fetchMops</a></li><li><a href="global.html#fetchOnce">fetchOnce</a></li><li><a href="global.html#fetchPCRatio">fetchPCRatio</a></li><li><a href="global.html#fetchRSS">fetchRSS</a></li><li><a href="global.html#fetchStatementdog">fetchStatementdog</a></li><li><a href="global.html#fetchTaifex">fetchTaifex</a></li><li><a href="global.html#fetchTargetWithRetry">fetchTargetWithRetry</a></li><li><a href="global.html#fetchTitleArticles">fetchTitleArticles</a></li><li><a href="global.html#fetchTopicArticles">fetchTopicArticles</a></li><li><a href="global.html#fetchTopicsList">fetchTopicsList</a></li><li><a href="global.html#fetchTpex3insti">fetchTpex3insti</a></li><li><a href="global.html#fetchTpexMargin">fetchTpexMargin</a></li><li><a href="global.html#fetchTpexStock">fetchTpexStock</a></li><li><a href="global.html#fetchTwDataHoliday">fetchTwDataHoliday</a></li><li><a href="global.html#fetchTwseMargin">fetchTwseMargin</a></li><li><a href="global.html#fetchTwseStock">fetchTwseStock</a></li><li><a href="global.html#fetchTwseT86">fetchTwseT86</a></li><li><a href="global.html#fetchWithRetry">fetchWithRetry</a></li><li><a href="global.html#getCfg">getCfg</a></li><li><a href="global.html#getOptFetch">getOptFetch</a></li><li><a href="global.html#getPayload">getPayload</a></li><li><a href="global.html#getXml">getXml</a></li><li><a href="global.html#getXmlByCurl">getXmlByCurl</a></li><li><a href="global.html#htmlToMarkdown">htmlToMarkdown</a></li><li><a href="global.html#isHomepageHtml">isHomepageHtml</a></li><li><a href="global.html#isNonHolidayEntry">isNonHolidayEntry</a></li><li><a href="global.html#isRetryableError">isRetryableError</a></li><li><a href="global.html#isYmd">isYmd</a></li><li><a href="global.html#lookupAuthor">lookupAuthor</a></li><li><a href="global.html#lookupTopic">lookupTopic</a></li><li><a href="global.html#parseAuthorColumnPage">parseAuthorColumnPage</a></li><li><a href="global.html#parseAuthorIndex">parseAuthorIndex</a></li><li><a href="global.html#parseCSV">parseCSV</a></li><li><a href="global.html#parseCSVLine">parseCSVLine</a></li><li><a href="global.html#parseIntComma">parseIntComma</a></li><li><a href="global.html#parseListPage">parseListPage</a></li><li><a href="global.html#parseNum">parseNum</a></li><li><a href="global.html#parseSearchResults">parseSearchResults</a></li><li><a href="global.html#parseSearchTotalPages">parseSearchTotalPages</a></li><li><a href="global.html#parseZhuantiArticles">parseZhuantiArticles</a></li><li><a href="global.html#pickPint">pickPint</a></li><li><a href="global.html#rocToWestern">rocToWestern</a></li><li><a href="global.html#safeFilename">safeFilename</a></li><li><a href="global.html#stripHtml">stripHtml</a></li><li><a href="global.html#toDatetimeUTC8">toDatetimeUTC8</a></li><li><a href="global.html#toRocDate">toRocDate</a></li></ul>
33
33
 
34
34
  </nav>
35
35
 
@@ -144,7 +144,7 @@
144
144
 
145
145
  <dt class="tag-source">Source:</dt>
146
146
  <dd class="tag-source"><ul class="dummy"><li>
147
- <a href="fetchGuancha.mjs.html">fetchGuancha.mjs</a>, <a href="fetchGuancha.mjs.html#line53">line 53</a>
147
+ <a href="fetchGuancha.mjs.html">fetchGuancha.mjs</a>, <a href="fetchGuancha.mjs.html#line49">line 49</a>
148
148
  </li></ul></dd>
149
149
 
150
150
 
@@ -367,7 +367,7 @@
367
367
 
368
368
  <dt class="tag-source">Source:</dt>
369
369
  <dd class="tag-source"><ul class="dummy"><li>
370
- <a href="fetchGuancha.mjs.html">fetchGuancha.mjs</a>, <a href="fetchGuancha.mjs.html#line899">line 899</a>
370
+ <a href="fetchGuancha.mjs.html">fetchGuancha.mjs</a>, <a href="fetchGuancha.mjs.html#line895">line 895</a>
371
371
  </li></ul></dd>
372
372
 
373
373
 
@@ -755,7 +755,7 @@ console.log(decodeEntities('a&amp;amp;b&amp;#65;&amp;#x42;&amp;unknown;'))
755
755
 
756
756
  <dt class="tag-source">Source:</dt>
757
757
  <dd class="tag-source"><ul class="dummy"><li>
758
- <a href="fetchGuancha.mjs.html">fetchGuancha.mjs</a>, <a href="fetchGuancha.mjs.html#line216">line 216</a>
758
+ <a href="fetchGuancha.mjs.html">fetchGuancha.mjs</a>, <a href="fetchGuancha.mjs.html#line212">line 212</a>
759
759
  </li></ul></dd>
760
760
 
761
761
 
@@ -1114,7 +1114,7 @@ console.log(extractDivContent('&lt;div class="other">a&lt;/div>', 'ct'))
1114
1114
 
1115
1115
  <dt class="tag-source">Source:</dt>
1116
1116
  <dd class="tag-source"><ul class="dummy"><li>
1117
- <a href="fetchGuancha.mjs.html">fetchGuancha.mjs</a>, <a href="fetchGuancha.mjs.html#line202">line 202</a>
1117
+ <a href="fetchGuancha.mjs.html">fetchGuancha.mjs</a>, <a href="fetchGuancha.mjs.html#line198">line 198</a>
1118
1118
  </li></ul></dd>
1119
1119
 
1120
1120
 
@@ -1275,7 +1275,7 @@ console.log(extractDivContent('&lt;div class="other">a&lt;/div>', 'ct'))
1275
1275
 
1276
1276
  <dt class="tag-source">Source:</dt>
1277
1277
  <dd class="tag-source"><ul class="dummy"><li>
1278
- <a href="fetchGuancha.mjs.html">fetchGuancha.mjs</a>, <a href="fetchGuancha.mjs.html#line231">line 231</a>
1278
+ <a href="fetchGuancha.mjs.html">fetchGuancha.mjs</a>, <a href="fetchGuancha.mjs.html#line227">line 227</a>
1279
1279
  </li></ul></dd>
1280
1280
 
1281
1281
 
@@ -2066,7 +2066,7 @@ await test()
2066
2066
 
2067
2067
  <dt class="tag-source">Source:</dt>
2068
2068
  <dd class="tag-source"><ul class="dummy"><li>
2069
- <a href="fetchGuancha.mjs.html">fetchGuancha.mjs</a>, <a href="fetchGuancha.mjs.html#line314">line 314</a>
2069
+ <a href="fetchGuancha.mjs.html">fetchGuancha.mjs</a>, <a href="fetchGuancha.mjs.html#line310">line 310</a>
2070
2070
  </li></ul></dd>
2071
2071
 
2072
2072
 
@@ -3000,7 +3000,7 @@ await test()
3000
3000
 
3001
3001
  <dt class="tag-source">Source:</dt>
3002
3002
  <dd class="tag-source"><ul class="dummy"><li>
3003
- <a href="fetchGuancha.mjs.html">fetchGuancha.mjs</a>, <a href="fetchGuancha.mjs.html#line816">line 816</a>
3003
+ <a href="fetchGuancha.mjs.html">fetchGuancha.mjs</a>, <a href="fetchGuancha.mjs.html#line812">line 812</a>
3004
3004
  </li></ul></dd>
3005
3005
 
3006
3006
 
@@ -4006,7 +4006,7 @@ await test()
4006
4006
 
4007
4007
  <dt class="tag-source">Source:</dt>
4008
4008
  <dd class="tag-source"><ul class="dummy"><li>
4009
- <a href="fetchGuancha.mjs.html">fetchGuancha.mjs</a>, <a href="fetchGuancha.mjs.html#line503">line 503</a>
4009
+ <a href="fetchGuancha.mjs.html">fetchGuancha.mjs</a>, <a href="fetchGuancha.mjs.html#line499">line 499</a>
4010
4010
  </li></ul></dd>
4011
4011
 
4012
4012
 
@@ -4974,7 +4974,7 @@ await test()
4974
4974
 
4975
4975
  <dt class="tag-source">Source:</dt>
4976
4976
  <dd class="tag-source"><ul class="dummy"><li>
4977
- <a href="fetchGuancha.mjs.html">fetchGuancha.mjs</a>, <a href="fetchGuancha.mjs.html#line410">line 410</a>
4977
+ <a href="fetchGuancha.mjs.html">fetchGuancha.mjs</a>, <a href="fetchGuancha.mjs.html#line406">line 406</a>
4978
4978
  </li></ul></dd>
4979
4979
 
4980
4980
 
@@ -6717,7 +6717,7 @@ await test()
6717
6717
 
6718
6718
  <dt class="tag-source">Source:</dt>
6719
6719
  <dd class="tag-source"><ul class="dummy"><li>
6720
- <a href="fetchGuancha.mjs.html">fetchGuancha.mjs</a>, <a href="fetchGuancha.mjs.html#line163">line 163</a>
6720
+ <a href="fetchGuancha.mjs.html">fetchGuancha.mjs</a>, <a href="fetchGuancha.mjs.html#line159">line 159</a>
6721
6721
  </li></ul></dd>
6722
6722
 
6723
6723
 
@@ -7585,7 +7585,7 @@ await test()
7585
7585
 
7586
7586
  <dt class="tag-source">Source:</dt>
7587
7587
  <dd class="tag-source"><ul class="dummy"><li>
7588
- <a href="fetchGuancha.mjs.html">fetchGuancha.mjs</a>, <a href="fetchGuancha.mjs.html#line609">line 609</a>
7588
+ <a href="fetchGuancha.mjs.html">fetchGuancha.mjs</a>, <a href="fetchGuancha.mjs.html#line605">line 605</a>
7589
7589
  </li></ul></dd>
7590
7590
 
7591
7591
 
@@ -9147,13 +9147,17 @@ await test()
9147
9147
  <dt class="tag-description">Description:</dt>
9148
9148
  <dd class="tag-description"><ul class="dummy"><li><p>抓取RSS訂閱源</p>
9149
9149
  <p>支援RSS與Atom, 並轉為統一格式, 時間欄位一律轉為UTC+8之'YYYY-MM-DD HH:mm:ss'字串;
9150
- 因YouTube等站台之RSS會回傳暫時性404, 故404亦納入重試範圍</p></li></ul></dd>
9150
+ 因YouTube等站台之RSS會回傳暫時性404, 故404亦納入重試範圍(僅fetch模式)。</p>
9151
+ <p>部分站台(如以TLS指紋阻擋非瀏覽器用戶端者)對node內建fetch回403、對curl回200,
9152
+ 此時可指定opt.method為'curl'改走系統curl, 或'auto'先curl失敗再退回fetch;
9153
+ curl模式需系統PATH內有curl, 且重試退避由w-fetch-web內建(3至15秒線性),
9154
+ opt之baseDelayMs、maxDelayMs與retryStatus於curl模式不生效, 極短之feed(小於100字元)會被curl模式判為empty-response</p></li></ul></dd>
9151
9155
 
9152
9156
 
9153
9157
 
9154
9158
  <dt class="tag-source">Source:</dt>
9155
9159
  <dd class="tag-source"><ul class="dummy"><li>
9156
- <a href="fetchRSS.mjs.html">fetchRSS.mjs</a>, <a href="fetchRSS.mjs.html#line53">line 53</a>
9160
+ <a href="fetchRSS.mjs.html">fetchRSS.mjs</a>, <a href="fetchRSS.mjs.html#line125">line 125</a>
9157
9161
  </li></ul></dd>
9158
9162
 
9159
9163
 
@@ -9208,6 +9212,11 @@ let test = async () => {
9208
9212
  console.log(rs.length, rs[0])
9209
9213
  // => 20 { url: 'https://...', time: '2026-08-07 09:02:03', title: '...', description: '...', from: '...' }
9210
9214
 
9215
+ //擋node fetch之站台改走curl, 並取feed內嵌全文
9216
+ let rs2 = await fetchRSS('https://alphaarchitect.com/feed', { method: 'curl', withContent: true })
9217
+ console.log(rs2.length, rs2[0].content.length)
9218
+ // => 5 2093
9219
+
9211
9220
  }
9212
9221
  await test()
9213
9222
  .catch((err) => {
@@ -9343,6 +9352,86 @@ await test()
9343
9352
  <tbody>
9344
9353
 
9345
9354
 
9355
+ <tr>
9356
+
9357
+ <td class="name"><code>method</code></td>
9358
+
9359
+
9360
+ <td class="type">
9361
+
9362
+
9363
+ <span class="param-type">String</span>
9364
+
9365
+
9366
+
9367
+
9368
+ </td>
9369
+
9370
+
9371
+ <td class="attributes">
9372
+
9373
+ &lt;optional><br>
9374
+
9375
+
9376
+
9377
+
9378
+
9379
+ </td>
9380
+
9381
+
9382
+
9383
+ <td class="default">
9384
+
9385
+ <code>'fetch'</code>
9386
+
9387
+ </td>
9388
+
9389
+
9390
+ <td class="description last"><p>輸入抓取方式字串,可為'fetch'(node內建fetch)、'curl'(系統curl)、'auto'(curl優先失敗退回fetch),預設'fetch'</p></td>
9391
+ </tr>
9392
+
9393
+
9394
+
9395
+ <tr>
9396
+
9397
+ <td class="name"><code>withContent</code></td>
9398
+
9399
+
9400
+ <td class="type">
9401
+
9402
+
9403
+ <span class="param-type">Boolean</span>
9404
+
9405
+
9406
+
9407
+
9408
+ </td>
9409
+
9410
+
9411
+ <td class="attributes">
9412
+
9413
+ &lt;optional><br>
9414
+
9415
+
9416
+
9417
+
9418
+
9419
+ </td>
9420
+
9421
+
9422
+
9423
+ <td class="default">
9424
+
9425
+ <code>false</code>
9426
+
9427
+ </td>
9428
+
9429
+
9430
+ <td class="description last"><p>輸入是否於各項目附加content欄布林值,true時依content:encoded、content、summary、description之優先序取feed內嵌全文並去除HTML標籤與實體,預設false</p></td>
9431
+ </tr>
9432
+
9433
+
9434
+
9346
9435
  <tr>
9347
9436
 
9348
9437
  <td class="name"><code>timeout</code></td>
@@ -9458,7 +9547,7 @@ await test()
9458
9547
  </td>
9459
9548
 
9460
9549
 
9461
- <td class="description last"><p>輸入重試之線性退避基礎毫秒整數,預設3000</p></td>
9550
+ <td class="description last"><p>輸入重試之線性退避基礎毫秒整數(僅fetch模式生效),預設3000</p></td>
9462
9551
  </tr>
9463
9552
 
9464
9553
 
@@ -9498,7 +9587,7 @@ await test()
9498
9587
  </td>
9499
9588
 
9500
9589
 
9501
- <td class="description last"><p>輸入重試之線性退避上限毫秒整數,預設15000</p></td>
9590
+ <td class="description last"><p>輸入重試之線性退避上限毫秒整數(僅fetch模式生效),預設15000</p></td>
9502
9591
  </tr>
9503
9592
 
9504
9593
 
@@ -9571,7 +9660,7 @@ await test()
9571
9660
 
9572
9661
 
9573
9662
  <div class="param-desc">
9574
- <p>回傳Promise,resolve回傳項目物件陣列,各物件為{url,time,title,description,from},網址無效或抓取失敗時reject回傳錯誤物件</p>
9663
+ <p>回傳Promise,resolve回傳項目物件陣列,各物件為{url,time,title,description,from},withContent為true時另含content欄,網址無效或抓取失敗時reject回傳錯誤物件</p>
9575
9664
  </div>
9576
9665
 
9577
9666
 
@@ -11336,7 +11425,7 @@ await test()
11336
11425
 
11337
11426
  <dt class="tag-source">Source:</dt>
11338
11427
  <dd class="tag-source"><ul class="dummy"><li>
11339
- <a href="fetchGuancha.mjs.html">fetchGuancha.mjs</a>, <a href="fetchGuancha.mjs.html#line657">line 657</a>
11428
+ <a href="fetchGuancha.mjs.html">fetchGuancha.mjs</a>, <a href="fetchGuancha.mjs.html#line653">line 653</a>
11340
11429
  </li></ul></dd>
11341
11430
 
11342
11431
 
@@ -12112,7 +12201,7 @@ await test()
12112
12201
 
12113
12202
  <dt class="tag-source">Source:</dt>
12114
12203
  <dd class="tag-source"><ul class="dummy"><li>
12115
- <a href="fetchGuancha.mjs.html">fetchGuancha.mjs</a>, <a href="fetchGuancha.mjs.html#line711">line 711</a>
12204
+ <a href="fetchGuancha.mjs.html">fetchGuancha.mjs</a>, <a href="fetchGuancha.mjs.html#line707">line 707</a>
12116
12205
  </li></ul></dd>
12117
12206
 
12118
12207
 
@@ -17753,7 +17842,7 @@ await test()
17753
17842
 
17754
17843
  <dt class="tag-source">Source:</dt>
17755
17844
  <dd class="tag-source"><ul class="dummy"><li>
17756
- <a href="fetchGuancha.mjs.html">fetchGuancha.mjs</a>, <a href="fetchGuancha.mjs.html#line93">line 93</a>
17845
+ <a href="fetchGuancha.mjs.html">fetchGuancha.mjs</a>, <a href="fetchGuancha.mjs.html#line89">line 89</a>
17757
17846
  </li></ul></dd>
17758
17847
 
17759
17848
 
@@ -18302,7 +18391,7 @@ console.log(getOptFetch({ maxRetries: 2 }, { timeout: 15000, label: 'abc' }))
18302
18391
 
18303
18392
 
18304
18393
 
18305
- <h4 class="name" id="htmlToMarkdown"><span class="type-signature"></span>htmlToMarkdown<span class="signature">(html, opt<span class="signature-attributes">opt</span>)</span><span class="type-signature"> &rarr; {String}</span></h4>
18394
+ <h4 class="name" id="getXml"><span class="type-signature type-signature-async">(async) </span>getXml<span class="signature">(rssUrl, method, cfg)</span><span class="type-signature"> &rarr; {Promise}</span></h4>
18306
18395
 
18307
18396
 
18308
18397
 
@@ -18312,15 +18401,13 @@ console.log(getOptFetch({ maxRetries: 2 }, { timeout: 15000, label: 'abc' }))
18312
18401
  <dl class="details">
18313
18402
 
18314
18403
  <dt class="tag-description">Description:</dt>
18315
- <dd class="tag-description"><ul class="dummy"><li><p>HTML轉Markdown</p>
18316
- <p>採正則式逐項轉換, 不引入DOM解析器, 適用於已切出之正文區塊;
18317
- 先移除script、style與註解, 再轉換標題、粗體、斜體、換行、連結與段落, 最後清除殘留標籤並收斂空行</p></li></ul></dd>
18404
+ <dd class="tag-description"><ul class="dummy"><li><p>依method分派取回XML</p></li></ul></dd>
18318
18405
 
18319
18406
 
18320
18407
 
18321
18408
  <dt class="tag-source">Source:</dt>
18322
18409
  <dd class="tag-source"><ul class="dummy"><li>
18323
- <a href="htmlToMarkdown.mjs.html">htmlToMarkdown.mjs</a>, <a href="htmlToMarkdown.mjs.html#line28">line 28</a>
18410
+ <a href="fetchRSS.mjs.html">fetchRSS.mjs</a>, <a href="fetchRSS.mjs.html#line62">line 62</a>
18324
18411
  </li></ul></dd>
18325
18412
 
18326
18413
 
@@ -18365,17 +18452,6 @@ console.log(getOptFetch({ maxRetries: 2 }, { timeout: 15000, label: 'abc' }))
18365
18452
 
18366
18453
 
18367
18454
 
18368
- <h5 class="h5-examples">Example</h5>
18369
-
18370
- <pre class="prettyprint"><code>import htmlToMarkdown from './src/htmlToMarkdown.mjs'
18371
-
18372
- console.log(htmlToMarkdown('&lt;p>a&lt;b>b&lt;/b>&lt;/p>&lt;p>c&lt;/p>'))
18373
- // => 'a**b**\n\nc'
18374
-
18375
- console.log(htmlToMarkdown('&lt;p>&lt;img src="a.png" />&lt;/p>', { image: true }))
18376
- // => '![](a.png)'</code></pre>
18377
-
18378
-
18379
18455
 
18380
18456
 
18381
18457
  <h5 class="h5-parameters">Parameters:</h5>
@@ -18391,12 +18467,8 @@ console.log(htmlToMarkdown('&lt;p>&lt;img src="a.png" />&lt;/p>', { image: true
18391
18467
  <th>Type</th>
18392
18468
 
18393
18469
 
18394
- <th>Attributes</th>
18395
-
18396
18470
 
18397
18471
 
18398
- <th>Default</th>
18399
-
18400
18472
 
18401
18473
  <th class="last">Description</th>
18402
18474
  </tr>
@@ -18407,7 +18479,7 @@ console.log(htmlToMarkdown('&lt;p>&lt;img src="a.png" />&lt;/p>', { image: true
18407
18479
 
18408
18480
  <tr>
18409
18481
 
18410
- <td class="name"><code>html</code></td>
18482
+ <td class="name"><code>rssUrl</code></td>
18411
18483
 
18412
18484
 
18413
18485
  <td class="type">
@@ -18421,35 +18493,23 @@ console.log(htmlToMarkdown('&lt;p>&lt;img src="a.png" />&lt;/p>', { image: true
18421
18493
  </td>
18422
18494
 
18423
18495
 
18424
- <td class="attributes">
18425
-
18426
-
18427
-
18428
-
18429
-
18430
- </td>
18431
-
18432
18496
 
18433
18497
 
18434
- <td class="default">
18435
-
18436
- </td>
18437
-
18438
18498
 
18439
- <td class="description last"><p>輸入HTML字串</p></td>
18499
+ <td class="description last"><p>輸入RSS網址字串</p></td>
18440
18500
  </tr>
18441
18501
 
18442
18502
 
18443
18503
 
18444
18504
  <tr>
18445
18505
 
18446
- <td class="name"><code>opt</code></td>
18506
+ <td class="name"><code>method</code></td>
18447
18507
 
18448
18508
 
18449
18509
  <td class="type">
18450
18510
 
18451
18511
 
18452
- <span class="param-type">Object</span>
18512
+ <span class="param-type">String</span>
18453
18513
 
18454
18514
 
18455
18515
 
@@ -18457,62 +18517,23 @@ console.log(htmlToMarkdown('&lt;p>&lt;img src="a.png" />&lt;/p>', { image: true
18457
18517
  </td>
18458
18518
 
18459
18519
 
18460
- <td class="attributes">
18461
-
18462
- &lt;optional><br>
18463
-
18464
-
18465
-
18466
-
18467
-
18468
- </td>
18469
-
18470
18520
 
18471
18521
 
18472
- <td class="default">
18473
-
18474
- <code>{}</code>
18475
-
18476
- </td>
18477
-
18478
-
18479
- <td class="description last"><p>輸入設定物件,預設{}</p>
18480
- <h6>Properties</h6>
18481
-
18482
-
18483
- <table class="params">
18484
- <thead>
18485
- <tr>
18486
-
18487
- <th>Name</th>
18488
-
18489
-
18490
- <th>Type</th>
18491
-
18492
-
18493
- <th>Attributes</th>
18494
-
18495
-
18496
-
18497
- <th>Default</th>
18498
-
18499
18522
 
18500
- <th class="last">Description</th>
18501
- </tr>
18502
- </thead>
18523
+ <td class="description last"><p>輸入抓取方式字串,可為'fetch'、'curl'、'auto'</p></td>
18524
+ </tr>
18503
18525
 
18504
- <tbody>
18505
18526
 
18506
18527
 
18507
18528
  <tr>
18508
18529
 
18509
- <td class="name"><code>image</code></td>
18530
+ <td class="name"><code>cfg</code></td>
18510
18531
 
18511
18532
 
18512
18533
  <td class="type">
18513
18534
 
18514
18535
 
18515
- <span class="param-type">Boolean</span>
18536
+ <span class="param-type">Object</span>
18516
18537
 
18517
18538
 
18518
18539
 
@@ -18520,33 +18541,10 @@ console.log(htmlToMarkdown('&lt;p>&lt;img src="a.png" />&lt;/p>', { image: true
18520
18541
  </td>
18521
18542
 
18522
18543
 
18523
- <td class="attributes">
18524
-
18525
- &lt;optional><br>
18526
-
18527
-
18528
-
18529
-
18530
-
18531
- </td>
18532
-
18533
18544
 
18534
18545
 
18535
- <td class="default">
18536
-
18537
- <code>false</code>
18538
-
18539
- </td>
18540
-
18541
-
18542
- <td class="description last"><p>輸入是否將img標籤轉為Markdown圖片語法布林值,預設false代表直接移除</p></td>
18543
- </tr>
18544
-
18545
-
18546
- </tbody>
18547
- </table>
18548
18546
 
18549
- </td>
18547
+ <td class="description last"><p>輸入已正規化之抓取設定物件</p></td>
18550
18548
  </tr>
18551
18549
 
18552
18550
 
@@ -18572,7 +18570,7 @@ console.log(htmlToMarkdown('&lt;p>&lt;img src="a.png" />&lt;/p>', { image: true
18572
18570
 
18573
18571
 
18574
18572
  <div class="param-desc">
18575
- <p>回傳Markdown字串,輸入非字串時回傳''</p>
18573
+ <p>回傳Promise,resolve回傳XML字串</p>
18576
18574
  </div>
18577
18575
 
18578
18576
 
@@ -18583,7 +18581,7 @@ console.log(htmlToMarkdown('&lt;p>&lt;img src="a.png" />&lt;/p>', { image: true
18583
18581
  </dt>
18584
18582
  <dd>
18585
18583
 
18586
- <span class="param-type">String</span>
18584
+ <span class="param-type">Promise</span>
18587
18585
 
18588
18586
 
18589
18587
 
@@ -18599,7 +18597,7 @@ console.log(htmlToMarkdown('&lt;p>&lt;img src="a.png" />&lt;/p>', { image: true
18599
18597
 
18600
18598
 
18601
18599
 
18602
- <h4 class="name" id="isHomepageHtml"><span class="type-signature"></span>isHomepageHtml<span class="signature">(html)</span><span class="type-signature"> &rarr; {Boolean}</span></h4>
18600
+ <h4 class="name" id="getXmlByCurl"><span class="type-signature type-signature-async">(async) </span>getXmlByCurl<span class="signature">(rssUrl, cfg)</span><span class="type-signature"> &rarr; {Promise}</span></h4>
18603
18601
 
18604
18602
 
18605
18603
 
@@ -18609,15 +18607,16 @@ console.log(htmlToMarkdown('&lt;p>&lt;img src="a.png" />&lt;/p>', { image: true
18609
18607
  <dl class="details">
18610
18608
 
18611
18609
  <dt class="tag-description">Description:</dt>
18612
- <dd class="tag-description"><ul class="dummy"><li><p>偵測HTML是否為觀察者網首頁</p>
18613
- <p>判準為首頁底部含A-Z作者索引之<dt>[A-Z]</dt>標記(真正的作者欄頁、欄目頁與主題集頁皆無此區塊),
18614
- 用以識別「請求被302導向首頁」之情形</p></li></ul></dd>
18610
+ <dd class="tag-description"><ul class="dummy"><li><p>以curl取回XML</p>
18611
+ <p>委派w-fetch-web之fetchWebByCurl, 失敗時拋出帶statusCode之錯誤(與fetchWithRetry之錯誤形狀一致, 供上層統一處理)。
18612
+ 注意: fetchWebByCurl之參數名為timeoutMs(非timeout), 且其重試退避為內建之3至15秒線性,
18613
+ 故opt之baseDelayMs、maxDelayMs與retryStatus於curl模式不生效</p></li></ul></dd>
18615
18614
 
18616
18615
 
18617
18616
 
18618
18617
  <dt class="tag-source">Source:</dt>
18619
18618
  <dd class="tag-source"><ul class="dummy"><li>
18620
- <a href="fetchGuancha.mjs.html">fetchGuancha.mjs</a>, <a href="fetchGuancha.mjs.html#line190">line 190</a>
18619
+ <a href="fetchRSS.mjs.html">fetchRSS.mjs</a>, <a href="fetchRSS.mjs.html#line36">line 36</a>
18621
18620
  </li></ul></dd>
18622
18621
 
18623
18622
 
@@ -18689,7 +18688,7 @@ console.log(htmlToMarkdown('&lt;p>&lt;img src="a.png" />&lt;/p>', { image: true
18689
18688
 
18690
18689
  <tr>
18691
18690
 
18692
- <td class="name"><code>html</code></td>
18691
+ <td class="name"><code>rssUrl</code></td>
18693
18692
 
18694
18693
 
18695
18694
  <td class="type">
@@ -18706,7 +18705,31 @@ console.log(htmlToMarkdown('&lt;p>&lt;img src="a.png" />&lt;/p>', { image: true
18706
18705
 
18707
18706
 
18708
18707
 
18709
- <td class="description last"><p>輸入HTML字串</p></td>
18708
+ <td class="description last"><p>輸入RSS網址字串</p></td>
18709
+ </tr>
18710
+
18711
+
18712
+
18713
+ <tr>
18714
+
18715
+ <td class="name"><code>cfg</code></td>
18716
+
18717
+
18718
+ <td class="type">
18719
+
18720
+
18721
+ <span class="param-type">Object</span>
18722
+
18723
+
18724
+
18725
+
18726
+ </td>
18727
+
18728
+
18729
+
18730
+
18731
+
18732
+ <td class="description last"><p>輸入已正規化之抓取設定物件</p></td>
18710
18733
  </tr>
18711
18734
 
18712
18735
 
@@ -18732,7 +18755,7 @@ console.log(htmlToMarkdown('&lt;p>&lt;img src="a.png" />&lt;/p>', { image: true
18732
18755
 
18733
18756
 
18734
18757
  <div class="param-desc">
18735
- <p>回傳是否為首頁之布林值</p>
18758
+ <p>回傳Promise,resolve回傳XML字串</p>
18736
18759
  </div>
18737
18760
 
18738
18761
 
@@ -18743,7 +18766,7 @@ console.log(htmlToMarkdown('&lt;p>&lt;img src="a.png" />&lt;/p>', { image: true
18743
18766
  </dt>
18744
18767
  <dd>
18745
18768
 
18746
- <span class="param-type">Boolean</span>
18769
+ <span class="param-type">Promise</span>
18747
18770
 
18748
18771
 
18749
18772
 
@@ -18759,7 +18782,7 @@ console.log(htmlToMarkdown('&lt;p>&lt;img src="a.png" />&lt;/p>', { image: true
18759
18782
 
18760
18783
 
18761
18784
 
18762
- <h4 class="name" id="isNonHolidayEntry"><span class="type-signature"></span>isNonHolidayEntry<span class="signature">(entry)</span><span class="type-signature"> &rarr; {Boolean}</span></h4>
18785
+ <h4 class="name" id="htmlToMarkdown"><span class="type-signature"></span>htmlToMarkdown<span class="signature">(html, opt<span class="signature-attributes">opt</span>)</span><span class="type-signature"> &rarr; {String}</span></h4>
18763
18786
 
18764
18787
 
18765
18788
 
@@ -18769,16 +18792,15 @@ console.log(htmlToMarkdown('&lt;p>&lt;img src="a.png" />&lt;/p>', { image: true
18769
18792
  <dl class="details">
18770
18793
 
18771
18794
  <dt class="tag-description">Description:</dt>
18772
- <dd class="tag-description"><ul class="dummy"><li><p>判斷條目是否為非假日條目</p>
18773
- <p>應排除者有二類:
18774
- 交易日標記(「國曆新年開始交易日」「農曆春節前最後交易日」「農曆春節後開始交易日」);
18775
- 結算作業日(「市場無交易,僅辦理結算交割作業」)</p></li></ul></dd>
18795
+ <dd class="tag-description"><ul class="dummy"><li><p>HTML轉Markdown</p>
18796
+ <p>採正則式逐項轉換, 不引入DOM解析器, 適用於已切出之正文區塊;
18797
+ 先移除script、style與註解, 再轉換標題、粗體、斜體、換行、連結與段落, 最後清除殘留標籤並收斂空行</p></li></ul></dd>
18776
18798
 
18777
18799
 
18778
18800
 
18779
18801
  <dt class="tag-source">Source:</dt>
18780
18802
  <dd class="tag-source"><ul class="dummy"><li>
18781
- <a href="fetchTwDataHoliday.mjs.html">fetchTwDataHoliday.mjs</a>, <a href="fetchTwDataHoliday.mjs.html#line48">line 48</a>
18803
+ <a href="htmlToMarkdown.mjs.html">htmlToMarkdown.mjs</a>, <a href="htmlToMarkdown.mjs.html#line28">line 28</a>
18782
18804
  </li></ul></dd>
18783
18805
 
18784
18806
 
@@ -18823,6 +18845,17 @@ console.log(htmlToMarkdown('&lt;p>&lt;img src="a.png" />&lt;/p>', { image: true
18823
18845
 
18824
18846
 
18825
18847
 
18848
+ <h5 class="h5-examples">Example</h5>
18849
+
18850
+ <pre class="prettyprint"><code>import htmlToMarkdown from './src/htmlToMarkdown.mjs'
18851
+
18852
+ console.log(htmlToMarkdown('&lt;p>a&lt;b>b&lt;/b>&lt;/p>&lt;p>c&lt;/p>'))
18853
+ // => 'a**b**\n\nc'
18854
+
18855
+ console.log(htmlToMarkdown('&lt;p>&lt;img src="a.png" />&lt;/p>', { image: true }))
18856
+ // => '![](a.png)'</code></pre>
18857
+
18858
+
18826
18859
 
18827
18860
 
18828
18861
  <h5 class="h5-parameters">Parameters:</h5>
@@ -18838,8 +18871,12 @@ console.log(htmlToMarkdown('&lt;p>&lt;img src="a.png" />&lt;/p>', { image: true
18838
18871
  <th>Type</th>
18839
18872
 
18840
18873
 
18874
+ <th>Attributes</th>
18875
+
18841
18876
 
18842
18877
 
18878
+ <th>Default</th>
18879
+
18843
18880
 
18844
18881
  <th class="last">Description</th>
18845
18882
  </tr>
@@ -18850,13 +18887,456 @@ console.log(htmlToMarkdown('&lt;p>&lt;img src="a.png" />&lt;/p>', { image: true
18850
18887
 
18851
18888
  <tr>
18852
18889
 
18853
- <td class="name"><code>entry</code></td>
18890
+ <td class="name"><code>html</code></td>
18854
18891
 
18855
18892
 
18856
18893
  <td class="type">
18857
18894
 
18858
18895
 
18859
- <span class="param-type">Object</span>
18896
+ <span class="param-type">String</span>
18897
+
18898
+
18899
+
18900
+
18901
+ </td>
18902
+
18903
+
18904
+ <td class="attributes">
18905
+
18906
+
18907
+
18908
+
18909
+
18910
+ </td>
18911
+
18912
+
18913
+
18914
+ <td class="default">
18915
+
18916
+ </td>
18917
+
18918
+
18919
+ <td class="description last"><p>輸入HTML字串</p></td>
18920
+ </tr>
18921
+
18922
+
18923
+
18924
+ <tr>
18925
+
18926
+ <td class="name"><code>opt</code></td>
18927
+
18928
+
18929
+ <td class="type">
18930
+
18931
+
18932
+ <span class="param-type">Object</span>
18933
+
18934
+
18935
+
18936
+
18937
+ </td>
18938
+
18939
+
18940
+ <td class="attributes">
18941
+
18942
+ &lt;optional><br>
18943
+
18944
+
18945
+
18946
+
18947
+
18948
+ </td>
18949
+
18950
+
18951
+
18952
+ <td class="default">
18953
+
18954
+ <code>{}</code>
18955
+
18956
+ </td>
18957
+
18958
+
18959
+ <td class="description last"><p>輸入設定物件,預設{}</p>
18960
+ <h6>Properties</h6>
18961
+
18962
+
18963
+ <table class="params">
18964
+ <thead>
18965
+ <tr>
18966
+
18967
+ <th>Name</th>
18968
+
18969
+
18970
+ <th>Type</th>
18971
+
18972
+
18973
+ <th>Attributes</th>
18974
+
18975
+
18976
+
18977
+ <th>Default</th>
18978
+
18979
+
18980
+ <th class="last">Description</th>
18981
+ </tr>
18982
+ </thead>
18983
+
18984
+ <tbody>
18985
+
18986
+
18987
+ <tr>
18988
+
18989
+ <td class="name"><code>image</code></td>
18990
+
18991
+
18992
+ <td class="type">
18993
+
18994
+
18995
+ <span class="param-type">Boolean</span>
18996
+
18997
+
18998
+
18999
+
19000
+ </td>
19001
+
19002
+
19003
+ <td class="attributes">
19004
+
19005
+ &lt;optional><br>
19006
+
19007
+
19008
+
19009
+
19010
+
19011
+ </td>
19012
+
19013
+
19014
+
19015
+ <td class="default">
19016
+
19017
+ <code>false</code>
19018
+
19019
+ </td>
19020
+
19021
+
19022
+ <td class="description last"><p>輸入是否將img標籤轉為Markdown圖片語法布林值,預設false代表直接移除</p></td>
19023
+ </tr>
19024
+
19025
+
19026
+ </tbody>
19027
+ </table>
19028
+
19029
+ </td>
19030
+ </tr>
19031
+
19032
+
19033
+ </tbody>
19034
+ </table>
19035
+
19036
+
19037
+
19038
+
19039
+
19040
+
19041
+
19042
+
19043
+
19044
+
19045
+
19046
+
19047
+
19048
+
19049
+
19050
+
19051
+ <h5 class="h5-returns">Returns:</h5>
19052
+
19053
+
19054
+ <div class="param-desc">
19055
+ <p>回傳Markdown字串,輸入非字串時回傳''</p>
19056
+ </div>
19057
+
19058
+
19059
+
19060
+ <dl class="param-type">
19061
+ <dt>
19062
+ Type
19063
+ </dt>
19064
+ <dd>
19065
+
19066
+ <span class="param-type">String</span>
19067
+
19068
+
19069
+
19070
+ </dd>
19071
+ </dl>
19072
+
19073
+
19074
+
19075
+
19076
+
19077
+
19078
+
19079
+
19080
+
19081
+
19082
+ <h4 class="name" id="isHomepageHtml"><span class="type-signature"></span>isHomepageHtml<span class="signature">(html)</span><span class="type-signature"> &rarr; {Boolean}</span></h4>
19083
+
19084
+
19085
+
19086
+
19087
+
19088
+
19089
+ <dl class="details">
19090
+
19091
+ <dt class="tag-description">Description:</dt>
19092
+ <dd class="tag-description"><ul class="dummy"><li><p>偵測HTML是否為觀察者網首頁</p>
19093
+ <p>判準為首頁底部含A-Z作者索引之<dt>[A-Z]</dt>標記(真正的作者欄頁、欄目頁與主題集頁皆無此區塊),
19094
+ 用以識別「請求被302導向首頁」之情形</p></li></ul></dd>
19095
+
19096
+
19097
+
19098
+ <dt class="tag-source">Source:</dt>
19099
+ <dd class="tag-source"><ul class="dummy"><li>
19100
+ <a href="fetchGuancha.mjs.html">fetchGuancha.mjs</a>, <a href="fetchGuancha.mjs.html#line186">line 186</a>
19101
+ </li></ul></dd>
19102
+
19103
+
19104
+
19105
+
19106
+
19107
+
19108
+
19109
+
19110
+
19111
+
19112
+
19113
+
19114
+
19115
+
19116
+
19117
+
19118
+
19119
+
19120
+
19121
+
19122
+
19123
+
19124
+
19125
+
19126
+
19127
+
19128
+
19129
+
19130
+
19131
+
19132
+
19133
+ </dl>
19134
+
19135
+
19136
+
19137
+
19138
+
19139
+
19140
+
19141
+
19142
+
19143
+
19144
+
19145
+
19146
+
19147
+ <h5 class="h5-parameters">Parameters:</h5>
19148
+
19149
+
19150
+ <table class="params">
19151
+ <thead>
19152
+ <tr>
19153
+
19154
+ <th>Name</th>
19155
+
19156
+
19157
+ <th>Type</th>
19158
+
19159
+
19160
+
19161
+
19162
+
19163
+ <th class="last">Description</th>
19164
+ </tr>
19165
+ </thead>
19166
+
19167
+ <tbody>
19168
+
19169
+
19170
+ <tr>
19171
+
19172
+ <td class="name"><code>html</code></td>
19173
+
19174
+
19175
+ <td class="type">
19176
+
19177
+
19178
+ <span class="param-type">String</span>
19179
+
19180
+
19181
+
19182
+
19183
+ </td>
19184
+
19185
+
19186
+
19187
+
19188
+
19189
+ <td class="description last"><p>輸入HTML字串</p></td>
19190
+ </tr>
19191
+
19192
+
19193
+ </tbody>
19194
+ </table>
19195
+
19196
+
19197
+
19198
+
19199
+
19200
+
19201
+
19202
+
19203
+
19204
+
19205
+
19206
+
19207
+
19208
+
19209
+
19210
+
19211
+ <h5 class="h5-returns">Returns:</h5>
19212
+
19213
+
19214
+ <div class="param-desc">
19215
+ <p>回傳是否為首頁之布林值</p>
19216
+ </div>
19217
+
19218
+
19219
+
19220
+ <dl class="param-type">
19221
+ <dt>
19222
+ Type
19223
+ </dt>
19224
+ <dd>
19225
+
19226
+ <span class="param-type">Boolean</span>
19227
+
19228
+
19229
+
19230
+ </dd>
19231
+ </dl>
19232
+
19233
+
19234
+
19235
+
19236
+
19237
+
19238
+
19239
+
19240
+
19241
+
19242
+ <h4 class="name" id="isNonHolidayEntry"><span class="type-signature"></span>isNonHolidayEntry<span class="signature">(entry)</span><span class="type-signature"> &rarr; {Boolean}</span></h4>
19243
+
19244
+
19245
+
19246
+
19247
+
19248
+
19249
+ <dl class="details">
19250
+
19251
+ <dt class="tag-description">Description:</dt>
19252
+ <dd class="tag-description"><ul class="dummy"><li><p>判斷條目是否為非假日條目</p>
19253
+ <p>應排除者有二類:
19254
+ 交易日標記(「國曆新年開始交易日」「農曆春節前最後交易日」「農曆春節後開始交易日」);
19255
+ 結算作業日(「市場無交易,僅辦理結算交割作業」)</p></li></ul></dd>
19256
+
19257
+
19258
+
19259
+ <dt class="tag-source">Source:</dt>
19260
+ <dd class="tag-source"><ul class="dummy"><li>
19261
+ <a href="fetchTwDataHoliday.mjs.html">fetchTwDataHoliday.mjs</a>, <a href="fetchTwDataHoliday.mjs.html#line48">line 48</a>
19262
+ </li></ul></dd>
19263
+
19264
+
19265
+
19266
+
19267
+
19268
+
19269
+
19270
+
19271
+
19272
+
19273
+
19274
+
19275
+
19276
+
19277
+
19278
+
19279
+
19280
+
19281
+
19282
+
19283
+
19284
+
19285
+
19286
+
19287
+
19288
+
19289
+
19290
+
19291
+
19292
+
19293
+
19294
+ </dl>
19295
+
19296
+
19297
+
19298
+
19299
+
19300
+
19301
+
19302
+
19303
+
19304
+
19305
+
19306
+
19307
+
19308
+ <h5 class="h5-parameters">Parameters:</h5>
19309
+
19310
+
19311
+ <table class="params">
19312
+ <thead>
19313
+ <tr>
19314
+
19315
+ <th>Name</th>
19316
+
19317
+
19318
+ <th>Type</th>
19319
+
19320
+
19321
+
19322
+
19323
+
19324
+ <th class="last">Description</th>
19325
+ </tr>
19326
+ </thead>
19327
+
19328
+ <tbody>
19329
+
19330
+
19331
+ <tr>
19332
+
19333
+ <td class="name"><code>entry</code></td>
19334
+
19335
+
19336
+ <td class="type">
19337
+
19338
+
19339
+ <span class="param-type">Object</span>
18860
19340
 
18861
19341
 
18862
19342
 
@@ -19482,7 +19962,7 @@ console.log(lookupAuthor([{ slug: 'gezhaoguang', name: '葛兆光' }], '葛兆
19482
19962
 
19483
19963
  <dt class="tag-source">Source:</dt>
19484
19964
  <dd class="tag-source"><ul class="dummy"><li>
19485
- <a href="fetchGuancha.mjs.html">fetchGuancha.mjs</a>, <a href="fetchGuancha.mjs.html#line436">line 436</a>
19965
+ <a href="fetchGuancha.mjs.html">fetchGuancha.mjs</a>, <a href="fetchGuancha.mjs.html#line432">line 432</a>
19486
19966
  </li></ul></dd>
19487
19967
 
19488
19968
 
@@ -19869,7 +20349,7 @@ console.log(lookupTopic([{ id: '301', name: '大数据' }], '大数据'))
19869
20349
 
19870
20350
  <dt class="tag-source">Source:</dt>
19871
20351
  <dd class="tag-source"><ul class="dummy"><li>
19872
- <a href="fetchGuancha.mjs.html">fetchGuancha.mjs</a>, <a href="fetchGuancha.mjs.html#line461">line 461</a>
20352
+ <a href="fetchGuancha.mjs.html">fetchGuancha.mjs</a>, <a href="fetchGuancha.mjs.html#line457">line 457</a>
19873
20353
  </li></ul></dd>
19874
20354
 
19875
20355
 
@@ -20221,7 +20701,7 @@ console.log(lookupTopic('财经'))
20221
20701
 
20222
20702
  <dt class="tag-source">Source:</dt>
20223
20703
  <dd class="tag-source"><ul class="dummy"><li>
20224
- <a href="fetchGuancha.mjs.html">fetchGuancha.mjs</a>, <a href="fetchGuancha.mjs.html#line243">line 243</a>
20704
+ <a href="fetchGuancha.mjs.html">fetchGuancha.mjs</a>, <a href="fetchGuancha.mjs.html#line239">line 239</a>
20225
20705
  </li></ul></dd>
20226
20706
 
20227
20707
 
@@ -20867,7 +21347,7 @@ console.log(parseIntComma('1,234,567'), parseIntComma('-'), parseIntComma(''), p
20867
21347
 
20868
21348
  <dt class="tag-source">Source:</dt>
20869
21349
  <dd class="tag-source"><ul class="dummy"><li>
20870
- <a href="fetchGuancha.mjs.html">fetchGuancha.mjs</a>, <a href="fetchGuancha.mjs.html#line278">line 278</a>
21350
+ <a href="fetchGuancha.mjs.html">fetchGuancha.mjs</a>, <a href="fetchGuancha.mjs.html#line274">line 274</a>
20871
21351
  </li></ul></dd>
20872
21352
 
20873
21353
 
@@ -22274,6 +22754,175 @@ console.log(safeFilename('a/b:c*d?e'))
22274
22754
 
22275
22755
 
22276
22756
 
22757
+ <h4 class="name" id="stripHtml"><span class="type-signature"></span>stripHtml<span class="signature">(html)</span><span class="type-signature"> &rarr; {String}</span></h4>
22758
+
22759
+
22760
+
22761
+
22762
+
22763
+
22764
+ <dl class="details">
22765
+
22766
+ <dt class="tag-description">Description:</dt>
22767
+ <dd class="tag-description"><ul class="dummy"><li><p>去除HTML標籤與實體, 保留段落換行</p>
22768
+ <p>與htmlToMarkdown不同, 本函數輸出純文字(不產生Markdown標記), 供feed內嵌全文等
22769
+ 「只要內文、不要格式」之場景使用;
22770
+ 先移除script與style, 再將段落類閉合標籤與br轉為換行, 最後清除殘留標籤並解碼實體</p></li></ul></dd>
22771
+
22772
+
22773
+
22774
+ <dt class="tag-source">Source:</dt>
22775
+ <dd class="tag-source"><ul class="dummy"><li>
22776
+ <a href="stripHtml.mjs.html">stripHtml.mjs</a>, <a href="stripHtml.mjs.html#line22">line 22</a>
22777
+ </li></ul></dd>
22778
+
22779
+
22780
+
22781
+
22782
+
22783
+
22784
+
22785
+
22786
+
22787
+
22788
+
22789
+
22790
+
22791
+
22792
+
22793
+
22794
+
22795
+
22796
+
22797
+
22798
+
22799
+
22800
+
22801
+
22802
+
22803
+
22804
+
22805
+
22806
+
22807
+
22808
+
22809
+ </dl>
22810
+
22811
+
22812
+
22813
+
22814
+
22815
+
22816
+
22817
+
22818
+
22819
+
22820
+
22821
+ <h5 class="h5-examples">Example</h5>
22822
+
22823
+ <pre class="prettyprint"><code>import stripHtml from './src/stripHtml.mjs'
22824
+
22825
+ console.log(stripHtml('&lt;p>第一段&lt;b>粗體&lt;/b>&lt;/p>&lt;p>第二段&amp;amp;實體&lt;/p>'))
22826
+ // => '第一段粗體\n第二段&amp;實體'</code></pre>
22827
+
22828
+
22829
+
22830
+
22831
+ <h5 class="h5-parameters">Parameters:</h5>
22832
+
22833
+
22834
+ <table class="params">
22835
+ <thead>
22836
+ <tr>
22837
+
22838
+ <th>Name</th>
22839
+
22840
+
22841
+ <th>Type</th>
22842
+
22843
+
22844
+
22845
+
22846
+
22847
+ <th class="last">Description</th>
22848
+ </tr>
22849
+ </thead>
22850
+
22851
+ <tbody>
22852
+
22853
+
22854
+ <tr>
22855
+
22856
+ <td class="name"><code>html</code></td>
22857
+
22858
+
22859
+ <td class="type">
22860
+
22861
+
22862
+ <span class="param-type">String</span>
22863
+
22864
+
22865
+
22866
+
22867
+ </td>
22868
+
22869
+
22870
+
22871
+
22872
+
22873
+ <td class="description last"><p>輸入HTML字串</p></td>
22874
+ </tr>
22875
+
22876
+
22877
+ </tbody>
22878
+ </table>
22879
+
22880
+
22881
+
22882
+
22883
+
22884
+
22885
+
22886
+
22887
+
22888
+
22889
+
22890
+
22891
+
22892
+
22893
+
22894
+
22895
+ <h5 class="h5-returns">Returns:</h5>
22896
+
22897
+
22898
+ <div class="param-desc">
22899
+ <p>回傳純文字字串,輸入非字串時回傳''</p>
22900
+ </div>
22901
+
22902
+
22903
+
22904
+ <dl class="param-type">
22905
+ <dt>
22906
+ Type
22907
+ </dt>
22908
+ <dd>
22909
+
22910
+ <span class="param-type">String</span>
22911
+
22912
+
22913
+
22914
+ </dd>
22915
+ </dl>
22916
+
22917
+
22918
+
22919
+
22920
+
22921
+
22922
+
22923
+
22924
+
22925
+
22277
22926
  <h4 class="name" id="toDatetimeUTC8"><span class="type-signature"></span>toDatetimeUTC8<span class="signature">(value)</span><span class="type-signature"> &rarr; {String}</span></h4>
22278
22927
 
22279
22928
 
@@ -22285,14 +22934,18 @@ console.log(safeFilename('a/b:c*d?e'))
22285
22934
 
22286
22935
  <dt class="tag-description">Description:</dt>
22287
22936
  <dd class="tag-description"><ul class="dummy"><li><p>時間轉UTC+8之日期時間字串</p>
22288
- <p>可接受ISO時間字串、RFC822時間字串、unix秒數(非毫秒)或Date物件, 一律輸出台灣時間'YYYY-MM-DD HH:mm:ss';
22289
- 以dayjs之utc外掛指定固定偏移+8, 不受執行環境時區影響(在UTC伺服器上結果相同)</p></li></ul></dd>
22937
+ <p>可接受ISO時間字串、RFC822時間字串、純日期字串、unix秒數(Number, 非毫秒)或Date物件,
22938
+ 一律輸出台灣時間'YYYY-MM-DD HH:mm:ss', 且不受執行環境時區影響。</p>
22939
+ <p>兩類輸入之時區語意不同, 故分開處理:
22940
+ 帶有時刻資訊者(ISO、RFC822、unix秒數、Date)代表一個絕對時點, 換算為UTC+8之當地時刻;
22941
+ 純日期字串本身不含時點, 直接視為UTC+8當日之00:00:00, 不因執行環境時區而位移日期
22942
+ (否則在UTC+14環境下'2024'會被解為2023-12-31)。</p></li></ul></dd>
22290
22943
 
22291
22944
 
22292
22945
 
22293
22946
  <dt class="tag-source">Source:</dt>
22294
22947
  <dd class="tag-source"><ul class="dummy"><li>
22295
- <a href="toDatetimeUTC8.mjs.html">toDatetimeUTC8.mjs</a>, <a href="toDatetimeUTC8.mjs.html#line41">line 41</a>
22948
+ <a href="toDatetimeUTC8.mjs.html">toDatetimeUTC8.mjs</a>, <a href="toDatetimeUTC8.mjs.html#line52">line 52</a>
22296
22949
  </li></ul></dd>
22297
22950
 
22298
22951
 
@@ -22347,6 +23000,9 @@ console.log(toDatetimeUTC8('2026-08-07T01:02:03Z'))
22347
23000
  console.log(toDatetimeUTC8(1786000000))
22348
23001
  // => '2026-08-06 15:06:40'
22349
23002
 
23003
+ console.log(toDatetimeUTC8('2024'), toDatetimeUTC8('20260807'))
23004
+ // => '2024-01-01 00:00:00' '2026-08-07 00:00:00'
23005
+
22350
23006
  console.log(toDatetimeUTC8('abc'), toDatetimeUTC8(''), toDatetimeUTC8(null))
22351
23007
  // => '' '' ''</code></pre>
22352
23008
 
@@ -22401,7 +23057,7 @@ console.log(toDatetimeUTC8('abc'), toDatetimeUTC8(''), toDatetimeUTC8(null))
22401
23057
 
22402
23058
 
22403
23059
 
22404
- <td class="description last"><p>輸入ISO或RFC822時間字串、unix秒數或Date物件</p></td>
23060
+ <td class="description last"><p>輸入ISO或RFC822時間字串、純日期字串、unix秒數或Date物件</p></td>
22405
23061
  </tr>
22406
23062
 
22407
23063
 
@@ -22636,7 +23292,7 @@ console.log(toRocDate('20260807'), toRocDate('19110101'))
22636
23292
  <br class="clear">
22637
23293
 
22638
23294
  <footer>
22639
- Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.5</a> on Fri Aug 07 2026 12:04:51 GMT+0800 (台北標準時間) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
23295
+ Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.5</a> on Sat Aug 08 2026 12:20:15 GMT+0800 (台北標準時間) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
22640
23296
  </footer>
22641
23297
 
22642
23298
  <script>prettyPrint();</script>