如何调整这个Google News脚本--我假设是使用变量--将当前年份和当前月份放在布尔搜索中--具体地说,就是以"tabbed.execute(... ?“
我的最终目标是让这个脚本返回当前年份和月份上下文中的搜索词。感谢你帮助一个新手!
google.load('search', '1');
function OnLoad() {
// create a tabbed mode search control
var tabbed = new google.search.SearchControl();
// create our searchers. There will now be 4 tabs.
tabbed.addSearcher(new google.search.VideoSearch());
tabbed.addSearcher(new google.search.NewsSearch());
tabbed.addSearcher(new google.search.BlogSearch());
tabbed.addSearcher(new google.search.ImageSearch());
// draw in tabbed layout mode
var drawOptions = new google.search.DrawOptions();
drawOptions.setDrawMode(google.search.SearchControl.DRAW_MODE_TABBED);
// Draw the tabbed view in the content div
tabbed.draw(document.getElementById("stephennews"), drawOptions);
// Search!
tabbed.execute("'SEARCHTERM1' AND 'SEARCHTERM2' AND '2013' AND 'MARCH'");
}
google.setOnLoadCallback(OnLoad);发布于 2013-03-01 22:28:22
我想我找到答案了。我不需要插入另一个带有当前日期公式的变量。我可能会让Google用boolean为我做所有的工作:
过去的x个月数记为"mINSERT NUMBER“同样,过去的x天数记为"dINSERT NUMBER”
因此,我的脚本中的搜索行将为:
tabbed.execute("'SEARCHTERM1' AND 'SEARCHTERM2' AND 'y[1]' AND 'm[1]'");https://stackoverflow.com/questions/15136844
复制相似问题