コード例 #1
0
 def get(self, url):
     try:
         logger.info("Scraping %(url)s" % locals())
         ret = requests.get(url)
         soup = BeautifulSoup(ret.content)
         return soup
     except Exception as e:
         logger.error("Cannot scrap %(url)s, %(e)s" % locals())
コード例 #2
0
 def parse(self, url, songs):
     soup = self.get(url)
     if not soup:
         return
     for t in soup.select('div#cest-quoi-ce-titre-results li'):
         try:
             key = t.select(".date")[0].string
             songs[key] = Song(artist=t.select(".artist")[0].string.title(),
                               title=t.select(".title")[0].string.title())
         except Exception as e:
             logger.error("Cannot parse %(t)s, %(e)s" % locals())
コード例 #3
0
 def parse(self, url, songs):
     soup = self.get(url)
     if not soup:
         return
     for t in soup.select('div.resultat'):
         try:
             songs[(t['class'][0]).split('_')[1]] = Song(
                 artist=(t.h2.string if t.h2.string else t.h2.a.string).strip(),
                 title=(t.h3.string if t.h3.string else t.h3.a.string).strip()
             )
         except Exception as e:
             logger.error("Cannot parse %(t)s, %(e)s" % locals())
コード例 #4
0
ファイル: OuiScraper.py プロジェクト: gtnx/nova-playlist
 def parse(self, url, songs):
     soup = self.get(url)
     if not soup:
         return
     for t in soup.select('div#cest-quoi-ce-titre-results li'):
         try:
             key = t.select(".date")[0].string
             songs[key] = Song(
                 artist=t.select(".artist")[0].string.title(),
                 title=t.select(".title")[0].string.title()
             )
         except Exception as e:
             logger.error("Cannot parse %(t)s, %(e)s" % locals())