Skip to content

Commit

Permalink
Merge pull request #1 from NSG22/main
Browse files Browse the repository at this point in the history
Pull Request: Übernahme von Commits aus dem Fork
  • Loading branch information
NapoII committed Apr 3, 2024
2 parents 23516c7 + 8bf1163 commit 88528be
Show file tree
Hide file tree
Showing 5 changed files with 57 additions and 65 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
**/__pycache__/
*.ini
!__ini__.py
*eggs_*

# Git Ignore File
#
Expand Down
34 changes: 7 additions & 27 deletions README.html
Original file line number Diff line number Diff line change
Expand Up @@ -55,43 +55,30 @@
</head>

<body>
<div class="container">
<a href="https://github.com/NapoII/netcup_egg_tracker">
<img src="https://raw.githubusercontent.com/NapoII/netcup_egg_tracker/main/README_img/Readme_top.png" alt="GitHub/NapoII/netcup_egg_tracker" style="max-width: 100%; max-height: 200px;">
</a>
<a href="https://github.com/NapoII/netcup_egg_tracker/archive/refs/heads/main.zip"><img src="https://img.shields.io/github/downloads/NapoII/netcup_egg_tracker/total" alt="downloads/total"></a>
<a href="https://github.com/NapoII/netcup_egg_tracker/archive/refs/heads/main.zip"><img src="https://img.shields.io/github/repo-size/NapoII/netcup_egg_tracker" alt="github/repo-size"></a>
<a href="https://github.com/NapoII/netcup_egg_tracker/blob/main/LICENSE"><img src="https://img.shields.io/github/license/NapoII/netcup_egg_tracker" alt="github/license"></a>
<a href="https://img.shields.io/github/issues/NapoII/netcup_egg_tracker?style=plastic"><img src="https://img.shields.io/github/last-commit/NapoII/netcup_egg_tracker/total" alt="github/last-commit"></a>
<a href="https://img.shields.io/github/issues/NapoII/netcup_egg_tracker?style=plastic"><img src="https://img.shields.io/github/issues-raw/NapoII/netcup_egg_tracker" alt="github/issues_open"></a>
<a href="https://github.com/NapoII/netcup_egg_tracker/stargazers"><img src="https://img.shields.io/github/stars/NapoII/netcup_egg_tracker?style=social" alt="github/stars"></a>
<a href="https://discord.gg/knTKtKVfnr"><img src="https://img.shields.io/discord/190307701169979393" alt="discord"></a>
<div class="container">
<a href="https://github.com/NSG22/netcup_egg_tracker/blob/main/LICENSE"><img src="https://img.shields.io/github/license/NSG22/netcup_egg_tracker" alt="github/license"></a>
<a href="https://img.shields.io/gitea/last-commit/nsg22/netcup_egg_tracker/main?style=plastic"><img src="https://img.shields.io/gitea/last-commit/nsg22/netcup_egg_tracker/main" alt="github/last-commit"></a>
<a href="https://img.shields.io/github/issues-raw/NSG22/netcup_egg_tracker?style=plastic"><img src="https://img.shields.io/github/issues-raw/NSG22/netcup_egg_tracker" alt="github/issues_open"></a>
<a href="https://github.com/NSG22/netcup_egg_tracker/stargazers"><img src="https://img.shields.io/github/stars/NSG22/netcup_egg_tracker?style=social" alt="github/stars"></a>

<h1>netcup_egg_tracker</h1>
<p>Dieses Python-Skript sucht nach versteckten "Eiern" auf der Website www.netcup.de und listet die Sonderangebote in Textdateien auf.</p>

<div>
<p>
Besuchen Sie <a href="http://napo-ii.de/">napo-ii.de</a> für den Live-Tracker mit den aktuellen Eggs vom Netcup-Event.
</p>
</div>


<h2>📝 Table of Contents</h2>
<ul>
<li><a href="#demo">Demo / Working</a></li>
<li><a href="#usage">Install</a></li>
<li><a href="#Use">How it works</a></li>
<li><a href="#coffee">Buy me a coffee</a></li>
<li><a href="#LICENSE">LICENSE</a></li>
</ul>

<h2>🎥 Demo / Working <a name="demo"></a></h2>
<img src="https://i.imgur.com/YE1GK5y.png" alt="Img von folder mit angeboten">
<img src="https://raw.githubusercontent.com/NSG22/netcup_egg_tracker/main/README_img/demo.png" alt="Img von folder mit angeboten">


<h2>💻 Install <a name="usage"></a></h2>
<pre><code>git clone https://github.com/NapoII/netcup_egg_tracker
<pre><code>git clone https://github.com/NSG22/netcup_egg_tracker
pip install -r requirements.txt</code></pre>

<h2>💭 How it works <a name="Use"></a></h2>
Expand All @@ -109,17 +96,10 @@ <h2>💭 How it works <a name="Use"></a></h2>
<li>Stellen Sie sicher, dass das Skript über die erforderlichen Berechtigungen zum Schreiben von Dateien im aktuellen Verzeichnis verfügt.</li>
</ul>

<h2>☕ Buy me a coffee <a name="coffee"></a></h2>
<p>Feel free to show your appreciation by treating me to a virtual coffee. Your support means a lot and keeps the creative coding vibes going! 🚀</p>
<a href='https://ko-fi.com/M4M0TS4ZM' target='_blank'><img height='36' style='border:0px;height:36px;' src='https://storage.ko-fi.com/cdn/kofi1.png?v=3' border='0' alt='Buy Me a Coffee at ko-fi.com' /></a>

<h2>📚 LICENSE <a name="LICENSE"></a></h2>
<p><a href="LICENSE">GNU GENERAL PUBLIC LICENSE Version 3</a></p>
<p><i>netcup_egg_tracker</i> was created on 31.March.2024 by <a href="https://github.com/NapoII">NapoII</a></p>

<p align="center">
<img src="https://raw.githubusercontent.com/NapoII/NapoII/233630a814f7979f575c7f764dbf1f4804b05332/Bottom.svg" alt="Github Stats" />
</p>
</div>
</body>

Expand Down
36 changes: 8 additions & 28 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,27 +1,19 @@
[![github/NapoII/netcup_egg_tracker](https://raw.githubusercontent.com/NapoII/netcup_egg_tracker/main/README_img/Readme_top.png)](https://github.com/NapoII/netcup_egg_tracker)
[![downloads/total](https://img.shields.io/github/downloads/NapoII/netcup_egg_tracker/total)](https://github.com/NapoII/netcup_egg_tracker/archive/refs/heads/main.zip) [![github/repo-size](https://img.shields.io/github/repo-size/NapoII/netcup_egg_tracker)](https://github.com/NapoII/netcup_egg_tracker/archive/refs/heads/main.zip) [![github/license](https://img.shields.io/github/license/NapoII/netcup_egg_tracker)](https://github.com/NapoII/netcup_egg_tracker/blob/main/LICENSE) [![github/last-commit](https://img.shields.io/github/downloads/NapoII/netcup_egg_tracker/total)](https://img.shields.io/github/issues/NapoII/netcup_egg_tracker?style=plastic) [![github/issues_open](https://img.shields.io/github/issues/NapoII/netcup_egg_tracker?style=plastic)](https://img.shields.io/github/issues-raw/NapoII/netcup_egg_tracker) [![github/stars](https://img.shields.io/github/stars/NapoII/netcup_egg_tracker?style=social)](https://github.com/NapoII/netcup_egg_tracker/stargazers) [![discord](https://img.shields.io/discord/190307701169979393)](https://discord.gg/knTKtKVfnr)

🐰🥚 Willkommen zur großen Oster-Eiersuche auf der Sonderangebotsseite von www.netcup.de! Dieses spezielle Python-Skript durchstöbert die Seite nach versteckten Osterangeboten und speichert sie in Textdateien. 🐣🌼 Automatische Aktualisierung alle 2 Minuten, damit Sie keine versteckten Schätze verpassen! 🔄🔎

Besuchen Sie [napo-ii.de](http://napo-ii.de/) für den Live-Tracker mit den aktuellen Eggs vom Netcup-Event.


## 📝 Table of Contents
+ [Demo / Working](#demo)
+ [Install](#usage)
+ [How it works](#Use)
+ [Buy me a coffee](#coffee)
+ [LICENSE](#LICENSE)
+ [Install](#install)
+ [How it works](#useage)
+ [LICENSE](#license)
## 🎥 Demo / Working <a name = "demo"></a>
![BSP](https://i.imgur.com/Js1UvF1.png)
![BSP](https://raw.githubusercontent.com/NSG22/netcup_egg_tracker/main/README_img/demo.png)


## 💻 Install <a name = "usage"></a>
## 💻 Install <a name = "install"></a>
```cmd
git clone https://github.com/NapoII/netcup_egg_tracker
git clone https://github.com/NSG22/netcup_egg_tracker.git
pip install -r requirements.txt
```
## 💭 How it works <a name = "Use"></a>
## 💭 How it works <a name = "useage"></a>

start netcup_egg_tracker.py directly from the folder or run in cmd:
```cmd
Expand All @@ -37,20 +29,8 @@ python netcup_egg_tracker.py
- Die Dateinamen enthalten den Preis und die Produktinformationen, um die Angebote leicht identifizieren zu können.
- Stellen Sie sicher, dass das Skript über die erforderlichen Berechtigungen zum Schreiben von Dateien im aktuellen Verzeichnis verfügt.

## ☕ Buy me a coffee <a name = "coffee"></a>

Feel free to show your appreciation by treating me to a virtual coffee. Your support means a lot and keeps the creative coding vibes going! 🚀

<a href='https://ko-fi.com/M4M0TS4ZM' target='_blank'><img height='36' style='border:0px;height:36px;' src='https://storage.ko-fi.com/cdn/kofi1.png?v=3' border='0' alt='Buy Me a Coffee at ko-fi.com' /></a>

## 📚 LICENSE <a name = "LICENSE"></a>
## 📚 LICENSE <a name = "license"></a>

[GNU GENERAL PUBLIC LICENSE Version 3](LICENSE)

[netcup_egg_tracker](netcup_egg_tracker) was created on 31.March.2024 by [NapoII](https://github.com/NapoII)



<p align="center">
<img src="https://raw.githubusercontent.com/NapoII/NapoII/233630a814f7979f575c7f764dbf1f4804b05332/Bottom.svg" alt="Github Stats" />
</p>
Binary file added README_img/demo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
51 changes: 41 additions & 10 deletions netcup_egg_tracker/netcup_egg_tracker.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,37 +12,68 @@
"/",
"/hosting",
"/bestellen/domainangebote.php",
"/bestellen/softwareangebote.php",
"/ssl-zertifikate/",
"/ueber-netcup/",
"/ueber-netcup/hardware-infrastruktur.php",
"/ueber-netcup/ddos-schutz-filter.php",
"/ueber-netcup/auszeichnungen.php"
"/ueber-netcup/auszeichnungen.php",
"/ueber-netcup/zertifizierungen.php",
"/ueber-netcup/partner.php",
"/groupware/",
"/professional/",
"/professional/dedizierte-server/",
"/professional/managed-server/",
"/professional/colocation/",
"/professional/softwareentwicklung/",

]

def get_price_formatted(price):
return price.replace(",", ".").replace("&euro;", "EUR").replace(" ", "")

def main():
current_year = datetime.now().year # Aktuelles Jahr abrufen
folder_path = f"eggs_{current_year}" # Ordnername mit aktuellem Jahr erstellen
if not os.path.exists(folder_path):
os.makedirs(folder_path)

while True:
current_year = datetime.now().year # Aktuelles Jahr abrufen
folder_path = f"eggs_{current_year}" # Ordnername mit aktuellem Jahr erstellen

for r in refs:
try:
resp = requests.post("https://www.netcup.de/api/eggs", data={"requrl": r})
egg = json.loads(resp.text)["eggs"][0]
response_text = json.loads(resp.text)["eggs"]
#egg kann eine Liste oder ein False sein
if response_text is None or not response_text:
print(f"{'-' * 10}")
print(f"Kein Angebot gefunden für {r}")
print(f"{'-' * 10}")
continue

egg = response_text[0]
if egg['title'][-1] == " ":
egg['title'] = egg['title'][:-1]

price = get_price_formatted(egg["price"])
name = f"{price}Euro_{egg['id']}__{egg['title']}.json"
name = name.replace("/", "_").replace("|", "_").replace("\\", "_").replace(":", "_").replace("*", "_").replace("?", "_").replace('"', "_").replace("<", "_").replace(">", "_")
file_name = f"{price}_{egg['id']}.json"
file_name = file_name.replace("/", "_").replace("|", "_").replace("\\", "_").replace(":", "_").replace("*", "_").replace("?", "_").replace('"', "_").replace("<", "_").replace(">", "_")
sub_folder = f"{egg['title']}".replace("/", "_").replace("|", "_").replace("\\", "_").replace(":", "_").replace("*", "_").replace("?", "_").replace('"', "_").replace("<", "_").replace(">", "_").replace(" ","_") # Unterordner für angebotstyp erstellen

if not os.path.exists(folder_path):
os.makedirs(folder_path)
full_folder_path = os.path.join(folder_path, sub_folder)
if not os.path.exists(full_folder_path):
os.makedirs(full_folder_path)

path = os.path.join(full_folder_path, file_name)

egg['original_url'] = f"https://www.netcup.de/bestellen/produkt.php?produkt={egg['product_id']}&ref=230003&hiddenkey={egg['product_key']}"
egg['found_url'] = f"https://www.netcup.de{r}" # Hinzufügen der gefundenen URL
egg['found_unix_time'] = int(time.time()) # Hinzufügen der Unix-Zeit
with open(os.path.join(folder_path, name), "w") as file:
with open(path, "w") as file:
json.dump(egg, file, indent=4)

if os.path.exists(path):# nicht neu printen, falls schon vorhanden
continue

print(f"{'-' * 10}")
print(f"{egg['title']}")
Expand All @@ -52,7 +83,7 @@ def main():
print(f"Found Unix Time: {egg['found_unix_time']}") # Ausgabe der gefundenen Unix-Zeit
print(f"{'-' * 10}")
except Exception as e:
pass
print(e)

print(f"\n\n Time Sleep - {2*60}")
time.sleep(2 * 60)
Expand Down

0 comments on commit 88528be

Please sign in to comment.