Created
August 26, 2015 10:31
-
-
Save podhmo/b9c6992898f556f3e336 to your computer and use it in GitHub Desktop.
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
# -*- coding:utf-8 -*- | |
import json | |
from article.parsers import EntertainmentStationArticleParser | |
import os.path | |
def dump(filename): | |
with open(filename) as fp: | |
parser = EntertainmentStationArticleParser(fp.read()) | |
result = parser.parse() | |
print(json.dumps(result, ensure_ascii=False, indent=2).encode("utf-8")) | |
if __name__ == "__main__": | |
import sys | |
try: | |
dump(sys.argv[1]) | |
except IndexError: | |
filename = os.path.join(os.path.abspath(os.path.dirname(__file__)), "success/2827.html") | |
filename = os.path.join(os.path.abspath(os.path.dirname(__file__)), "success/3648.html") | |
filename = os.path.join(os.path.abspath(os.path.dirname(__file__)), "success/3244.html") | |
dump(filename) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment