update,
This commit is contained in:
61
ych1990101/task1/src/test.js
Normal file
61
ych1990101/task1/src/test.js
Normal file
@@ -0,0 +1,61 @@
|
||||
scrape_list = [".cday", ".alloddsLink", ".closeDay", ".cflag", ".h2hLink"];
|
||||
|
||||
document.querySelectorAll(".cflag img").item(0);
|
||||
|
||||
var output = [];
|
||||
|
||||
var l_cflag = [];
|
||||
document.querySelectorAll(".cflag img").forEach((el, idx) => {
|
||||
if (idx != 0) {
|
||||
l_cflag.push(el.getAttribute("title"));
|
||||
}
|
||||
});
|
||||
|
||||
var link_with_date = [];
|
||||
//var test = document.querySelector('#SelectDateTimeId').textContent
|
||||
var test = "21/1(SUN)22/1(MON)23/1(TUE)24/1(WED)25/1(THU)";
|
||||
var regex = /\d+\/\d+\(\w+\)/g;
|
||||
var result = test.match(regex);
|
||||
var date_string = result.map((r) => {
|
||||
var temp = r.split("(")[0];
|
||||
[day, month] = temp.split("/");
|
||||
formatted_month = month < 10 ? "0" + month : month;
|
||||
formatted_day = day < 10 ? "0" + day : day;
|
||||
return `${2024}-${formatted_month}-${formatted_day}`;
|
||||
});
|
||||
link_with_date = date_string.map(
|
||||
(d) => `https://bet.hkjc.com/football/odds/odds_hil.aspx?lang=en&mdate=${d}`
|
||||
);
|
||||
console.log(link_with_date);
|
||||
|
||||
// const str = "Hello, World!";
|
||||
// const regex = /Hello/;
|
||||
// const result = str.match(regex);
|
||||
// console.log(result); // Output: ["Hello"]
|
||||
|
||||
var output = [];
|
||||
document.querySelectorAll(".couponRow").forEach((el, idx) => {
|
||||
if (idx == 1) {
|
||||
console.log(el.querySelectorAll(".h2hLink"));
|
||||
}
|
||||
});
|
||||
|
||||
var output = [];
|
||||
document.querySelectorAll(".couponRow").forEach((el, idx) => {
|
||||
if (idx == 1) {
|
||||
if (el.querySelectorAll(".cflag img").length > 0) {
|
||||
var cflag = el
|
||||
.querySelectorAll(".cflag img")
|
||||
.item(0)
|
||||
.getAttribute("title");
|
||||
var alloddsLink = el.querySelectorAll(".alloddsLink").item(0).textContent;
|
||||
querySelectorAll(".h2hLink").item(0).click();
|
||||
console.log(cflag);
|
||||
}
|
||||
}
|
||||
});
|
||||
console.log(output.length);
|
||||
|
||||
scrape_list.forEach((cls_string) => {
|
||||
// document.querySelectorAll(cls_string).forEach(el => )
|
||||
});
|
Reference in New Issue
Block a user