from comics.crawler.crawlers import BaseComicCrawler

class ComicCrawler(BaseComicCrawler):
    def _get_url(self):
        self.feed_url = 'http://www.questionablecontent.net/QCRSS.xml'
        self.parse_feed()

        for entry in self.feed['entries']:
            if self.timestamp_to_date(entry['updated_parsed']) == self.pub_date:
                self.title = entry['title']
                pieces = entry['summary'].split('"')
                for i, piece in enumerate(pieces):
                    if piece.count('src='):
                        self.url = pieces[i + 1]
                        return

from comics.crawler.crawlers import BaseComicCrawler

class ComicCrawler(BaseComicCrawler):
    def _get_url(self):
        self.feed_url = 'http://www.questionablecontent.net/QCRSS.xml'
        self.parse_feed()

        for entry in self.feed.entries:
            if ('updated_parsed' in entry and
                self.timestamp_to_date(entry.updated_parsed) == self.pub_date):
                self.title = entry.title
                pieces = entry.summary.split('"')
                for i, piece in enumerate(pieces):
                    if piece.count('src='):
                        self.url = pieces[i + 1]
                        return

Fix error in Questionable Content crawler when feed entry does not contain date
Fix error in Questionable Content crawler when feed entry does not contain date

  from comics.crawler.crawlers import BaseComicCrawler
  
  class ComicCrawler(BaseComicCrawler):
      def _get_url(self):
          self.feed_url = 'http://www.questionablecontent.net/QCRSS.xml'
          self.parse_feed()
  
-         for entry in self.feed['entries']:
+         for entry in self.feed.entries:
+             if ('updated_parsed' in entry and
-             if self.timestamp_to_date(entry['updated_parsed']) == self.pub_date:
+                 self.timestamp_to_date(entry.updated_parsed) == self.pub_date):
-                 self.title = entry['title']
+                 self.title = entry.title
-                 pieces = entry['summary'].split('"')
+                 pieces = entry.summary.split('"')
                  for i, piece in enumerate(pieces):
                      if piece.count('src='):
                          self.url = pieces[i + 1]
                          return
  
Fix error in Questionable Content crawler when feed entry does not contain date
## Code Before:
from comics.crawler.crawlers import BaseComicCrawler

class ComicCrawler(BaseComicCrawler):
    def _get_url(self):
        self.feed_url = 'http://www.questionablecontent.net/QCRSS.xml'
        self.parse_feed()

        for entry in self.feed['entries']:
            if self.timestamp_to_date(entry['updated_parsed']) == self.pub_date:
                self.title = entry['title']
                pieces = entry['summary'].split('"')
                for i, piece in enumerate(pieces):
                    if piece.count('src='):
                        self.url = pieces[i + 1]
                        return

## Instruction:
Fix error in Questionable Content crawler when feed entry does not contain date
## Code After:
from comics.crawler.crawlers import BaseComicCrawler

class ComicCrawler(BaseComicCrawler):
    def _get_url(self):
        self.feed_url = 'http://www.questionablecontent.net/QCRSS.xml'
        self.parse_feed()

        for entry in self.feed.entries:
            if ('updated_parsed' in entry and
                self.timestamp_to_date(entry.updated_parsed) == self.pub_date):
                self.title = entry.title
                pieces = entry.summary.split('"')
                for i, piece in enumerate(pieces):
                    if piece.count('src='):
                        self.url = pieces[i + 1]
                        return
