OCR/Script

From Open Food Facts wiki


# Get all the products that are ingredients complete AND have selected images
# Loop through products
wget -O - -q -t 1 https://fr.openfoodfacts.org/api/v0/produit/20396145.json | jq '.product.states_hierarchy'
string='My long string';
if [[ $string == *"en:photos-validated"* ]] and if [[ $string == *"en:ingredients-completed"* ]] then
  echo "It's there!";fi

if "en:photos-validated" and "en:ingredients-completed" in output:
wget -O - -q -t 1 https://fr.openfoodfacts.org/api/v0/produit/20396145.json | jq '.product.ingredients_text'
wget -O - -q -t 1 https://fr.openfoodfacts.org/api/v0/produit/20396145.json | jq '.product.image_url' 
wget -O - -q -t 1 https://fr.openfoodfacts.org/api/v0/produit/20396145.json | jq '.product.image_url' | tesseract  outputocrfull.txt -l fra -psm 3
tesseract ingredients.19.full.jpg outputocrfull.txt -l fra -psm 3
diff file1.txt file2.txt