Skip to content

Commit

Permalink
chore: update basic tmpl
Browse files Browse the repository at this point in the history
  • Loading branch information
shengchenyang committed Jan 29, 2024
1 parent 4828acd commit efb323b
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions ayugespidertools/templates/spiders/basic.tmpl
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import json
from typing import TYPE_CHECKING, Union

from ayugespidertools.items import AyuItem, DataItem
from ayugespidertools.items import AyuItem
from ayugespidertools.spiders import AyuSpider
from scrapy.http import Request
from sqlalchemy import text
Expand Down Expand Up @@ -57,12 +57,12 @@ class $classname(AyuSpider):
nick_name = curr_data.get("nickName")

article_item = AyuItem(
article_detail_url=DataItem(article_detail_url, "文章详情链接"),
article_title=DataItem(article_title, "文章标题"),
comment_count=DataItem(comment_count, "文章评论数量"),
favor_count=DataItem(favor_count, "文章赞成数量"),
nick_name=DataItem(nick_name, "文章作者昵称"),
_table=DataItem(_save_table, "文章信息列表"),
article_detail_url=article_detail_url,
article_title=article_title,
comment_count=comment_count,
favor_count=favor_count,
nick_name=nick_name,
_table=_save_table,
# 可选参数:这里表示 MongoDB 存储场景以 article_detail_url 为去重规则,若存在则更新,不存在则新增
_mongo_update_rule={"article_detail_url": article_detail_url},
)
Expand Down

0 comments on commit efb323b

Please sign in to comment.