|
@@ -2,6 +2,8 @@ import logging
|
|
import sys
|
|
import sys
|
|
|
|
|
|
from crawler import config
|
|
from crawler import config
|
|
|
|
+from crawler.context import Context
|
|
|
|
+from crawler.strategy import XiaoniangaoHomePageStrategy
|
|
|
|
|
|
|
|
|
|
class Main:
|
|
class Main:
|
|
@@ -15,7 +17,10 @@ class Main:
|
|
print("Platform = " + config.PLATFORM['xiaoniangao'])
|
|
print("Platform = " + config.PLATFORM['xiaoniangao'])
|
|
print("Strategy = " + config.STRATEGY['home_page'])
|
|
print("Strategy = " + config.STRATEGY['home_page'])
|
|
print("Env = " + config.ENV['test'])
|
|
print("Env = " + config.ENV['test'])
|
|
-
|
|
|
|
|
|
+ # TODO 根据参数判断 具体的策略
|
|
|
|
+ strategy = XiaoniangaoHomePageStrategy()
|
|
|
|
+ context = Context(strategy)
|
|
|
|
+ context.strategy.crawl()
|
|
|
|
|
|
|
|
|
|
if __name__ == '__main__':
|
|
if __name__ == '__main__':
|