forked from saymedia/seosuite
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
First pass at robots.txt parsing. Added an executable for seolinter.
- Loading branch information
1 parent
9d0a6db
commit 9e61059
Showing
2 changed files
with
54 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
#!/usr/bin/env python | ||
# -*- coding: utf-8 -*- | ||
|
||
# usage: | ||
# > python seolinter.py [text] [format] [run_id] | ||
# example: | ||
# > cat robots.txt | seolinter.py --format=txt | ||
|
||
import optparse | ||
import sys | ||
|
||
import seolinter | ||
|
||
def run(options, args): | ||
stdin = "".join(sys.stdin.readlines()) | ||
|
||
if options.format == 'html': | ||
print seolinter.lint_html(stdin) | ||
if options.format == 'xml': | ||
print seolinter.parse_sitemap(stdin) | ||
if options.format == 'txt': | ||
print seolinter.parse_robots_txt(stdin) | ||
if options.format == 'auto': | ||
print seolinter.parse_html(stdin) | ||
|
||
if __name__ == "__main__": | ||
parser = optparse.OptionParser(description='Validates html, sitemap xml and robots.txt content for common errors.') | ||
|
||
parser.add_option('-f', '--format', type="string", default='auto', | ||
help='The type of file to parse.') | ||
|
||
(options, args) = parser.parse_args() | ||
|
||
run(options, args) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters