dms-scrape 0.3.1 → 0.4.1

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.
package/test.mjs CHANGED
@@ -1,5 +1,25 @@
1
1
  import { dmsScrape } from "./index.mjs";
2
-
2
+ import * as cheerio from "cheerio"
3
+ import { cteetest } from "./test/tested/cteetest.js";
4
+ import { DIGITIMES } from "./sources/T1/DIGITIMES.mjs";
5
+ import { digitest } from "./test/tested/digitest.js";
6
+ import { chinatest } from "./test/tested/chinatest.js";
7
+ import { CHINATIMES } from "./sources/T2/CHINATIMES.mjs";
8
+ import { NXTAPPLE } from "./sources/T2/NXTAPPLE.mjs";
9
+ import { SETN } from "./sources/T3/SETN.mjs";
10
+ import { setntest } from "./test/tested/setntest.js";
11
+ import { techorangetest } from "./test/techrangetest.js";
12
+ import { TECHORANGE } from "./sources/T5/TECHORANGE.mjs";
13
+ import { TECHBANG } from "./sources/T5/TECHBANG.mjs";
14
+ import { techbangtest } from "./test/techbangtest.js";
15
+ import { CNYES } from "./sources/T5/CNYES.mjs";
16
+ import { cnyestest } from "./test/cnyestest.js";
17
+ import { SAYDIGI } from "./sources/T5/SAYDIGI.mjs";
18
+ import { saydigitest } from "./test/saydigitest.js";
19
+ import { COMPOTECHASIA } from "./sources/T5/COMPOTECHASIA.mjs";
20
+ import { compotechtest } from "./test/compotechtest.js";
21
+ import { INSIDE } from "./sources/T5/INSIDE.mjs";
22
+ import { insidetest } from "./test/insidetest.js";
3
23
  const testLinks = [
4
24
  "https://www.cool3c.com/article/202079",
5
25
 
@@ -20,14 +40,69 @@ const buggedLinks = ["https://www.eprice.com.tw/mobile/talk/4523/5811558/1/"];
20
40
  const testLink = [
21
41
  "https://money.udn.com/money/story/5612/8219989",
22
42
  ];
23
- async function getTestLinks() {
24
- var response = [];
25
- for (const link of testLink) {
26
- response.push(await dmsScrape("link", link));
27
- // response = await fetch(link);
28
- }
29
- // return await response.text();
30
- return response;
31
- }
32
-
33
- console.log(await getTestLinks());
43
+ // async function getTestLinks() {
44
+ // var response = [];
45
+ // for (const link of testLink) {
46
+ // response.push(await dmsScrape("link", link));
47
+ // // response = await fetch(link);
48
+ // }
49
+ // // return await response.text();
50
+ // return response;
51
+ // }
52
+
53
+ // console.log(await getTestLinks());
54
+
55
+ // console.log(await dmsScrape("html", "https://www.setn.com/News.aspx?NewsID=1526574", setntest))
56
+
57
+
58
+
59
+
60
+
61
+
62
+
63
+ // console.log(await dmsScrape("html", "https://buzzorange.com/techorange/2024/10/03/eu-plans-to-hit-china-based-ev-makers-with-additional-tariffs/", techorangetest))
64
+
65
+ // const $ = cheerio.load(chinatest)
66
+ // console.log(CHINATIMES($))
67
+
68
+ // const inithtml = await (await fetch("https://www.inside.com.tw/article/36326-meta-announces-300-quest-3s-a-cheaper")).text()
69
+
70
+ // let $ = cheerio.load(await (await fetch("https://www.inside.com.tw/article/36326-meta-announces-300-quest-3s-a-cheaper")).text())
71
+ // $('script, style, link').remove();
72
+ // let cleanedHTML = $.html();
73
+ // console.log(cleanedHTML)
74
+
75
+ // console.log(NXTAPPLE(cheerio.load(cleanedHTML)))
76
+ // ${
77
+ // console.log(CNYES(cheerio.load(cnyestest)))
78
+ // console.log(SAYDIGI(cheerio.load(saydigitest)))
79
+ // console.log(await dmsScrape("link", "https://www.compotechasia.com/a/press/2024/0919/58658.html"))
80
+
81
+ //seriosu bug: https://www.xfastest.com/thread-292861-1-1.html
82
+ // bug title: https://www.eprice.com.tw/mobile/talk/6113/5812708/1
83
+ //unwanted content: https://www.sogi.com.tw/articles/realme_13_pro_plus/6263085
84
+ /// undefined: https://www.digitimes.com.tw/tech/dt/n/shwnws.asp?cnlid=1&id=0000703998_EAN8YJ9ZLL4AQU7Z9IWZT
85
+ // const urls = ["https://www.xfastest.com/thread-292892-1-1.html", "https://www.cool3c.com/article/225948" , "https://tw.nextapple.com/finance/20241002/F46EF42772FDB0898B925982A2D4F7D3" ]
86
+ // for (const url of urls) {
87
+ // await multscrape(url);
88
+ // }
89
+
90
+ /// sogi promotion: https://www.sogi.com.tw/articles/samsung_galaxy_tab_s10_ultra/6263080
91
+ // eprice title: https://www.eprice.com.tw/mobile/talk/102/5812686/1
92
+ ///bug: https://www.cool3c.com/article/226021
93
+ // multscrape("https://3c.ltn.com.tw/news/59704")
94
+
95
+ // async function multscrape(url) {
96
+ // const data = await dmsScrape("link", url);
97
+ // console.log(data.title);
98
+ // console.log(data.date + ' / ' + data.source + ' / ' + data.author);
99
+ // console.log(data.url);
100
+ // console.log(data.content);
101
+ // }
102
+ // console.log(COMPOTECHASIA(cheerio.load(compotechtest)))
103
+ // console.log(INSIDE(cheerio.load(insidetest)))
104
+
105
+ console.log(await dmsScrape("link", "https://www.ctee.com.tw/news/20240805700832-431207"))
106
+ // const link = "https://www.chinatimes.com/newspapers/20240820000224-260204?chdtv"
107
+ // const check = "https://www.chinatimes"
108
+ // console.log(link.startsWith(check))