small fixes + non infinte loading on error

This commit is contained in:
Askill 2020-04-22 20:23:18 +02:00
parent 4cad0e2e90
commit cb9b8183e6
5 changed files with 27 additions and 16 deletions

View File

@ -1,6 +1,8 @@
FROM python
COPY ./ /app
COPY ./requirements.txt /app/requirements.txt
RUN pip install -r /app/requirements.txt
COPY ./ /app
CMD python /app/run.py

Binary file not shown.

View File

@ -17,7 +17,11 @@ function loadData() {
renderRecipeList(data)
},
loadData()
function (error, data) {
console.log(error)
rl.innerHTML = "<p>Es gab einen Fehler, bitte suchen Sie erneut.</p>"
}
);
}

View File

@ -42,7 +42,7 @@ def getImages():
if defaultImg == recipe.img:
url = recipe.url
string1 = '//*[@id="recipe-image-carousel"]/div/div[1]/div[10]/div/a/amp-img'
//*[@id="recipe-image-carousel"]/div/div[1]/div/div/a/amp-img
driver.get(url)
element = WebDriverWait(driver, 30).until(
ec.presence_of_element_located((
@ -63,11 +63,11 @@ def getImages():
counter +=1
print(counter/maxC)
sleep(5)
except:
except Exception as e:
errorUrls.append(recipe.url)
print(recipe.url)
print("error")
print(e)
print(errorUrls)
getImages()

View File

@ -6,16 +6,21 @@ from nltk.corpus import stopwords
from application.db import Session, Recipe, Ingredient, Trunk
def stemWord(word):
arr = []
stopset = set(stopwords.words('german'))
stopset |= set("(),")
snowball = nltk.SnowballStemmer(language='german')
for token in nltk.word_tokenize(word):
if token in stopset or len(token) < 4:
continue
stemmed = snowball.stem(token)
arr.append(stemmed)
return arr
try:
arr = []
stopset = set(stopwords.words('german'))
stopset |= set("(),")
snowball = nltk.SnowballStemmer(language='german')
for token in nltk.word_tokenize(word):
if token in stopset or len(token) < 4:
continue
stemmed = snowball.stem(token)
arr.append(stemmed)
if len(arr) == 0:
arr.append("")
return arr
except:
return [""]
def migrate(path):
recs = ""