from comics.crawler.base import BaseComicCrawler
from comics.crawler.meta import BaseComicMeta

class ComicMeta(BaseComicMeta):
    name = 'Bizarro'
    language = 'no'
    url = 'http://www.start.no/tegneserier/bizarro/'
    start_date = '1985-01-01'
    end_date = '2009-06-24' # No longer hosted at start.no
    history_capable_days = 30
    schedule = 'Mo,Tu,We,Th,Fr,Sa,Su'
    time_zone = 1
    rights = 'Dan Piraro'

class ComicCrawler(BaseComicCrawler):
    def _get_url(self):
        self.url = 'http://g2.start.no/tegneserier/striper/bizarro/biz-striper/biz%(date)s.gif' % {
            'date': self.pub_date.strftime('%Y%m%d'),
        }

from comics.crawler.base import BaseComicCrawler
from comics.crawler.meta import BaseComicMeta

class ComicMeta(BaseComicMeta):
    name = 'Bizarro'
    language = 'no'
    url = 'http://underholdning.no.msn.com/tegneserier/bizarro/'
    start_date = '1985-01-01'
    history_capable_days = 12
    schedule = 'Mo,Tu,We,Th,Fr,Sa,Su'
    time_zone = 1
    rights = 'Dan Piraro'

class ComicCrawler(BaseComicCrawler):
    def _get_url(self):
        self.parse_feed('http://underholdning.no.msn.com/rss/bizarro.aspx')

        for entry in self.feed.entries:
            if self.timestamp_to_date(entry.updated_parsed) == self.pub_date:
                self.url = entry.enclosures[0].href
                return

Update 'Bizarro' crawler to use msn.no instead of start.no
Update 'Bizarro' crawler to use msn.no instead of start.no

  from comics.crawler.base import BaseComicCrawler
  from comics.crawler.meta import BaseComicMeta
  
  class ComicMeta(BaseComicMeta):
      name = 'Bizarro'
      language = 'no'
-     url = 'http://www.start.no/tegneserier/bizarro/'
+     url = 'http://underholdning.no.msn.com/tegneserier/bizarro/'
      start_date = '1985-01-01'
-     end_date = '2009-06-24' # No longer hosted at start.no
-     history_capable_days = 30
+     history_capable_days = 12
      schedule = 'Mo,Tu,We,Th,Fr,Sa,Su'
      time_zone = 1
      rights = 'Dan Piraro'
  
  class ComicCrawler(BaseComicCrawler):
      def _get_url(self):
+         self.parse_feed('http://underholdning.no.msn.com/rss/bizarro.aspx')
-         self.url = 'http://g2.start.no/tegneserier/striper/bizarro/biz-striper/biz%(date)s.gif' % {
-             'date': self.pub_date.strftime('%Y%m%d'),
-         }
  
+         for entry in self.feed.entries:
+             if self.timestamp_to_date(entry.updated_parsed) == self.pub_date:
+                 self.url = entry.enclosures[0].href
+                 return
+ 
Update 'Bizarro' crawler to use msn.no instead of start.no
## Code Before:
from comics.crawler.base import BaseComicCrawler
from comics.crawler.meta import BaseComicMeta

class ComicMeta(BaseComicMeta):
    name = 'Bizarro'
    language = 'no'
    url = 'http://www.start.no/tegneserier/bizarro/'
    start_date = '1985-01-01'
    end_date = '2009-06-24' # No longer hosted at start.no
    history_capable_days = 30
    schedule = 'Mo,Tu,We,Th,Fr,Sa,Su'
    time_zone = 1
    rights = 'Dan Piraro'

class ComicCrawler(BaseComicCrawler):
    def _get_url(self):
        self.url = 'http://g2.start.no/tegneserier/striper/bizarro/biz-striper/biz%(date)s.gif' % {
            'date': self.pub_date.strftime('%Y%m%d'),
        }

## Instruction:
Update 'Bizarro' crawler to use msn.no instead of start.no
## Code After:
from comics.crawler.base import BaseComicCrawler
from comics.crawler.meta import BaseComicMeta

class ComicMeta(BaseComicMeta):
    name = 'Bizarro'
    language = 'no'
    url = 'http://underholdning.no.msn.com/tegneserier/bizarro/'
    start_date = '1985-01-01'
    history_capable_days = 12
    schedule = 'Mo,Tu,We,Th,Fr,Sa,Su'
    time_zone = 1
    rights = 'Dan Piraro'

class ComicCrawler(BaseComicCrawler):
    def _get_url(self):
        self.parse_feed('http://underholdning.no.msn.com/rss/bizarro.aspx')

        for entry in self.feed.entries:
            if self.timestamp_to_date(entry.updated_parsed) == self.pub_date:
                self.url = entry.enclosures[0].href
                return
