added all files to project

This commit is contained in:
2022-03-10 10:36:59 +01:00
parent 09dd957b33
commit 46a936d7de
25351 changed files with 3883356 additions and 0 deletions
+12
View File
@@ -0,0 +1,12 @@
<html>
<div style="background:black; color:white">
Speiseplan <br/><h4>Mittwoch 23.02.2022</h4>Essen 1<br/>Pfefferrahmgeschnetzeltes vom Schwein mit Spätzle <br/>2,52 € (Stud.)   3,57 €  (Bed.)   5,04 €  (Gäste)<br/><br/> <br/>Essen 2<br/>Currywurst mit Soße <br/>2,40 € (Stud.)   3,40 €  (Bed.)   4,40 €  (Gäste)<br/><br/> <br/>Essen 3<br/>Sesamkartoffeln auf Kokosspinat <br/>2,79 € (Stud.)   3,79 €  (Bed.)   5,58 €  (Gäste)<br/><br/> <br/>
</div>
</html>
+42
View File
@@ -0,0 +1,42 @@
#!/usr/bin/env python3
import re
from string import Template
import urllib
try:
from BeautifulSoup import BeautifulSoup
except ImportError:
from bs4 import BeautifulSoup
def excludeAllergens(html_soup):
exclude_allergens = html_soup.find_all("sup")
for element in exclude_allergens:
element.extract()
def excludeForm(html_soup):
excludeForm = html_soup.find('form')
excludeForm.extract()
def excludeImages(html_soup):
exclude_img = html_soup.find_all("img")
for element in exclude_img:
element.extract()
if __name__ == '__main__':
url = 'https://www.werkswelt.de/?id=mohm'
page = urllib.request.urlopen(url).read().decode()
correctedPage = re.sub('/br', 'br', page)
html_soup = BeautifulSoup(correctedPage, features='html.parser')
parsed_html = html_soup.findAll('body')
#parsed_html = html_soup.body.html.body
excludeForm(parsed_html[1])
excludeAllergens(parsed_html[1])
excludeImages(parsed_html[1])
template = Template('<html>\n<div style="background:black; color:white">\n$parsed_html\n</div>\n</html>')
# write html-file
with open("speiseplan.html", "w") as file:
file.write(template.substitute(parsed_html=parsed_html[1].div.decode_contents()))