|
√ Google adsense申请技巧 √ 本站核心代理域名注册主机业务
√ 快速发布你的买卖域名买卖网站信息
√ 1元注册 cn域名
√ 站长每日新闻导读 √ ·推荐万网空间¥120元 150m √ 站长网:站长必上的网站 √ 网站联盟大全 √ 本站代理万网域名55空间120元 |
这段程序是 根据采集到的新闻的标题+数据库中现有的关键字 匹配 来实现的。只怕会不符合有些朋友的需求。请见谅了!还有,采用这段程序会相应增加一点采集的时间。(我没具体测量过,但操作中感觉不出处理时间有明显增加)
怎么实现的呢:把数据表Routine中的记录一一取出,到新闻标题中去寻找是否出现。如果出现,就作为关键字。一个新闻可能会有多个关键字。
下面举个例子:采集得的新闻标题为: linux环境下的音频编程 。关键字表中有:linux,音频,编程三个关键字。那么最终该新闻就会有"linux,音频,编程"三个关键字了。
OK~~DiY it now!
请先备份
Admin\Collect\MoveNewsToSystem.asp
1、打开Admin\Collect\MoveNewsToSystem.asp,拉到倒数第二页(也就是%>的前一行)把下面的代码拷进去
'************************************
'author:lino
'把标题与关键字表中的记录匹配
'Start
'*************************
Function replaceKeywordByTitle(title)
Dim whereisKeyword,i,theKeywordOnNews
Dim keyword,rsRuleObj,theKeywordS
Set RsRuleObj = Conn.Execute("Select * from Routine")
do while Not RsRuleObj.Eof
keyword = RsRuleObj("name")
whereisKeyword = InStr(Lcase(title),Lcase(keyword))
if(whereisKeyword>0) then
if(theKeywordOnNews="") then
theKeywordOnNews=keyword
else
theKeywordOnNews=theKeywordOnNews&","&keyword
end if
end if
RsRuleObj.MoveNext
loop
'如果keyword的长度大于100,截去过长的
if(len(theKeywordOnNews)>99) then
theKeywordOnNews=left(theKeywordOnNews,99)
end if
replaceKeywordByTitle = theKeywordOnNews
End function
'**********************
'End
2、打开Admin\Collect\MoveNewsToSystem.asp ,找到约107行 或搜索
RsSysNewsObj("TxtSource") = RsNewsObj("Source") ,把下面的代码拷上去
RsSysNewsObj("keywords") =replaceKeywordByTitle(RsNewsObj("keywords"))