如何使用“NOT Contains”在欢呼?
我使用 Cheeriogs 库在 Google App 脚本中工作:
脚本 ID:1ReeQ6WO8kKNxoaA_O0XEQ589cIrRvEBA9qcWpNqdOP17i47u6N9M5Xh0
https://github.com/tani/cheeriogs
我当前尝试使用 not contains 的代码看起来像这样:
function myFunction() {
var sheet = SpreadsheetApp.getActive().getSheetByName('Seu Seriado');
var url = 'https://seuseriado.org/';
const contentText = UrlFetchApp.fetch(url).getContentText();
const $ = Cheerio.load(contentText);
$('h2.entry-title.h6 > a:not(contains("SEM LEGENDA"))')
.each((index, element) => {sheet.getRange(index+1,1).setValue($(element).text().trim());});
}
但是给出了一个错误:
SyntaxError: missing closing parenthesis in :not ("SEM LEGENDA"))
考虑到没有括号丢失并且 not 的模型包含一些cheerio用户指出的正是带有等号加括号的模型,我应该怎么做才能解决这个问题?
I use the cheeriogs library to work in Google App Script:
Script ID: 1ReeQ6WO8kKNxoaA_O0XEQ589cIrRvEBA9qcWpNqdOP17i47u6N9M5Xh0
https://github.com/tani/cheeriogs
My current code trying to use not contains looks like this:
function myFunction() {
var sheet = SpreadsheetApp.getActive().getSheetByName('Seu Seriado');
var url = 'https://seuseriado.org/';
const contentText = UrlFetchApp.fetch(url).getContentText();
const $ = Cheerio.load(contentText);
$('h2.entry-title.h6 > a:not(contains("SEM LEGENDA"))')
.each((index, element) => {sheet.getRange(index+1,1).setValue($(element).text().trim());});
}
But an error is given:
SyntaxError: missing closing parenthesis in :not ("SEM LEGENDA"))
What should I do to resolve this issue taking into account that no parentheses are missing and the model for not contains that some cheerio users indicate is exactly the one with equal sign adding parentheses?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您需要在 contains 之前添加 : ,因为它是伪变量,因此它是
a:not(:contains(text))
You need the : before contains since it's a pseudo, so it's
a:not(:contains(text))