Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update dependencies and fix some bugs #24

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
"""

import types
from pymongo.connection import MongoClient
from pymongo import MongoClient
from pymongo import ASCENDING, DESCENDING

DATABASE_NAME = "books_fs"
Expand Down
2 changes: 1 addition & 1 deletion woaidu_crawler/woaidu_crawler/pipelines/bookfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ def process_item(self, item, spider):
custom process_item func,so it will manage the Request result.
"""

info = self.spiderinfo[spider]
info = self.SpiderInfo(spider)
requests = arg_to_iter(self.get_media_requests(item, info))
dlist = [self._process_request(r, info) for r in requests]
dfd = DeferredList(dlist, consumeErrors=1)
Expand Down
6 changes: 3 additions & 3 deletions woaidu_crawler/woaidu_crawler/pipelines/file.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
from scrapy.utils.misc import md5sum
from collections import defaultdict
from scrapy.utils.misc import arg_to_iter
from scrapy.contrib.pipeline.images import MediaPipeline
from scrapy.contrib.pipeline.images import ImagesPipeline
from woaidu_crawler.utils.select_result import list_first_item
from scrapy.exceptions import NotConfigured, IgnoreRequest

Expand Down Expand Up @@ -96,7 +96,7 @@ def _mkdir(self, dirname, domain=None):
if dirname not in seen:
seen.add(dirname)

class FilePipeline(MediaPipeline):
class FilePipeline(ImagesPipeline):
"""
download file pipeline.
"""
Expand All @@ -117,7 +117,7 @@ def __init__(self,store_uri,download_func=None):
raise NotConfigured
self.store = self._get_store(store_uri)
self.style = color.color_style()
super(FilePipeline, self).__init__(download_func=download_func)
super(FilePipeline, self).__init__(store_uri, download_func=download_func)

@classmethod
def from_settings(cls, settings):
Expand Down
2 changes: 1 addition & 1 deletion woaidu_crawler/woaidu_crawler/pipelines/mongodb.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from woaidu_crawler.utils import color
from scrapy import log
from woaidu_crawler.utils import color
from pymongo.connection import MongoClient
from pymongo import MongoClient

class SingleMongodbPipeline(object):
"""
Expand Down
4 changes: 2 additions & 2 deletions woaidu_crawler/woaidu_crawler/spiders/woaidu_detail_spider.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@

import time
from pprint import pprint
from scrapy.spider import BaseSpider
from scrapy.spider import Spider
from scrapy.selector import HtmlXPathSelector
from scrapy.http import Request
from woaidu_crawler.items import WoaiduCrawlerItem
from woaidu_crawler.utils.select_result import list_first_item,strip_null,deduplication,clean_url

class WoaiduSpider(BaseSpider):
class WoaiduSpider(Spider):
name = "woaidu"
start_urls = (
'http://www.woaidu.org/sitemap_1.html',
Expand Down