Comments (2)
tag 的话,在 illust.tags
里 ,参见 illust对象示例
如果你是需要把图片的所有 tag 添加到文件名,将这个数组内字符串提取出来,再合并到一个字符串即可,这里用到了JS 的编程语法。当然你还可以在这个基础上加入标签的排序或者筛选等。
illust.tags.map(o=>o.name).join('、')
过滤器,组合多个条件,使用逻辑运算符,请见 逻辑或(||) 和 逻辑与(&&)
先给你分步骤写
let tags = illust.tags.map(o=>o.name); //将 tag 字符串数组存入变量简化语句
tags.includes("博麗霊夢") && tags.includes("霧雨魔理沙") && tags.includes("東風谷早苗"); // tag 需要灵梦、魔理沙、早苗3个同时存在才返回 true
tags.includes("博麗霊夢") || tags.includes("霧雨魔理沙") || tags.includes("東風谷早苗"); // tag 灵梦、魔理沙、早苗中有任意一个就返回 true
(tags.includes("博麗霊夢") || tags.includes("霧雨魔理沙")) && tags.includes("東風谷早苗"); // tag 里有1个灵梦或者魔理沙,并同时有早苗,返回 true
!tags.includes("博麗霊夢") // !是取反,就是not的意思,这表示tag有灵梦时就返回 false
由于我默认设定的是排除过滤器,所以筛选应该是需要排除的图片;而只保留某种图片,则将这种图片的筛选条件取反就行了。
我现在要一定有灵梦和早苗的图,但是一定不要有魔理沙在上面。那么语句应该写为
!(tags.includes("博麗霊夢") && tags.includes("霧雨魔理沙")) || tags.includes("東風谷早苗")
上面的意思是,同时存在灵梦和魔理沙时,先得到 true ,然后取反变为 false ,所以其他只存在单个或者都不存在的情况都会返回 true ,就不会下载图片。另外存在早苗时也返回 true ,所以也不下载。
具体写到过滤器里时,又需要用一些语法进行包装(过滤器这里不要写掩码的括号)
(tags=> !(tags.includes("博麗霊夢") && tags.includes("霧雨魔理沙")) || tags.includes("東風谷早苗") )(illust.tags.map(o=>o.name))
你也可以用在外面加上掩码的方式,在文本输出的地方查看逻辑输出结果
from pixivuserbatchdownload.
学到了,感谢!
from pixivuserbatchdownload.
Related Issues (20)
- 一些我遇到的问题 HOT 1
- [Feature Request] An online version of PixivUserBatchDownload HOT 3
- 按钮不显示 HOT 6
- PUBD按钮不显示的一种解决方法 HOT 4
- 请问可以根据作者发布的标题及目录分开文件夹下载吗? HOT 3
- 如何查看illust对象 HOT 4
- 大佬,能否添加一种自定义下载数量的功能?例如:获取总数量后,以作品为单位,或者以p站默认分页为单位,设定数量进行一次性打包发送 HOT 2
- 无法登录 HOT 1
- 完全无法显示下载按钮了 HOT 1
- “下载该画师所有作品”功能可能存在问题 HOT 2
- 是否有什么手段批量下载 HOT 3
- 为什么在手机上输入电脑获取的登录链接会报错? HOT 1
- 无法连接到aria2 HOT 4
- i-cf.pximg.net在国内好像可以使用 HOT 2
- 提个过分的问题:可以实现通过rss订阅实现自动更新吗?
- 提个过分的问题:可以实现通过rss订阅实现自动更新吗? HOT 1
- Aria2发送信息错误 HOT 7
- 為甚麼每次打開新頁面後,默認下載方案就會消失了 HOT 18
- 请问如何做到下载图片后,用原图片标题来自动重命名? HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pixivuserbatchdownload.