Created
October 8, 2012 01:17
-
-
Save dfuenzalida/3850232 to your computer and use it in GitHub Desktop.
Detective Conan en DailyMotion
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
# -*- coding: utf-8 -*- | |
# Parsea la página de busquedas de DailyMotion para encontrar | |
# episodios de Detective Conan, busca las URL y las imprime, | |
# para usar junto con JDownloader | |
import urllib2 | |
import time | |
from BeautifulSoup import BeautifulSoup | |
def url_episodio(num): | |
url = 'http://www.dailymotion.com/relevance/search/detective+conan+' + str(num) + '/1' | |
page = urllib2.urlopen(url) | |
soup = BeautifulSoup(page) | |
# el primer elemento h3 de la página | |
h3 = soup.findAll('h3')[0] | |
link = h3.a | |
return 'http://www.dailymotion.com' + link['href'] | |
if __name__ == '__main__': | |
for i in range(581, 600): | |
print url_episodio(i) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment