Skip to content

Instantly share code, notes, and snippets.

@fitorec
Created April 4, 2010 18:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fitorec/355585 to your computer and use it in GitHub Desktop.
Save fitorec/355585 to your computer and use it in GitHub Desktop.
Descarga las imágenes de una galería detelevisadeportes.com
#! /usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright 2010 Fitorec Rey sol <chanerec@gmail.com>
# tIdiotizaGallery.py
# ____ _ .--.
# | __ |(_) | | ___ ____ ___ ____ | o_o |
# | | _ | ||_ _|/ _ \ / __// _ \ / __/ | :_/ |
# | __ || | | || (_) || | | __/| (__ // \\
# |_| |_| | | \___/ |_| \___/ \___( (| | )
# http://fitorec.wordpress.com /'\_ _/
# \___)=(___/
# Descarga las imágenes de una galería detelevisadeportes.com en una
# carpeta, lo único que requiere es la URL de la gallería como parámetro,
# Que lo disfruten!!
#
"""
Gallerias Recomendas:
http://www.televisadeportes.com/fotos/keeley-hazell-modelo-britanica/18487
http://www.televisadeportes.com/fotos/tiffany-selby-despampanante-playmate/18488
http://www.televisadeportes.com/fotos/bellezas-torneo-bicentenario-2010/18495
http://www.televisadeportes.com/fotos/la-otra-cara-del-rally-de-leon/18194
http://www.televisadeportes.com/fotos/las-vaqueritas-del-norteno-en-televisa-deportes/18433
http://www.televisadeportes.com/fotos/divas-de-la-wwe/18457
http://www.televisadeportes.com/fotos/bellezas-futbol-sexy-sensualidad-lenceria-mujeres-catherine/16554
http://www.televisadeportes.com/fotos/paola-chinchilla-bellezas-surf-deportes/18065
http://www.televisadeportes.com/fotos/la-espectacularidad-de-la-wwe/18042
http://www.televisadeportes.com/fotos/abierto-de-monterrey-2010/18044
para obtener mas galerías visitar:
http://www.televisadeportes.com/fotogalerias/
"""
import urllib2
import os
import re
import sys
if len(sys.argv) != 2 :
print "use: "+sys.argv[0]+" URL_GalleryTelevisaDeportes.com"
else:
print "URL:"+sys.argv[1]
#opteniendo el codigo html de la pagina para extraer la info.
opener = urllib2.Request(sys.argv[1],None,{})
response = urllib2.urlopen(opener)
response = response.read()
#opteniendo el nombre de la galleria que sera el nombre de la carpeta
response = response[response.find('var gallery_name'):]
response = response[response.find("'")+1:]
path = response[:response.find("'")]
cmd = 'mkdir "'+path+'"'
os.system(cmd)
print cmd
#obtenemos los datos de las imagenes
expr = re.compile('gallery_images\[([0-9]+)\] \=\[([^]]+)')
data = expr.findall(response)
#descargando las imagenes
for d in data:
print d[0]
url = d[1].split(",")[0]
os.system('wget '+url+' -O "'+path+'/'+d[0]+'.jpg"')
print 'wget '+ url
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment