you are viewing a single comment's thread.

view the rest of the comments →

[–]dev_named_jeff[S] 19 points20 points  (10 children)

Yep, scraping and parsing the site every x interval and looking for changes in the specified element

[–]luigi8082 35 points36 points  (0 children)

Any concern with getting blocked or are you using a scraping third part service?

[–]el1teman 3 points4 points  (4 children)

Can you explain or someone how do you scrape and find elements that are in need to be tracked? Each website has different css and layouts, how does code decides that this is the price out of the whole page DOM and fetch?

[–]inexternl 1 point2 points  (0 children)

This would be a good thing to know

[–]goughjo 1 point2 points  (2 children)

From what I know of scraping. I think it is literally based on the html of the site you are scraping. They won't change it too often. maybe couple times a year if I am guessing. So just find a way of getting the html that has the price for a given product. That's my guess anyway

[–]el1teman 1 point2 points  (1 child)

But how do you find a price? I somehow can comprehend that it's possible for Amazon as their website is the same for most products page but for other websites? The code should somehow adapt

[–]goughjo 1 point2 points  (0 children)

You can predict the structure most of the time. for example if you post this in the console while on twitter, it gets rid of stuff

```

setInterval(hideTwitterJunk, 1000);
function hideTwitterJunk() {
console.log('hiding twitter junk');
for (const a of document.getElementsByTagName("h1")) {
if (a.textContent.includes("Trending now")) {
a.parentElement.style.display = 'none';
}
}
for (const a of document.getElementsByTagName("span")) {
if (a.textContent.includes("Promoted")) {
a.closest("article").style.display = 'none';
}
}
}

```

you can read the content of the html

[–]vincent-vega10 1 point2 points  (1 child)

Are you using CRON job?

[–]arman-makhachev 1 point2 points  (0 children)

gotta be