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 FROM python
COPY ./ /app COPY ./requirements.txt /app/requirements.txt
RUN pip install -r /app/requirements.txt RUN pip install -r /app/requirements.txt
COPY ./ /app
CMD python /app/run.py CMD python /app/run.py

Binary file not shown.

View File

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

View File

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