Added device image in GSMArena scraper + added child_process package

This commit is contained in:
Lucas Gabriel 2024-09-08 10:44:48 -03:00
parent 112cf3e960
commit dac6ebf032
No known key found for this signature in database
GPG Key ID: D9B075FC6DC93985
3 changed files with 11 additions and 1 deletions

View File

@ -110,7 +110,9 @@ function formatPhone(phone) {
.map(([label, key]) => `<b>${label}:</b> <code>${formattedPhone[key]}</code>`)
.join("\n\n");
return `<b>${formattedPhone.name}</b>\n\n${attributes}`;
const deviceImage = phone.picture ? `<b>Device Image</b>: ${phone.picture}` : '';
return `<b>${formattedPhone.name}</b>\n\n${attributes}\n\n${deviceImage}`;
}
async function fetchHtml(url) {

7
package-lock.json generated
View File

@ -10,6 +10,7 @@
"license": "BSD-3-Clause",
"dependencies": {
"axios": "^1.7.7",
"child_process": "^1.0.2",
"node-html-parser": "^6.1.13",
"nodemon": "^3.1.4",
"telegraf": "^4.16.3"
@ -131,6 +132,12 @@
"integrity": "sha512-T7zexNBwiiaCOGDg9xNX9PBmjrubblRkENuptryuI64URkXDFum9il/JGL8Lm8wYfAXpredVXXZz7eMHilimiQ==",
"license": "MIT"
},
"node_modules/child_process": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/child_process/-/child_process-1.0.2.tgz",
"integrity": "sha512-Wmza/JzL0SiWz7kl6MhIKT5ceIlnFPJX+lwUGj7Clhy5MMldsSoJR0+uvRzOS5Kv45Mq7t1PoE8TsOA9bzvb6g==",
"license": "ISC"
},
"node_modules/chokidar": {
"version": "3.6.0",
"resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.6.0.tgz",

View File

@ -10,6 +10,7 @@
"license": "BSD-3-Clause",
"dependencies": {
"axios": "^1.7.7",
"child_process": "^1.0.2",
"node-html-parser": "^6.1.13",
"nodemon": "^3.1.4",
"telegraf": "^4.16.3"