@@ 645-667 (lines=23) @@ | ||
642 | ||
643 | class PenelopeBagieu(GenericNavigableComic): |
|
644 | """Class to retrieve comics from Penelope Bagieu's blog.""" |
|
645 | name = 'bagieu' |
|
646 | long_name = 'Ma vie est tout a fait fascinante (Bagieu)' |
|
647 | url = 'http://www.penelope-jolicoeur.com' |
|
648 | _categories = ('FRANCAIS', ) |
|
649 | get_navi_link = get_link_rel_next |
|
650 | get_first_comic_link = simulate_first_link |
|
651 | first_url = 'http://www.penelope-jolicoeur.com/2007/02/ma-vie-mon-oeuv.html' |
|
652 | ||
653 | @classmethod |
|
654 | def get_comic_info(cls, soup, link): |
|
655 | """Get information about a particular comics.""" |
|
656 | date_str = soup.find('h2', class_='date-header').string |
|
657 | day = string_to_date(date_str, "%A %d %B %Y", "fr_FR.utf8") |
|
658 | imgs = soup.find('div', class_='entry-body').find_all('img') |
|
659 | title = soup.find('h3', class_='entry-header').string |
|
660 | return { |
|
661 | 'title': title, |
|
662 | 'img': [i['src'] for i in imgs], |
|
663 | 'month': day.month, |
|
664 | 'year': day.year, |
|
665 | 'day': day.day, |
|
666 | } |
|
667 | ||
668 | ||
669 | class OneOneOneOneComic(GenericNavigableComic): |
|
670 | """Class to retrieve 1111 Comics.""" |
|
@@ 1650-1670 (lines=21) @@ | ||
1647 | return reversed(get_soup_at_url(archive_url).find_all('a', rel='bookmark')) |
|
1648 | ||
1649 | @classmethod |
|
1650 | def get_comic_info(cls, soup, link): |
|
1651 | """Get information about a particular comics.""" |
|
1652 | date_str = soup.find('div', class_='postdate').find('em').string |
|
1653 | day = string_to_date(remove_st_nd_rd_th_from_date(date_str), "%B %d, %Y") |
|
1654 | div = soup.find('div', id='comic') |
|
1655 | if div: |
|
1656 | img = div.find('img') |
|
1657 | img_src = [img['src']] |
|
1658 | alt = img['alt'] |
|
1659 | assert alt == img['title'] |
|
1660 | title = soup.find('meta', property='og:title')['content'] |
|
1661 | else: |
|
1662 | img_src = [] |
|
1663 | alt = '' |
|
1664 | title = '' |
|
1665 | return { |
|
1666 | 'month': day.month, |
|
1667 | 'year': day.year, |
|
1668 | 'day': day.day, |
|
1669 | 'img': img_src, |
|
1670 | 'title': title, |
|
1671 | 'alt': alt, |
|
1672 | 'tags': ' '.join(t.string for t in soup.find('div', class_='postmeta').find_all('a', rel='tag')), |
|
1673 | } |