-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #75 from tikazyq/develop
Develop
- Loading branch information
Showing
17 changed files
with
172 additions
and
93 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
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
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
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 |
---|---|---|
|
@@ -13,3 +13,4 @@ Werkzeug==0.15.2 | |
eventlet | ||
Celery | ||
Flower | ||
redis |
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
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
6 changes: 3 additions & 3 deletions
6
spiders/example_juejin/scrapy.cfg → spiders/xueqiu/scrapy.cfg
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 |
---|---|---|
@@ -1,11 +1,11 @@ | ||
# Automatically created by: scrapy startproject | ||
# | ||
# For more information about the [deploy] section see: | ||
# https://scrapyd.readthedocs.org/en/latest/deploy.html | ||
# https://scrapyd.readthedocs.io/en/latest/deploy.html | ||
|
||
[settings] | ||
default = juejin.settings | ||
default = xueqiu.settings | ||
|
||
[deploy] | ||
#url = http://localhost:6800/ | ||
project = juejin | ||
project = xueqiu |
File renamed without changes.
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,20 @@ | ||
# -*- coding: utf-8 -*- | ||
|
||
# Define here the models for your scraped items | ||
# | ||
# See documentation in: | ||
# https://doc.scrapy.org/en/latest/topics/items.html | ||
|
||
import scrapy | ||
|
||
|
||
class XueqiuItem(scrapy.Item): | ||
# define the fields for your item here like: | ||
_id = scrapy.Field() | ||
task_id = scrapy.Field() | ||
id = scrapy.Field() | ||
text = scrapy.Field() | ||
target = scrapy.Field() | ||
view_count = scrapy.Field() | ||
mark = scrapy.Field() | ||
created_at = scrapy.Field() |
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
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,25 @@ | ||
# -*- coding: utf-8 -*- | ||
|
||
# Define your item pipelines here | ||
# | ||
# Don't forget to add your pipeline to the ITEM_PIPELINES setting | ||
# See: https://doc.scrapy.org/en/latest/topics/item-pipeline.html | ||
import os | ||
|
||
from pymongo import MongoClient | ||
|
||
|
||
class XueqiuPipeline(object): | ||
mongo = MongoClient( | ||
host=os.environ.get('MONGO_HOST') or 'localhost', | ||
port=int(os.environ.get('MONGO_PORT') or 27017) | ||
) | ||
db = mongo[os.environ.get('MONGO_DB') or 'crawlab_test'] | ||
col = db.get_collection(os.environ.get('CRAWLAB_COLLECTION') or 'results_xueqiu') | ||
|
||
def process_item(self, item, spider): | ||
item['task_id'] = os.environ.get('CRAWLAB_TASK_ID') | ||
item['_id'] = item['id'] | ||
if self.col.find_one({'_id': item['_id']}) is None: | ||
self.col.save(item) | ||
return item |
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
File renamed without changes.
Oops, something went wrong.