Пример #1
0
 def scrape(self):
     from photo.models import Photo
     img_url = 'https://graph.facebook.com/%s/picture' % self.fbid
     try:
         Photo.create_from_url(img_url, facebook=self)
         self.scraped = True
         self.save()
     except:
         print "some issue with %s" % img_url
Пример #2
0
    def scrape(self):
        from photo.models import Photo
        o = OkCupidAccount.objects.all()[0]
        o.login()
        agent('Mozilla/5.0 (iPhone; U; CPU iPhone OS 3_0 like Mac OS X; en-us) AppleWebKit/528.18 (KHTML, like Gecko) Version/4.0 Mobile/7A341 Safari/528.16')

        url = 'http://www.okcupid.com/profile/%s/photos?cf=regular_indirect' % self.okid
        go(url)
        html = show()
        b = BeautifulSoup(html)
        divs = b.findAll('div', {'class': 'pic clearfix'})
        for div in divs:
            img_tag = div.find('img')
            try:
                Photo.create_from_url(url=img_tag['src'], okcupid=self)
            except:
                print "no img found"

        self.scraped = True
        self.save()