采集是永恒的话题。

但我更愿意这种行为进化为“自动化信息理”(这儿用“整理”而非“处理”)。

当前国内主流的有多种“小蜜蜂”及“火车头”,共同特点是“一切取决于采集规则”,这两个平台的在线论坛由此火爆,而康盛创想推出的X-Space原生即包含简单采集功能(有个特色小附加功能是自动判定和析出网页主体内容)。

1. 非采集器,但要求高微操能力
当前,我正着手构建一个大信息量的站点(zhonghuayixue.net),网站主要是整理医学类的资源如医学图片、视频及软件、电子书、词条及论文。初步计划是先灌装和有效标记十万条左右数据,后期再进行程序及性能优化,逐步WEB2.0。

这些资源形式各有不同,信息源分散,大信息量的站点不多,更新亦不频繁。我考查了包括上面提及的几个采集器,不得不承认制作团队花费了大量的时间让信息整理变得简单,但恐怕仍然无法胜任我的要求——单独为不同站点编写不同采集规则,从性能及时间成本上均不划算,并且,采集器无法对付光怪陆离的防采手段,更重要的是,性能问题也很大。

我的实际解决方案是,整站下载软件OE+文本编辑Editplus+以vbs编写的wscript宿主脚本。首先下载指定站点(这个大概一分钟能指定一个下载项目,只需提前找到所有目标对象即可),Wscript再找出不同项目的不同规则,为不同项目形成不同的vbs文件(这个复杂一些,约需十五分钟),按模板分析所有既有页面文件,一般十五分钟至三十分钟可处理一个站点。一两周下来,大约积累了十万张医学图片。

后来考虑,恐怕这个完善一下就是一个基于脚本宿主技术的采集器:-),但比那些采集器缺的东西多了太多。

另外,同样需要注意性能问题——Wscript在处理正则表达式时,规则编写过于随便会导致每个信息页面的处理时间超过30秒!照此,若以四核的PC,一天也才能搞定三四千条记录。

但,这确实对终合技能要求过高,因此,普通编辑人员恐怕无法达到这样的速度要求——我在试图请一个朋友帮忙时,回应是:kolidon同学,这种高强度的活儿做得快我很羡慕,但一点都不高科技——无奈,话题又回到采集器应用上的问题上来。

2. 思路简单,但核心问题在于文本比较

自动对下载下来的文件进行比较,以发现相似之处,结合人工点击鼠标决选,或者会是一个比较不错的思路。

1) 支持命令行比较的开源软件winmerge进入视线。这儿是中文介绍
2) 另一个开源文本比较器,TextDiff,在这儿http://www.angusj.com/delphi/textdiff.html (我一直在用的)
3) 冬blog,http://www.cnblogs.com/yuandong/archive/2006/12/18/596109.html
4) clariones:文本比较算法剖析(1)-如何确定最大匹配率

核心算法与图论有关,这个我需要进一步研究,但目前来讲,直接采用开源组件以获得不同的行即可。

那么,接下来:
1) 源文件尽可能多的换行;(遇标签换行即可)
2) 按行比较并找出最大匹配(尽可能多的文件扫描);
3) 换行后的文本恢复到原始状态显示(只需记住在何处添加了换行符即可),但高亮不同部分(不同次数越多,颜色越深),用户点选鼠标,将自定标签拖到高亮位置以确认选定(每标签被拖至位置后可填写进一步参数);
4) 系统根据参数生成规则文件。

目前是思路,实际操作估计比这个稍复杂一些。

2009年7月update:拿到了一套2004年左右的基于java的商用采集产品,似乎也努力想要实现多路源比较找出模板的功能,可惜不太成功。若有时间,kolidon将反编译之以研究其类库结构并找出其自动模板生成不成功的原因。

技术笔记:一套CSS框架——YAML

19 Jun 2008 In: FRAMEWORK

在浏览openSuSe时(相当漂亮的站点)发现,底部有“This site uses the YAML CSS framework”字样。

位置在这儿:
http://www.yaml.de/en/

兼容IE5.x/6.0/7.0 /Firefox /Safari /Opera

后来google了一下,才发现原来yaml已经相当知名。

版权许可,自2.2起,采用Creative Commons Attribution 2.0 License (CC-A 2.0)

意外收获在这儿:
CSS框架汇总-21andy   (除yaml外还提到elements http://elements.projectdesigns.org/和blueprint http://www.blueprintcss.org/)
CSS框架利与弊 -blueidea  (kolidon对其中谈及的CSS框架之弊持保留意见,论调实属多余)

http://vikjavev.no/highslide/

在joomlart做的模板中,曾经利用其做出图片备注效果及浮动效果的登录和查询ajax模块。
在这儿:http://www.joomlart.com/templates_demo.php?template=ja_teline_ii

在我喜欢的一个图库管理项目pony_gallery中,亦有这个的效果利用。

可以完成的主要功能是(弹出承载层为圆角界面):

highslide特性摘录如下:

Highslide JS Core

Highslide HTML Extension

API reference

基本上,这个框架能很轻松地增添交互和ajax效果,让站点前台界面效果提升一个档次——可惜对商业应用有许可限制——另外,我用得比较多的某套图库应用:ponygallery,将此框架作为提升表现层效果的重要武器——效果当然不错。

注意,56.com与其他国内站点不同在于:他们已经用js脚本输出所有重要内容,从而基本杜绝了简单页面分析获取swf位置的可能性(也就是说,缩略图和swf位置都需要用户手工粘贴)。

另外,因为seyret对函数命名根据域名来进行,则函数名应为56getvideodetails(),这显然会造成一些问题,为支持此插件,seyret.php核心文件亦需作相相应在改变,即在分析URL中域名时,若域名为数字头,则应在调用的函数名前加www(这是临时解决方案),从根本上解决应当改成调用所有函数时,不论域名是否为数字起,均在域名前加同样字符,但这恐又会对既有插件的改名需求而造成一定混乱,因此,此处采用此方案。

代码修改如下:

查找seyret.php中所有

$functionname = $fvtype . "embed";

在此行前加

  //added by kolidon... like 56.com
  $fvtype = preg_match("/^([\d]+)[.]*$/", $fvtype)>0 ? "www".$fvtype : $fvtype;
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
<?php
/**
// youku plugin for Seyret component//
* Content code
* All rights reserved
* Seyret Component is Free Software
* Released under GNU/GPL License : http://www.gnu.org/copyleft/gpl.html
* by kolidon http://blog.treeber.com
* @Copyright (C) 2008 kolidon@gmail.com
*/
// no direct access
defined(’_VALID_MOS’) or die(’couldn\’t direct access’);
 
$videodownloadsupport = “no”;
$downloadcachingnotimeout = “no”;
$downloadcachingtimeout =60″;
 
//modified by kolidon…
//accept picturelink&smallvideocode
//function www56getvideodetails($vidlink, $existingcode, $categorylist, $reqtype)
function www56getvideodetails($vidlink, $existingcode, $categorylist, $reqtype, $picturelink, $smallvideocode)
{
 echo(::.$vidlink.<br />);
 global $database, $mosConfig_absolute_path, $mosConfig_live_site, $my;
 require_once($mosConfig_absolute_path ./administrator/components/com_seyret/seyret_config.php’);
 
 // http://www.56.com/u49/v_MzM2NzMzMjY.html
 // http://www.56.com/u20/v_MjkxOTQwOTc.html
 //attention: there is no relationship beetween the vidlink and the player link, so we use the all player url as smallservercode;
 //http://www.56.com/n_v139_/c32_/29_/26_/ws3228896_/120315152843_/1226580_/0_/29194097.swf
 
 /*
 <script type=”text/javascript”>
 var uvHost = “h19″;
 var _page_ = {channel:’show_flv’};
 var _oFlv_c = {’tag’ : ‘负离子 ‘, ‘tags0′ : ‘负离子 ‘, ‘tags1′ : ‘ ‘, ‘tags2′ : ‘ ‘, ‘tags3′ : ‘ ‘, ‘tags4′ : ‘ ‘, ‘Subject’ : ‘离子医学 02 ‘, ‘Content’ : ‘离子医学  \r\n       \r\n     \r\n\r\nn 《离子医学》是一门集电子学、物理化学、材料工学、高分子学、生命科学及临床医学等学科融为一体的跨学科的科学。创始人为日本堀口N 医学博士。\r\n\r\n \r\n\r\nn 现代社会自然生态环境的严重破坏,使人类进入了亚健康时代,人们的自然免疫能力和对疾病的自然治愈能力正在衰退,现代临床医学为此已步入了僵局。\r\n\r\n \r\n\r\nn 离子医学界的专家们认为,现代医学理念的“疾病治疗”主要是依靠各类药物的作用,而各类药物在发挥作用的同时,其副作用又是以损坏患者部分机体功能并加速其衰老为代价,来寻求患者病灶部位暂时的平衡。即使非常先进的现代医学,也并不能从真正意义上治好疾病,其结果往往是药物的副作用加速了生命体细胞组织的老化。\r\n\r\n \r\n\r\nn 离子医学研究阐明生命体的酸性、氧化是除遗传因素之外的各种现代疾病产生的根源。  \r\n\r\n \r\n\r\n  ● 其机理之一:现代社会生命体因长期精神紧张、不安而引 起中枢性,末梢  感神经持续紧张,末梢循环血液障碍,  基产生量增加,从而导致细胞内外的酸性氧化亢进;\r\n\r\n \r\n\r\n ● 机理之二:劳累过度,乳酸蓄积之后引起肌肉紧张,肩膀疼痛,头痛,失眠等症状,是由于正离子而引起的细胞的氧化,降低了激素分泌,免疫功能,以及体液循环,加快了老化,致使组织细胞的衰退;\r\n\r\n  \r\n\r\n   ● 机理之三:地球生态环境的破坏,紫外线的增强、电子产 品的电磁波、静电的环境等使负离子量明显减少,从而助长了生命体的酸性和氧化;\r\n\r\n  \r\n\r\n   ● 机理之四:酸性食品的过度摄入,产生自体内的有毒的活性氧(  基)等致使细胞加剧了氧化。\r\n\r\n \r\n\r\n n 离子医学研究者认为,对生命体给与自然界的能量—负离子(还原电子),可使破环生命体健康的酸性、氧化、活性氧、乳酸等因素逐渐减少,激活细胞组织的新陈代谢,给生命体内部创造良好的环境,造就健康的身体。从而加强生命体自身的恢复力与自然治愈能力,进而克服疾病,以这个宇宙生命根源的原理为准则的还原电子治疗法,可以无副作用并根本性的治愈疾病,因此,可以说还原电子治疗法是治疗医学,也是预防医学。\r\n\r\n \r\n\r\n离子医学的产生和发展将是人类重新找回健康的唯一途径,是二十一世纪最伟大的尖端科学。 ‘, ‘user_name’ : ’shserumi ‘};
 document.title = “离子医学 02  - 56网视频”;
 </script>
 */
 
 if ($reqtype ==new) {
  $vidlink = jalemurldecode($vidlink);
 
 }
 
 else if ($reqtype == “refresh”) {
  // 56.com is special, use the param
 }
 
 $videoservertype =56″;
 
 // the video page
 $str = jalem_file_get_contents($vidlink);
 $str = mb_convert_encoding($str, “UTF-8, “GBK”);
 // tag,subject,content,user_name
 $pattern0 =<head>[^\f]*?var _oFlv_c = \{([^\f]*?’)\};[^\f]*?</script>[^\f]*?</head>”;
 if(mb_eregi($pattern0, $str, $arr_videotemp)){
  $str_temp = $arr_videotemp[1];
  // maybe some commas and single quotes in content, so we user mb_eregi
  if(mb_eregi((’tag’ :[^\f]*?), ‘Subject”,$str_temp, $arr_itemtemp)>0){
   $videotags = mb_eregi_replace(”tag[s]?[\d]*,,$arr_itemtemp[1]);
   $videotags = mb_eregi_replace([,':\s]+”,’,',$videotags);
   while(strpos($videotags,,,)!==false){
    $videotags = str_replace(,,,,, $videotags);
   }
  }
  if(mb_eregi(”‘Subject’([^\f]*?), ‘Content”,$str_temp, $arr_itemtemp)>0){
   $videotitle = $arr_itemtemp[1];
   $videotitle = mb_eregi_replace([':,]+”,’ ‘,$videotitle);
   while(strpos($videotitle, “  “)!==false){
    $videotitle = str_replace(”  “,” “, $videotitle);
   }
   $videotitle = trim($videotitle);
  }
  if(mb_eregi(”‘Content’([^\f]*?), ‘user_name”,$str_temp, $arr_itemtemp)>0){
   $itemcomment = $arr_itemtemp[1];
   // the first and the trail quote
   //$itemcomment = mb_eregi_replace(”[,':\s],,',$itemcomment);
 
   while(mb_eregi(”^([,':\s])+, $itemcomment)>0){
    $itemcomment = mb_substr($itemcomment, 1);
   }
   while(mb_eregi(”^.*([,':\s])+$”, $itemcomment)>0){
    $itemcomment = mb_substr($itemcomment, 0, mb_strlen($itemcomment)-2);
   }
 
   $itemcomment = str_replace(’\r\n’, “<br />”, $itemcomment);
  }
  if(mb_eregi(”‘user_name’ : [^\f]*?’, ‘Content”,$str_temp, $arr_itemtemp)>0){
   $user_name = $arr_itemtemp[1];  // extensible
  }
 }
 if ($reqtype == “new”) {
  $renderinputform = renderinputform_kolidon($vidlink, $picturelink, $videotitle, $itemcomment, $categorylist, $videoservertype, $smallvideocode, $videotags);
  return $renderinputform;
 } else if ($reqtype == “refresh”) {
  return array ($picturelink, $videotitle, $itemcomment);
 } else if ($reqtype == “newdirectadd”) {
  // by kolidon
  // to do: query the videoitem table to determine the $vidlink is no double
  $renderresult = savevideoitem_kolidon($vidlink, $picturelink, $videotitle, $itemcomment, $categorylist, $videoservertype, $smallvideocode, $videotags);
  return $renderresult;
 }
}
 
function www56embed($vcode, $vthumb, $downloadcachingnotimeout, $downloadcachingtimeout, $pro, $catid, $setwidth = null, $setheight = null)
{
 global $mosConfig_absolute_path, $mosConfig_live_site;
 require($mosConfig_absolute_path . ‘/administrator/components/com_seyret/seyret_config.php’);
 
 $dlink = “”;
 $unexpectederror = “”;
 $fullmd5cachefile = “”;
 $vdlink = “”;
 
 $vcode = jalemurldecode($vcode);
 
 $vidwindow = mosGetParam($_REQUEST, ‘vidwindow’, null);
 if ($vidwindow == “popup”) {
  $videowidth = $popupvideowidth;
  $videoheight = $popupvideoheight;
 }
 
 if ($setwidth > 0 AND $setheight > 0) {
  $videowidth = $setwidth;
  $videoheight = $setheight;
 }
 
 $pos404 = strpos($vdlink, “NotFound”);
 $unexpectederror = “”;
 if (!file_exists($fullmd5cachefile) AND $vdlink == “”) $unexpectederror = “1″;
 if ($pos404 > 0) $unexpectederror = “1″;
 
 if ($pro <> “1″ OR $unexpectederror == “1″) {
  $embedvideo = ‘
   <embed src=”‘.$vcode.’”  type=”application/x-shockwave-flash” width=”‘.$videowidth.’” height=”‘.$videoheight.’”></embed>
  ’;
 }
 
 return $embedvideo;
}
 
function www56generatevideodownloadlink($vcode, $pro, $dltask)
{
 global $database, $mosConfig_live_site, $mosConfig_absolute_path;
 
 $vtype = “youku”;
 
 $database->setQuery(”SELECT joomlaalemuserid FROM #__seyret_check”);
 $check = $database->loadObjectList();
 foreach ($check as $check) {
  $joomlaalemuserid = $check->joomlaalemuserid;
 }
 $siteforjoomlaalem = $mosConfig_live_site;
 $siteforjoomlaalem = jalemurlencode($siteforjoomlaalem);
 
 if ($pro == “1″) {
  $pro_file = $mosConfig_absolute_path . “/administrator/components/com_seyret/sql/pro/spphp.php”;
  require_once($pro_file);
  $str = generateprodlink($vtype, $vcode);
 
  $pos = strpos($str, “<prolink>”) + 9;
  $post = strpos($str, “</prolink>”) - $pos;
  $dlink = substr($str, $pos, $post);
 
  $pos = strpos($str, “<dltype>”) + 8;
  $post = strpos($str, “</dltype>”) - $pos;
  $dtype = substr($str, $pos, $post);
 
  if ($dltask <> “embed”) {
   if ($dtype == “script”) {
    $downlink = “<script>self.location = \”" . $dlink . “\”;</script>”;
   } else if ($dtype == “save”) {
    $downlink = “<a href=\”" . $dlink . “\”>” . _RIGHTCLICKANDSAVE . “</a>”;
   }
   return $downlink;
  } else {
   return $str;
  }
 } else {
  $func = “generatedownloadlink”;
  $link = “http://www.joomla-alem.com/index2.php?option=com_joomlaalem&no_html=1&task=” . $func . “&siteinfo=” . $siteforjoomlaalem . “&jalemuserid=” . $joomlaalemuserid . “&vtype=” . $vtype . “&vcode=” . $vcode;
  $videodownloadlink = jalem_file_get_contents($link);
  return $videodownloadlink;
 }
}
 
?>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
<?php
/**
* ku6 plugin for Seyret component//
* Content code
* All rights reserved
* Seyret Component is Free Software
* Released under GNU/GPL License : http://www.gnu.org/copyleft/gpl.html
* by kolidon http://blog.treeber.com
* @Copyright (C) 2008 kolidon@gmail.com
*/
// no direct access
defined(’_VALID_MOS’) or die(’couldn\’t direct access’);
 
$videodownloadsupport = “no”;
$downloadcachingnotimeout = “no”;
$downloadcachingtimeout =60″;
 
function ku6getvideodetails($vidlink, $existingcode, $categorylist, $reqtype)
{
 echo(::.$vidlink.<br />);
 global $database, $mosConfig_absolute_path, $mosConfig_live_site, $my;
 require_once($mosConfig_absolute_path ./administrator/components/com_seyret/seyret_config.php’);
 
 // http://v.ku6.com/show/s4rEhyaoVMUf7s1e.html
 // http://player.ku6.com/refer/s4rEhyaoVMUf7s1e/v.swf
 
 if ($reqtype ==new) {
  $vidlink = jalemurldecode($vidlink);
  $smallvideocode = str_replace(”http://v.ku6.com/show/“, “”, $vidlink);
  $smallvideocode = str_replace(.html”, “”, $smallvideocode);
  $vidlink = “http://v.ku6.com/show/” . $smallvideocode.”.html”;
 } else if ($reqtype == “refresh”) {
  if ($vidlink == “”) {
   $vidlink = “http://v.ku6.com/show/” . $existingcode.”.html”; //trytoguess
  }
 }
 
 $videoservertype = “ku6″;
 $str = jalem_file_get_contents($vidlink);
 $str = mb_convert_encoding($str, “UTF-8, “GBK”);
 
/*
  <div class=”ttc_l”>
      <span><a href=”http://www.ku6.com/health/” target=”_blank”>[健康]</a></span> 医学视频-咽喉部操作技术
  </div>
*/
 
 $pattern0 =<div class=”ttc_l”>[^\f]*?<span>.*?</span>(.*?)[\n]‘;
 if(mb_eregi($pattern0, $str, $arr_title)){
  $videotitle = trim($arr_title[1]);
 }
 
/*
   <div class=”nv_i_v”>
    <p>播放: <span id=”vPlayCountSpan”>0</span>&nbsp;&nbsp;|&nbsp;& nbsp;评论: <span>0</span>&nbsp;&nbsp;|&nbsp;&nbsp;收藏: <span>0</span><!–&nbsp;&nbsp;|&nbsp;&nbsp; 引用: <span id=”vQuoteSpan”>0</span>–></p>
    <div class=”clearfix”><p class=”nv_i_v_tag”>标签: <a href=”http://so.ku6.com/v?q=%E5%8C%BB%E5%AD%A6%E8%A7%86%E9%A2%91” target=”_blank”>医学视频</a> <a href=”http://so.ku6.com/v?q=%E5%8C%BB%E5%AD%A6%E6%95%99%E5%AD%A6” target=”_blank”>医学教学</a> </p><a href=”javascript:showMoreInfo();” class=”a_tag”>>></a></div>
 
    <div class=”clearfix profile”><p class=”cont”>简介: 医学视频 医学教学 手术 医学检查 咽喉</p><a href=”javascript:showMoreInfo();” id=”showMoreBtn”>显示详细</a></div>
  </div>
*/
 
 $pattern0 =<div class=”clearfix”><p class=”nv_i_v_tag”>[^<]*?(<a href=[^>]*>[^<]+</a> ){0,10}</p>’;
 if(mb_eregi($pattern0, $str, $arr_videotags)){
  //echo $str;
  //exit(’heihei———–’.count($arr_videotags).$arr_videotags[0].$arr_videotags[1].$arr_videotags[2]);
  //unset($arr_videotags[0]);
 
  $videotags = mb_ereg_replace(”标签:,",strip_tags($arr_videotags[0]));
  $videotags = mb_ereg_replace(” ”,” “,strip_tags($videotags));
  //echo $videotags.”————ttt”;
 }
 
 $pattern0 = ‘<div class=”clearfix profile”><p class=”cont”>([^<]*?)</p>’;
 if(mb_eregi($pattern0, $str, $arr_itemcomment)){
  $itemcomment = $arr_itemcomment[1];
  $itemcomment = mb_ereg_replace(”简介: “,”",strip_tags($itemcomment));
  //echo $itemcomment.”————ggg”;
 }
 
 // k6需查询得出缩略图
 //http://so.ku6.com/v?q=%E5%8C%BB%E5%AD%A6%E8%A7%86%E9%A2%91-%E5%92%BD%E5%96%89%E9%83%A8%E6%93%8D%E4%BD%9C%E6%8A%80%E6%9C%AF
 /*
   <div class=”soItem”>
    <div onmouseout=”video_onmoveout(this)” onmouseover=”video_onmoveover(this)” id=”video7″ class=”pic”><a target=”_blank” href=”http://v.ku6.com/show/kdjGJE4LaYXcgBnY.html” class=”playerIco”/><a target=”_blank” href=”http://v.ku6.com/show/kdjGJE4LaYXcgBnY.html“>
    <img border=”0″ src=”http://i2.i6.ku6.com/200705/21/15/UqRy98J_ILYE00Mi/1.jpg”/>
    </a></div>
    <dl class=”soLtemInfo”>
     <dt><a target=”_blank” href=”http://v.ku6.com/show/kdjGJE4LaYXcgBnY.html”><font color=”#cc0033″>说</font><font color=”#cc0033″>医</font><font color=”#cc0033″>学</font>—<font color=”#cc0033″>郭</font><font color=”#cc0033″>德</font><font color=”#cc0033″>纲</font> 于谦</a></dt>
     <dd>播客:<a target=”_blank” href=”http://v.ku6.com/ccs005“>绝色影视在线</a></dd>
     <dd>标签:<a href=”http://so.ku6.com/t/q%E8%AF%B4%E5%8C%BB%E5%AD%A6“>说医学</a> <!–<a href=”#” target=”_blank”><span class=”key”>爱情</span></a>–>
       <!– 
        <a href=”#” target=”_blank”>大卫温汉姆 乔纳森特普里兹基</a>
        <a href=”#” target=”_blank”>欧美</a>
       –>
     </dd>
     <dd>介绍:<font color=”#cc0033″>说</font><font color=”#cc0033″>医</font><font color=”#cc0033″>学</font>—<font color=”#cc0033″>郭</font><font color=”#cc0033″>德</font><font color=”#cc0033″>纲</font> 于谦</dd>
     <dd class=”time”>时长:<i class=”num”>13:02</i>
      <span>|</span>发布:<i class=”num”>2008-2-11</i>
      <span>|</span>评论:<i class=”num”>0</i>
      <span>|</span>收藏:<i class=”num”>0</i>
     </dd>
    </dl>
    <dl class=”playNum”>
     <dt><a target=”_blank” href=”http://v.ku6.com/show/kdjGJE4LaYXcgBnY.html“>播放</a></dt>
     <dd><i class=”num”>4</i>次</dd>
    </dl>
    <div class=”clear”/>
   </div>
 */
 
 $vidlink2 = ‘http://so.ku6.com/v?q=’ . $videotitle. urlencode(” ” . $videotags);
 
 $str2 = jalem_file_get_contents($vidlink2);
 $str2 = mb_convert_encoding($str2, “UTF-8, “GBK”);
 
 $pattern0 =<div class=”soItem”>[^\f]*?<a[^\f]*?’.$smallvideocode.[^\f]*?<img.*? src=([^"]*)”.*?>[^\f]*?时长:<i class=”num”>(.*?)</i>’;
 
 if(mb_eregi($pattern0, $str2, $arr_thumb)>0) {
 
  $picturelink = urldecode($arr_thumb[1]);
  $videotime = $arr_thumb[2];  //留作扩展
 };
 if ($reqtype == “new”) {
  $renderinputform = renderinputform_kolidon($vidlink, $picturelink, $videotitle, $itemcomment, $categorylist, $videoservertype, $smallvideocode, $videotags);
  return $renderinputform;
 } else if ($reqtype == “refresh”) {
  return array ($picturelink, $videotitle, $itemcomment);
 } else if ($reqtype == “newdirectadd”) {
  // by kolidon
  // to do: query the videoitem table to determine the $vidlink is no double
  $renderresult = savevideoitem_kolidon($vidlink, $picturelink, $videotitle, $itemcomment, $categorylist, $videoservertype, $smallvideocode, $videotags);
  return $renderresult;
 }
}
 
function ku6embed($vcode, $vthumb, $downloadcachingnotimeout, $downloadcachingtimeout, $pro, $catid, $setwidth = null, $setheight = null)
{
 global $mosConfig_absolute_path, $mosConfig_live_site;
 require($mosConfig_absolute_path . ‘/administrator/components/com_seyret/seyret_config.php’);
 
 $dlink = “”;
 $unexpectederror = “”;
 $fullmd5cachefile = “”;
 $vdlink = “”;
 
 $vcode = jalemurldecode($vcode);
 
 $vidwindow = mosGetParam($_REQUEST, ‘vidwindow’, null);
 if ($vidwindow == “popup”) {
  $videowidth = $popupvideowidth;
  $videoheight = $popupvideoheight;
 }
 
 if ($setwidth > 0 AND $setheight > 0) {
  $videowidth = $setwidth;
  $videoheight = $setheight;
 }
 
 $pos404 = strpos($vdlink, “NotFound”);
 $unexpectederror = “”;
 if (!file_exists($fullmd5cachefile) AND $vdlink == “”) $unexpectederror = “1″;
 if ($pos404 > 0) $unexpectederror = “1″;
 
 if ($pro <> “1″ OR $unexpectederror == “1″) {
  $embedvideo = ‘
<object width=”‘.$videowidth.’” height=”‘.$videoheight.’”>
<param name=”movie” value=”http://player.ku6.com/refer/’.$vcode.’/v.swf”></param>
<param name=”allowScriptAccess” value=”always”></param>
<param name=”wmode” value=”transparent”></param>
<embed src=”http://player.ku6.com/refer/’.$vcode.’/v.swf” type=”application/x-shockwave-flash” width=”‘.$videowidth.’” height=”‘.$videoheight.’” allowFullScreen=”true” wmode=”transparent” allowScriptAccess=”always”></embed>
</object>
  ’;
 }
 
 return $embedvideo;
}
 
function ku6generatevideodownloadlink($vcode, $pro, $dltask)
{
 global $database, $mosConfig_live_site, $mosConfig_absolute_path;
 
 $vtype = “youku”;
 
 $database->setQuery(”SELECT joomlaalemuserid FROM #__seyret_check”);
 $check = $database->loadObjectList();
 foreach ($check as $check) {
  $joomlaalemuserid = $check->joomlaalemuserid;
 }
 $siteforjoomlaalem = $mosConfig_live_site;
 $siteforjoomlaalem = jalemurlencode($siteforjoomlaalem);
 
 if ($pro == “1″) {
  $pro_file = $mosConfig_absolute_path . “/administrator/components/com_seyret/sql/pro/spphp.php”;
  require_once($pro_file);
  $str = generateprodlink($vtype, $vcode);
 
  $pos = strpos($str, “<prolink>”) + 9;
  $post = strpos($str, “</prolink>”) - $pos;
  $dlink = substr($str, $pos, $post);
 
  $pos = strpos($str, “<dltype>”) + 8;
  $post = strpos($str, “</dltype>”) - $pos;
  $dtype = substr($str, $pos, $post);
 
  if ($dltask <> “embed”) {
   if ($dtype == “script”) {
    $downlink = “<script>self.location = \”" . $dlink . “\”;</script>”;
   } else if ($dtype == “save”) {
    $downlink =<a href=\”" . $dlink . “\”>” . _RIGHTCLICKANDSAVE . “</a>”;
   }
   return $downlink;
  } else {
   return $str;
  }
 } else {
  $func = “generatedownloadlink”;
  $link = “http://www.joomla-alem.com/index2.php?option=com_joomlaalem&no_html=1&task=” . $func . “&siteinfo=” . $siteforjoomlaalem . “&jalemuserid=” . $joomlaalemuserid . “&vtype=” . $vtype . “&vcode=” . $vcode;
  $videodownloadlink = jalem_file_get_contents($link);
  return $videodownloadlink;
 }
}
 
?>

About this blog

致谢:
本博客近日收到第一笔捐赠 200元 人民币。
一旦捐赠人愿意公开昵称或姓名,将开设专门页面记录。


关注WEB应用系统架构,侧重效能、可用性研究。欢迎访问treeber.com查看本站整理自网络的非原创精华(筹建中)。