我使用 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"))
考慮到沒有缺少括號并且不包含某些cheerio用戶指示的模型正是帶有等號加括號的模型,我應該怎么做才能解決此問題?
uj5u.com熱心網友回復:
你需要 : before contains 因為它是偽的,所以它是
a:not(:contains(text))
轉載請註明出處,本文鏈接:https://www.uj5u.com/caozuo/435839.html
上一篇:作業表沒有激活
下一篇:用撇號替換字串中的字符谷歌表
