Skip to content

Commit

Permalink
Issue Nekmo#64: Process CSS files (ProcessCssStyleSheet is applicable).
Browse files Browse the repository at this point in the history
  • Loading branch information
Nekmo committed Jan 5, 2019
1 parent 8c88bc5 commit 659a449
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions dirhunt/processors.py
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,18 @@ def flags(self):
return flags


class ProcessCssStyleSheet(ProcessBase):
name = 'CSS StyleSheet'
key_name = 'css'

def process(self, text, soup=None):
pass

def is_applicable(cls, response, text, crawler_url, soup):
return response.headers.get('Content-Type', '').lower().startswith('text/css') and response.status_code < 300 \
and soup is not None


class ProcessHtmlRequest(ProcessBase):
name = 'HTML document'
key_name = 'html'
Expand Down Expand Up @@ -339,6 +351,7 @@ def get_processor(response, text, crawler_url, soup):
PROCESSORS = [
ProcessRedirect,
ProcessNotFound,
ProcessCssStyleSheet,
ProcessIndexOfRequest,
ProcessBlankPageRequest,
ProcessHtmlRequest,
Expand Down

0 comments on commit 659a449

Please sign in to comment.