X-Git-Url: http://gitweb.pimeys.fr/?p=scripts-20-100.git;a=blobdiff_plain;f=download_picasa_album.py;h=3f83be93cda2281e0284945d4b53a27559e08718;hp=b86cf069565f3dd24da5e107c5699415a41ad509;hb=7e4a560133f4679b54210d674b306f58373d99d9;hpb=19e5243bf137b8b691c109c5811cbeba7769e11e diff --git a/download_picasa_album.py b/download_picasa_album.py index b86cf06..3f83be9 100755 --- a/download_picasa_album.py +++ b/download_picasa_album.py @@ -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])