Skip to content

Commit

Permalink
add max_price option
Browse files Browse the repository at this point in the history
  • Loading branch information
5andr0 committed Jan 11, 2021
1 parent a7fcb1a commit b469fc5
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
11 changes: 11 additions & 0 deletions Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,17 @@ void ParseProductInfos(in string body)
{
if (info.Delivery.HasValue)
{
string maxPrice = config["general"]["max_price"];
if (!String.IsNullOrEmpty(maxPrice))
{
if (info.Price > Convert.ToDecimal(maxPrice))
{
Console.WriteLine(info.Title + " is available for " + info.Price + " Euro "
+ " but exceeds the price limit of " + maxPrice + " Euro");
continue;
}
}

Console.WriteLine(info.Title + " is available for " + info.Price + " Euro at " + info.Delivery);
driver.SwitchTo().NewWindow(WindowType.Tab);
driver.Navigate().GoToUrl("https://www.mediamarkt.de" + info.Url);
Expand Down
2 changes: 2 additions & 0 deletions config.ini
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
frequency = 10
# start a headless chrome instance when set to 1
headless = 0
# items with a higher price than max_price are ignored. Use . as decimal separator
#max_price = 499.99

[collections]
# set to 1 to fetch all key-matching RTX cards from www.mediamarkt.de/de/campaign/grafikkarten-nvidia-geforce-rtx-30.html
Expand Down

0 comments on commit b469fc5

Please sign in to comment.