Skip to content

Instantly share code, notes, and snippets.

@juque
Created August 6, 2019 19:12
Show Gist options
  • Select an option

  • Save juque/7c1143fcee6f891bc89646349a71a4e5 to your computer and use it in GitHub Desktop.

Select an option

Save juque/7c1143fcee6f891bc89646349a71a4e5 to your computer and use it in GitHub Desktop.
from bs4 import BeautifulSoup
import os
import urllib.request
file = open("t.tmp")
content = file.read()
soup = BeautifulSoup(content,'html.parser')
print(soup)
a = soup.find_all('a')
for i in a:
name = os.path.basename(i.get('href')).replace("Logo+","").replace("+","_").lower()
url = i.get('href')
print("Descargado {}".format(url))
urllib.request.urlretrieve(url,name)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment