@@ 1748-1777 (lines=30) @@ | ||
1745 | } |
|
1746 | ||
1747 | ||
1748 | class RespawnComic(GenericNavigableComic): |
|
1749 | """Class to retrieve Respawn Comic.""" |
|
1750 | # Also on http://respawncomic.tumblr.com |
|
1751 | name = 'respawn' |
|
1752 | long_name = 'Respawn Comic' |
|
1753 | url = 'http://respawncomic.com ' |
|
1754 | get_navi_link = get_a_navi_comicnavnext_navinext |
|
1755 | get_first_comic_link = simulate_first_link |
|
1756 | first_url = 'http://respawncomic.com/comic/c0001/' |
|
1757 | ||
1758 | @classmethod |
|
1759 | def get_comic_info(cls, soup, link): |
|
1760 | """Get information about a particular comics.""" |
|
1761 | title = soup.find('meta', property='og:title')['content'] |
|
1762 | author = soup.find('meta', attrs={'name': 'shareaholic:article_author_name'})['content'] |
|
1763 | date_str = soup.find('meta', attrs={'name': 'shareaholic:article_published_time'})['content'] |
|
1764 | date_str = date_str[:10] |
|
1765 | day = string_to_date(date_str, "%Y-%m-%d") |
|
1766 | imgs = soup.find_all('meta', property='og:image') |
|
1767 | skip_imgs = { |
|
1768 | 'http://respawncomic.com/wp-content/uploads/2016/03/site/HAROLD2.png', |
|
1769 | 'http://respawncomic.com/wp-content/uploads/2016/03/site/DEVA.png' |
|
1770 | } |
|
1771 | return { |
|
1772 | 'title': title, |
|
1773 | 'author': author, |
|
1774 | 'day': day.day, |
|
1775 | 'month': day.month, |
|
1776 | 'year': day.year, |
|
1777 | 'img': [i['content'] for i in imgs if i['content'] not in skip_imgs], |
|
1778 | } |
|
1779 | ||
1780 | ||
@@ 1003-1030 (lines=28) @@ | ||
1000 | } |
|
1001 | ||
1002 | ||
1003 | class Mercworks(GenericNavigableComic): |
|
1004 | """Class to retrieve Mercworks comics.""" |
|
1005 | # Also on http://mercworks.tumblr.com |
|
1006 | name = 'mercworks' |
|
1007 | long_name = 'Mercworks' |
|
1008 | url = 'http://mercworks.net' |
|
1009 | get_first_comic_link = get_a_comicnavbase_comicnavfirst |
|
1010 | get_navi_link = get_a_rel_next |
|
1011 | ||
1012 | @classmethod |
|
1013 | def get_comic_info(cls, soup, link): |
|
1014 | """Get information about a particular comics.""" |
|
1015 | title = soup.find('meta', property='og:title')['content'] |
|
1016 | metadesc = soup.find('meta', property='og:description') |
|
1017 | desc = metadesc['content'] if metadesc else "" |
|
1018 | author = soup.find('meta', attrs={'name': 'shareaholic:article_author_name'})['content'] |
|
1019 | date_str = soup.find('meta', attrs={'name': 'shareaholic:article_published_time'})['content'] |
|
1020 | date_str = date_str[:10] |
|
1021 | day = string_to_date(date_str, "%Y-%m-%d") |
|
1022 | imgs = soup.find_all('meta', property='og:image') |
|
1023 | return { |
|
1024 | 'img': [i['content'] for i in imgs], |
|
1025 | 'title': title, |
|
1026 | 'author': author, |
|
1027 | 'desc': desc, |
|
1028 | 'day': day.day, |
|
1029 | 'month': day.month, |
|
1030 | 'year': day.year |
|
1031 | } |
|
1032 | ||
1033 | ||
@@ 499-529 (lines=31) @@ | ||
496 | } |
|
497 | ||
498 | ||
499 | class Dilem(GenericNavigableComic): |
|
500 | """Class to retrieve Ali Dilem comics.""" |
|
501 | name = 'dilem' |
|
502 | long_name = 'Ali Dilem' |
|
503 | url = 'http://information.tv5monde.com/dilem' |
|
504 | get_url_from_link = join_cls_url_to_href |
|
505 | get_first_comic_link = simulate_first_link |
|
506 | first_url = "http://information.tv5monde.com/dilem/2004-06-26" |
|
507 | ||
508 | @classmethod |
|
509 | def get_navi_link(cls, last_soup, next_): |
|
510 | # prev is next / next is prev |
|
511 | li = last_soup.find('li', class_='prev' if next_ else 'next') |
|
512 | return li.find('a') if li else None |
|
513 | ||
514 | @classmethod |
|
515 | def get_comic_info(cls, soup, link): |
|
516 | """Get information about a particular comics.""" |
|
517 | short_url = soup.find('link', rel='shortlink')['href'] |
|
518 | title = soup.find('meta', attrs={'name': 'twitter:title'})['content'] |
|
519 | imgs = soup.find_all('meta', property='og:image') |
|
520 | date_str = soup.find('span', property='dc:date')['content'] |
|
521 | date_str = date_str[:10] |
|
522 | day = string_to_date(date_str, "%Y-%m-%d") |
|
523 | return { |
|
524 | 'short_url': short_url, |
|
525 | 'title': title, |
|
526 | 'img': [i['content'] for i in imgs], |
|
527 | 'day': day.day, |
|
528 | 'month': day.month, |
|
529 | 'year': day.year, |
|
530 | } |
|
531 | ||
532 |