asci

def base = 'http://www.the-asci.org/core/asci'
(1969..2011).each{
    def m = "${base}/list.php?type=year&key=$it".toURL().text =~ /<a href=profile\.php\?pid=(\d*)>/
    m.each{
        def text = "${base}/profile.php?pid=${it[1]}".toURL().text, data = [:]
        def n = text =~ /<div class=member_name>(.*?)<\/div>/
        data.name = n[0][1]
        n = text =~ /<div class=member_address>(.*?)<\/div>/
        def address = []
        n.each{address << it[1].replaceAll(/<\/?.*?>/,'')}
        data.contactInfo = address.join('\n')
        def l = text =~ /<div width='100%'><div class=rh>Specialties<\/div>(.*?)<\/div>(<div width='100%'>|\s{3})/, specialties = []
        if(l)
        (l[0][1] =~ /<div class=r\d>(\w*)<\/div>/).each{specialties << it[1]}
        data.specialties = specialties.join(', ')
        new Physician(data).save()
    }
}
 

猜你喜欢

转载自sam-ds-chen.iteye.com/blog/1271250
sci