                     for sub_url in sub_urls
                       p.push get_dellbrueck_urls_for_page sub_url
                     Promise.all p
-                      .then (tier_urls) ->
-                        console.log(tier_urls.length)
-                        for tier_url in tier_urls
-                          console.log(tier_url)
-                          for animal in tier_url
-                            console.log(animal)
-                            urls.push animal
+                      .then (page_urls) ->
+                        for page_url in page_urls
+                          for animal_url in page_url
+                            urls.push animal_url
                   .then () ->
                     f urls
 

app = express()
cache = new NodeCache()

zollstock_urls = ["http://www.tierheim-koeln-zollstock.de/tiervermittlung/katzen.html",
              "http://www.tierheim-koeln-zollstock.de/tiervermittlung/hunde.html",
              "http://www.tierheim-koeln-zollstock.de/tiervermittlung/nagetiere.html"];
zollstock_base_url = "http://www.tierheim-koeln-zollstock.de"

# Mittelgrosse Hunde, Katzen und Kaninchen gehen aktuell nicht :(
dellbrueck_urls = ["http://presenter.comedius.de/design/bmt_koeln_standard_10001.php?f_mandant=bmt_koeln_d620d9faeeb43f717c893b5c818f1287&f_bereich=Vermittlung+kleine+Hunde+&f_funktion=Uebersicht",
              "http://presenter.comedius.de/design/bmt_koeln_standard_10001.php?f_mandant=bmt_koeln_d620d9faeeb43f717c893b5c818f1287&f_bereich=Vermittlung+gro%DFe+Hunde+&f_funktion=Uebersicht",             
              "http://presenter.comedius.de/design/bmt_koeln_standard_10001.php?f_mandant=bmt_koeln_d620d9faeeb43f717c893b5c818f1287&f_bereich=Vermittlung%2BMeerschweinchen&f_funktion=Uebersicht",
              "http://presenter.comedius.de/design/bmt_koeln_standard_10001.php?f_mandant=bmt_koeln2_d620d9faeeb43f717c893b5c818f1287&f_bereich=Degus%2Bund%2BChinchillas&f_funktion=Uebersicht"];
dellbrueck_base_url = "http://presenter.comedius.de/design/bmt_koeln_standard_10001.php"
dellbrueck_pic_url = "http://presenter.comedius.de/pic/bmt_koeln_d620d9faeeb43f717c893b5c818f1287"


                        r err

get_data = ->
    new Promise (f ,r) ->        
          p = []
          iconvlite.extendNodeEncodings()
          for url in zollstock_urls
              p.push get_zollstockdata url
          for url in dellbrueck_urls
              p.push get_dellbrueckdata url
          Promise.all p
              .then (list_of_values) ->
                  values = _.union.apply null, list_of_values
                  cache.set('tiere', values, 60*60*24)
                  f values
              .catch (err) ->
                  r err

# get a pet that was not posted yet
get_notPostedPet = ->
    new Promise (f, r) ->
        filename = 'posted_pets.json'
        try
            if fs.existsSync(filename)
                postedPets = JSON.parse fs.readFileSync filename, 'utf8'
            else
                fs.writeFileSync filename, JSON.stringify []
                postedPets = []
                console.log('file does not exist')
        catch err
            r err
        get_data().then (pets) ->
