In [3]:
import requests
import re
In [2]:
url = 'http://curca.buffalo.edu/students/posters2016.php'
s = requests.get(url)
s.text[:100]
Out[2]:
'<!DOCTYPE html>\r\n<html lang="en">\r\n\t<head>\r\n\t\t<title>Celebration of Student Academic Excellence | Ce'
In [9]:
# <a href="pdfs/2016_posters/Lowe.pdf">509 Michigan Avenue Redevelopment</a>
myre = '<a href="(pdfs/2016_posters/.+\.pdf)'  # NOTE: Why not greedy????
matches = re.findall(myre,s.text)
prefix = 'http://curca.buffalo.edu/students/'
#for match in matches:
#    print( prefix+match )
pdfs = [prefix+match for match in matches ]
pdfs[:5]
Out[9]:
['http://curca.buffalo.edu/students/pdfs/2016_posters/Cercone.pdf',
 'http://curca.buffalo.edu/students/pdfs/2016_posters/Lowe.pdf',
 'http://curca.buffalo.edu/students/pdfs/2016_posters/Burns.pdf',
 'http://curca.buffalo.edu/students/pdfs/2016_posters/Cohen.pdf',
 'http://curca.buffalo.edu/students/pdfs/2016_posters/Vazquez.pdf']
In [15]:
# download these pdfs
import os
for pdf in pdfs:
    cmd = 'wget ' + pdf  # or 'curl ' + pdf + ' > ' + pdf.split('/')[-1]
    #cmd = 'curl ' + pdf + ' > ' + pdf.split('/')[-1]
    print( cmd )
    os.system( cmd )
wget http://curca.buffalo.edu/students/pdfs/2016_posters/Cercone.pdf
wget http://curca.buffalo.edu/students/pdfs/2016_posters/Lowe.pdf
wget http://curca.buffalo.edu/students/pdfs/2016_posters/Burns.pdf
wget http://curca.buffalo.edu/students/pdfs/2016_posters/Cohen.pdf
wget http://curca.buffalo.edu/students/pdfs/2016_posters/Vazquez.pdf
wget http://curca.buffalo.edu/students/pdfs/2016_posters/Kish.pdf
wget http://curca.buffalo.edu/students/pdfs/2016_posters/Nguyen.pdf
wget http://curca.buffalo.edu/students/pdfs/2016_posters/Beak.pdf
wget http://curca.buffalo.edu/students/pdfs/2016_posters/10-June.pdf
wget http://curca.buffalo.edu/students/pdfs/2016_posters/Rowsam.pdf
wget http://curca.buffalo.edu/students/pdfs/2016_posters/Joseph.pdf
wget http://curca.buffalo.edu/students/pdfs/2016_posters/Bracci.pdf
wget http://curca.buffalo.edu/students/pdfs/2016_posters/Gibson.pdf
wget http://curca.buffalo.edu/students/pdfs/2016_posters/Oniyide.pdf
wget http://curca.buffalo.edu/students/pdfs/2016_posters/Thant.pdf
wget http://curca.buffalo.edu/students/pdfs/2016_posters/June.pdf
wget http://curca.buffalo.edu/students/pdfs/2016_posters/OKeefe.pdf
wget http://curca.buffalo.edu/students/pdfs/2016_posters/Kwame.pdf
wget http://curca.buffalo.edu/students/pdfs/2016_posters/Hayley.pdf
wget http://curca.buffalo.edu/students/pdfs/2016_posters/Mott.pdf
wget http://curca.buffalo.edu/students/pdfs/2016_posters/Majumdar.pdf
wget http://curca.buffalo.edu/students/pdfs/2016_posters/24-Chen.pdf
wget http://curca.buffalo.edu/students/pdfs/2016_posters/Hunter.pdf
wget http://curca.buffalo.edu/students/pdfs/2016_posters/Iozzo.pdf
wget http://curca.buffalo.edu/students/pdfs/2016_posters/Capeling.pdf
wget http://curca.buffalo.edu/students/pdfs/2016_posters/Gelda.pdf
wget http://curca.buffalo.edu/students/pdfs/2016_posters/Johnson.pdf
wget http://curca.buffalo.edu/students/pdfs/2016_posters/Dormann.pdf
wget http://curca.buffalo.edu/students/pdfs/2016_posters/Dijgal.pdf
wget http://curca.buffalo.edu/students/pdfs/2016_posters/Prieto-32.pdf
wget http://curca.buffalo.edu/students/pdfs/2016_posters/Prieto.pdf
wget http://curca.buffalo.edu/students/pdfs/2016_posters/Hunter-33.pdf
wget http://curca.buffalo.edu/students/pdfs/2016_posters/Fancher.pdf
wget http://curca.buffalo.edu/students/pdfs/2016_posters/LeBaron.pdf
wget http://curca.buffalo.edu/students/pdfs/2016_posters/Dreitlein.pdf
wget http://curca.buffalo.edu/students/pdfs/2016_posters/KunWooCho.pdf
wget http://curca.buffalo.edu/students/pdfs/2016_posters/DeBortoli.pdf
wget http://curca.buffalo.edu/students/pdfs/2016_posters/Petrella.pdf
wget http://curca.buffalo.edu/students/pdfs/2016_posters/Rangarajan.pdf
wget http://curca.buffalo.edu/students/pdfs/2016_posters/Tjahajdi-Lopez.pdf
wget http://curca.buffalo.edu/students/pdfs/2016_posters/Zakrajsek.pdf
wget http://curca.buffalo.edu/students/pdfs/2016_posters/Allwes.pdf
wget http://curca.buffalo.edu/students/pdfs/2016_posters/OBrien.pdf
wget http://curca.buffalo.edu/students/pdfs/2016_posters/Proefrock.pdf
wget http://curca.buffalo.edu/students/pdfs/2016_posters/Belous.pdf
wget http://curca.buffalo.edu/students/pdfs/2016_posters/Talal.pdf
wget http://curca.buffalo.edu/students/pdfs/2016_posters/Furst.pdf
wget http://curca.buffalo.edu/students/pdfs/2016_posters/Mautner.pdf
wget http://curca.buffalo.edu/students/pdfs/2016_posters/Ricotta.pdf
wget http://curca.buffalo.edu/students/pdfs/2016_posters/Whiteside.pdf
wget http://curca.buffalo.edu/students/pdfs/2016_posters/Clements.pdf
wget http://curca.buffalo.edu/students/pdfs/2016_posters/Goliber.pdf
wget http://curca.buffalo.edu/students/pdfs/2016_posters/Grosso.pdf
wget http://curca.buffalo.edu/students/pdfs/2016_posters/Corcoran.pdf
wget http://curca.buffalo.edu/students/pdfs/2016_posters/Sbarra.pdf
wget http://curca.buffalo.edu/students/pdfs/2016_posters/Habibollahzadeh.pdf
wget http://curca.buffalo.edu/students/pdfs/2016_posters/Boerschig.pdf
wget http://curca.buffalo.edu/students/pdfs/2016_posters/Syeda.pdf
wget http://curca.buffalo.edu/students/pdfs/2016_posters/Elias.pdf
wget http://curca.buffalo.edu/students/pdfs/2016_posters/Walker.pdf
wget http://curca.buffalo.edu/students/pdfs/2016_posters/Asbach.pdf
wget http://curca.buffalo.edu/students/pdfs/2016_posters/Carleton.pdf
wget http://curca.buffalo.edu/students/pdfs/2016_posters/Janish.pdf
wget http://curca.buffalo.edu/students/pdfs/2016_posters/Yoshinaga.pdf
wget http://curca.buffalo.edu/students/pdfs/2016_posters/Siebert.pdf
wget http://curca.buffalo.edu/students/pdfs/2016_posters/nmda_permeation.pdf
wget http://curca.buffalo.edu/students/pdfs/2016_posters/Chatpar.pdf
wget http://curca.buffalo.edu/students/pdfs/2016_posters/Barlow.pdf
wget http://curca.buffalo.edu/students/pdfs/2016_posters/Diih.pdf
wget http://curca.buffalo.edu/students/pdfs/2016_posters/Waller.pdf
wget http://curca.buffalo.edu/students/pdfs/2016_posters/Greene.pdf
wget http://curca.buffalo.edu/students/pdfs/2016_posters/Slominski.pdf
wget http://curca.buffalo.edu/students/pdfs/2016_posters/Haghdel.pdf
wget http://curca.buffalo.edu/students/pdfs/2016_posters/Donato.pdf
wget http://curca.buffalo.edu/students/pdfs/2016_posters/Spitzongle.pdf
wget http://curca.buffalo.edu/students/pdfs/2016_posters/Milliron.pdf
wget http://curca.buffalo.edu/students/pdfs/2016_posters/Rhodie.pdf
wget http://curca.buffalo.edu/students/pdfs/2016_posters/Lee.pdf
wget http://curca.buffalo.edu/students/pdfs/2016_posters/Nip.pdf
wget http://curca.buffalo.edu/students/pdfs/2016_posters/Batra.pdf
wget http://curca.buffalo.edu/students/pdfs/2016_posters/Chen.pdf
wget http://curca.buffalo.edu/students/pdfs/2016_posters/Lyle.pdf
wget http://curca.buffalo.edu/students/pdfs/2016_posters/Yuichi.pdf
wget http://curca.buffalo.edu/students/pdfs/2016_posters/Gosy.pdf
wget http://curca.buffalo.edu/students/pdfs/2016_posters/Aponte.pdf
wget http://curca.buffalo.edu/students/pdfs/2016_posters/Tom.pdf
wget http://curca.buffalo.edu/students/pdfs/2016_posters/King.pdf
wget http://curca.buffalo.edu/students/pdfs/2016_posters/Ryan.pdf
wget http://curca.buffalo.edu/students/pdfs/2016_posters/Gorski.pdf
wget http://curca.buffalo.edu/students/pdfs/2016_posters/Nurse.pdf
wget http://curca.buffalo.edu/students/pdfs/2016_posters/90-Hunter.pdf
wget http://curca.buffalo.edu/students/pdfs/2016_posters/Perrotta.pdf
wget http://curca.buffalo.edu/students/pdfs/2016_posters/Singh-92.pdf
wget http://curca.buffalo.edu/students/pdfs/2016_posters/Patti.pdf
wget http://curca.buffalo.edu/students/pdfs/2016_posters/Eliza.pdf
wget http://curca.buffalo.edu/students/pdfs/2016_posters/Singh-95.pdf
wget http://curca.buffalo.edu/students/pdfs/2016_posters/Zhang-116.pdf
wget http://curca.buffalo.edu/students/pdfs/2016_posters/Zhang-117.pdf
wget http://curca.buffalo.edu/students/pdfs/2016_posters/Cook.pdf
wget http://curca.buffalo.edu/students/pdfs/2016_posters/Ramirez.pdf
wget http://curca.buffalo.edu/students/pdfs/2016_posters/Westphal.pdf
wget http://curca.buffalo.edu/students/pdfs/2016_posters/Ball.pdf
wget http://curca.buffalo.edu/students/pdfs/2016_posters/Elminowski.pdf
wget http://curca.buffalo.edu/students/pdfs/2016_posters/Cropo.pdf
wget http://curca.buffalo.edu/students/pdfs/2016_posters/Tanner.pdf
wget http://curca.buffalo.edu/students/pdfs/2016_posters/Lainez.pdf
wget http://curca.buffalo.edu/students/pdfs/2016_posters/Smith.pdf
wget http://curca.buffalo.edu/students/pdfs/2016_posters/Daniels.pdf
wget http://curca.buffalo.edu/students/pdfs/2016_posters/Catanzaro.pdf
wget http://curca.buffalo.edu/students/pdfs/2016_posters/Rub.pdf
wget http://curca.buffalo.edu/students/pdfs/2016_posters/Wojick.pdf
wget http://curca.buffalo.edu/students/pdfs/2016_posters/Wang.pdf
wget http://curca.buffalo.edu/students/pdfs/2016_posters/Hamilton.pdf
wget http://curca.buffalo.edu/students/pdfs/2016_posters/Bello.pdf
wget http://curca.buffalo.edu/students/pdfs/2016_posters/Habla.pdf
wget http://curca.buffalo.edu/students/pdfs/2016_posters/Neild.pdf
wget http://curca.buffalo.edu/students/pdfs/2016_posters/Aalbue.pdf
wget http://curca.buffalo.edu/students/pdfs/2016_posters/Graham.pdf
wget http://curca.buffalo.edu/students/pdfs/2016_posters/Houck.pdf
In [11]:
pwd
Out[11]:
'/home/ringland/public_html/448'
In [13]:
cd demo
/home/ringland/public_html/448/demo
In [ ]: