]> gitweb.pimeys.fr Git - scripts-20-100.git/blobdiff - download_picasa_album.py
typo
[scripts-20-100.git] / download_picasa_album.py
index b86cf069565f3dd24da5e107c5699415a41ad509..3f83be93cda2281e0284945d4b53a27559e08718 100755 (executable)
@@ -26,14 +26,11 @@ def album_to_links(album):
     medias = album.xpath("//media:group", namespaces=album.nsmap)
     processed = []
     for media in medias:
-        contenturls = media.xpath("./media:content", namespaces=media.nsmap)
-        # Pour les photos il n'y a qu'un seul media:content
-        # Mais pour la vidéo, il y a un thumbnail avant
-        if len(contenturls) > 1:
-            contenturl = contenturls[1]
-        else:
-            contenturl = contenturls[0]
+        contenturls = media.xpath("./media:thumbnail", namespaces=media.nsmap)
+        contenturl = contenturls[-1]
         contenturl = [val for (kw, val) in contenturl.items() if kw == "url"][0]
+        # On récupère la meilleure résolution de l'image
+        contenturl = contenturl.replace("s288", "s5000")
         title = media.xpath("./media:title", namespaces=media.nsmap)[0]
         title = title.text
         processed.append([title, contenturl])