feat: user_id_list在config.json支持混合的模式#268
Closed
eggachecat wants to merge 2 commits intodataabc:masterfrom
Closed
Conversation
dataabc
reviewed
Dec 9, 2020
weibo_spider/spider.py
Outdated
| user_id_list = FLAGS.u.split(',') | ||
| if isinstance(user_id_list, list): | ||
| user_id_list = list(set(user_id_list)) | ||
| user_id_list = list(user_id_list) |
Owner
There was a problem hiding this comment.
感谢贡献代码,非常实用的修改。还有一些地方需要改,不知道想的是否正确。
这一句是否应该去掉或修改。原来的语句目的是去重,加入dict后,原方式就不能用了。当前语句下,user_id_list本就是list形式,再转一次list是否有必要。我的建议是删去此句,或者改成可以去重的形式。这是我的想法,不知道是否考虑周全。
Owner
There was a problem hiding this comment.
所以这句可以去掉,也可以改成去重的。因为id是用户输的,不确定是不是有重复的。去重是一定会添加的,如果你不想添加,删掉就可以,后面我自己弄就行。如果你行有余力,当然加上去重更好啦。
Contributor
Author
There was a problem hiding this comment.
@dataabc 我PR了新的一种方案:
判断如果是以前的情况(不含dict的),则使用原本的去重
如果是新的(含有dict类型)则使用这个feat
不知道你觉得如何?
Contributor
Author
There was a problem hiding this comment.
我发现我写了一行
「user_id_list = user_id_list」
我决定重新提交一次...
Owner
|
上面的修改很好,不过有个缺点,就是如果 就没法去重了,可以这样 temp就是没有重复的结果 |
Contributor
Author
|
@dataabc |
Owner
|
感谢。 其实没必要重开pull request。只要在自己项目下修改,pull request会自动同步的。 |
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
可以支持如下的配置
{ "user_id_list": ["1729370543", { "id": "1669879400", "since_date": "2020-11-01 18:15" }], }这样使得程序的调用的时候会更灵活一点