dms-scrape 0.3.0 → 0.4.0
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/README.md +13 -14
- package/extractfrombrowser.js +12 -0
- package/index.mjs +38 -5
- package/lib/array2String.mjs +5 -0
- package/lib/determineCategory.mjs +5 -5
- package/lib/filterContent.mjs +31 -42
- package/lib/processHTML.mjs +39 -71
- package/lib/sources.mjs +52 -0
- package/package.json +1 -1
- package/sources/T1/CTEE.mjs +32 -18
- package/sources/T1/DIGITIMES.mjs +18 -4
- package/sources/T1/UDNMoney.mjs +3 -3
- package/sources/T2/CHINATIMES.mjs +36 -17
- package/sources/T2/NXTAPPLE.mjs +30 -0
- package/sources/T3/SETN.mjs +35 -0
- package/sources/T5/CNYES.mjs +25 -0
- package/sources/T5/COMPOTECHASIA.mjs +30 -0
- package/sources/T5/INSIDE.mjs +15 -0
- package/sources/T5/SAYDIGI.mjs +22 -0
- package/sources/T5/TECHBANG.mjs +20 -0
- package/sources/T5/TECHORANGE.mjs +23 -21
- package/test/cnyestest.js +814 -0
- package/test/compotechtest.js +561 -0
- package/test/insidetest.js +1399 -0
- package/test/saydigitest.js +1000 -0
- package/test/techbangtest.js +1109 -0
- package/test/techrangetest.js +3101 -0
- package/test/tested/chinatest.js +4761 -0
- package/test/tested/cteetest.js +1406 -0
- package/test/tested/digitest.html +1789 -0
- package/test/tested/digitimes2.js +2218 -0
- package/test/tested/nextapple.js +1546 -0
- package/test/tested/setntest.js +2728 -0
- package/test.mjs +62 -13
- package/sources/T1/digitimes.html +0 -2598
- package/sources/T1/digitimes2.html +0 -2567
- package/sources/T5/TECHBANG(unfinished).mjs +0 -13
- /package/{sources/T1 → test/tested}/digitimes3.html +0 -0
- /package/{sources/T1 → test/tested}/digitimes4.html +0 -0
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/digitimes2.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
|
|
|
@@ -18,16 +38,45 @@ const testLinks = [
|
|
|
18
38
|
|
|
19
39
|
const buggedLinks = ["https://www.eprice.com.tw/mobile/talk/4523/5811558/1/"];
|
|
20
40
|
const testLink = [
|
|
21
|
-
"https://
|
|
41
|
+
"https://money.udn.com/money/story/5612/8219989",
|
|
22
42
|
];
|
|
23
|
-
async function getTestLinks() {
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
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
|
+
console.log(await dmsScrape("link", "https://www.inside.com.tw/article/36326-meta-announces-300-quest-3s-a-cheaper"))
|
|
81
|
+
// console.log(COMPOTECHASIA(cheerio.load(compotechtest)))
|
|
82
|
+
// console.log(INSIDE(cheerio.load(insidetest)))
|