Skip to content

Instantly share code, notes, and snippets.

@Gilinho
Forked from dfuenzalida/detective_conan.py
Created January 24, 2018 12:36
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 Gilinho/a164b9e8480202fdfe878a0904a5a8be to your computer and use it in GitHub Desktop.
Save Gilinho/a164b9e8480202fdfe878a0904a5a8be to your computer and use it in GitHub Desktop.
Detective Conan en DailyMotion
#!/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