diff options
author | neodarz <neodarz@neodarz.net> | 2019-01-19 00:02:57 +0100 |
---|---|---|
committer | neodarz <neodarz@neodarz.net> | 2019-01-19 00:02:57 +0100 |
commit | a3f01580faf6caee4abcc8e682567b87380857b9 (patch) | |
tree | dbf5e0a9866b3aac7e7bb64f2eab8c005e1c28cd /app.py | |
parent | 073e919ef198a04da1e5ed28a7dfbc5d9681fc14 (diff) | |
download | khanindexer-a3f01580faf6caee4abcc8e682567b87380857b9.tar.xz khanindexer-a3f01580faf6caee4abcc8e682567b87380857b9.zip |
Add khanindex nevrax indexation
Diffstat (limited to 'app.py')
-rw-r--r-- | app.py | 10 |
1 files changed, 6 insertions, 4 deletions
@@ -1,14 +1,13 @@ import scrapy import sys from scrapy.crawler import CrawlerProcess +from scrapy import spiderloader from scrapy.utils.project import get_project_settings from flask import Flask, request, jsonify import json from sphinx import sphinx -from crawler.neodarznet.spiders.scrape import ScrapSpider - from database.models import Page, db import config @@ -34,8 +33,11 @@ def search(): def crawl(): try: db.create_tables(Page.__subclasses__()) - process = CrawlerProcess(get_project_settings()) - process.crawl(ScrapSpider) + settings = get_project_settings() + process = CrawlerProcess(settings) + spiders = spiderloader.SpiderLoader.from_settings(settings) + for spider in spiders.list(): + process.crawl(spider) process.start() except Exception as e: print(e) |