1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
import { load } from "https://esm.sh/cheerio";
const forbetEventsScrapper = (html: string, baseUrl: string) => {
const $ = load(html);
const events = [];
$("td.contentmiddle > div > div.schema .rcnt").each((i, el) => {
const bet = $(el).text();
const id = $(el).find(".stcn .nofav.fav_icon").attr("id");
const link = $(el).find(".tnms a").attr("href");
const homeTeam = $(el).find(".tnms .homeTeam").text();
const awayTeam = $(el).find(".tnms .awayTeam").text();
const date = $(el).find(".tnms .date_bah").text();
const probability1 = $(el).find(".fprc > span:nth-child(1)").text();
const probabilityX = $(el).find(".fprc > span:nth-child(2)").text();
const probability2 = $(el).find(".fprc > span:nth-child(3)").text();
const result = $(el).find(".lscr_td .l_scr").text();
// Odds 1X2
const odds1X2Home = $(el)
.find(".bigOnly.prmod > div > span:nth-child(1)")
.text();
const odds1X2Draw = $(el)
.find(".bigOnly.prmod > div > span:nth-child(2)")
.text();
const odds1X2Away = $(el)
.find(".bigOnly.prmod > div > span:nth-child(3)")
.text();
const predictionYes = $(el).find(".predict_y > span").text();
const predictionNo = $(el).find(".predict_no > span").text();
const prediction = $(el).find(".forepr > span").text();
const predictionScore = $(el).find(".ex_sc").text();
const avgGoals = $(el).find(".avg_sc").text();
const odd = $(el).find(".bigOnly > span.lscrsp").text();
const score = $(el).find(".lscr_td .l_scr").text();
const status = $(el).find(".lmin_td").text();
const single = {
id,
link: baseUrl + link,
homeTeam,
awayTeam,
date,
result,
probability1,
probabilityX,
probability2,
prediction,
predictionScore,
avgGoals,
odd,
score,
status,
odds1X2Home,
odds1X2Draw,
odds1X2Away,
success: !!predictionYes,
};
if (odd.trim() !== "-") {
events.push(single);
}
});
return events;
};
export default forbetEventsScrapper;
Val Town is a social website to write and deploy JavaScript.
Build APIs and schedule functions from your browser.
Comments
Nobody has commented on this val yet: be the first!
June 26, 2024