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
<?php
/**
* Content code
* All rights reserved
* Seyret Component is Free Software
* Released under GNU/GPL License : http://www.gnu.org/copyleft/gpl.html
* by kolidon
* @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 tudougetvideodetails($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://www.tudou.com/programs/view/HwIYJQczma4/
 if ($reqtype ==new) {
  $vidlink = jalemurldecode($vidlink);
  $smallvideocode = str_replace(”http://www.tudou.com/programs/view/“, “”, $vidlink);
  $smallvideocode = str_replace(/, “”, $smallvideocode);
 } else if ($reqtype == “refresh”) {
  if ($vidlink == “”) {
   $vidlink = “http://www.tudou.com/programs/view/” . $existingcode . “/”; //trytoguess
  }
 }
 
 $videoservertype = “tudou”;
 $str = jalem_file_get_contents($vidlink);
 $str = mb_convert_encoding($str, “UTF-8, “GBK”);
 
 /*
 <div id=”player”>
  <div id=”playerObject”><h1>呼吸音 医学</h1></div>
 </div>
    */
 $pattern0 =<div id=”playerObject”><h1>([^<]*)</h1></div>’;
 if(mb_eregi($pattern0, $str, $arr_title))
  $videotitle = $arr_title[1];
 
 $pattern0 =<ul class=\”info\”>.*?<li>标签:(<a href=[^>]*>[^<]+</a> ){0,10}</li>”;
 if(mb_eregi($pattern0, $str, $arr_videotags)){
 
  $videotags = mb_ereg_replace(”标签:”,",strip_tags($arr_videotags[0]));
 }
 
 $pattern0 = ‘<div id=”memos”>([^<]*)</div>’;
 if(mb_eregi($pattern0, $str, $arr_itemcomment))
  $itemcomment = $arr_itemcomment[1];
 
 //http://so.tudou.com/isearch.do?kw=%B0%AC%BE%C4
 /*
<a class=”inner” target=”new” title=”艾灸” href=”http://www.tudou.com/programs/view/zlAJthrl9sQ/“>
               <img width=”120″ height=”90″ class=”pack_clipImg” alt=”艾灸” src=”http://i01.img.tudou.com/data/imgs/i/021/628/123/p.jpg”/></a></div>
                <div class=”txt”>
                             <h6 class=”caption”><a title=”艾灸” href=”http://www.tudou.com/programs/view/zlAJthrl9sQ/” target=”new”><span class=’highlight’>艾</span><span class=’highlight’>灸</span></a>
            </h6>
 
                 <ul class=”info”>
         <li>时长: 01:18</li>
 */
 
 $vidlink2 = ‘http://so.tudou.com/isearch.do?kw=’ . $videotitle;
 $vidlink2 = mb_convert_encoding($vidlink2, “GBK”, “UTF-8″);
 $str2 = jalem_file_get_contents($vidlink2);
 $str2 = mb_convert_encoding($str2, “UTF-8″, “GBK”);
 $pattern0 = ‘<a class=”inner” .*? title=”‘.$videotitle.’” href=”http://www.tudou.com/programs/view/’.$smallvideocode.’/”>[^\f]*?<img .*? src=”([^"]*)[^\f]*?时长:(.*?)</li>’;
 if(mb_eregi($pattern0, $str2, $arr_thumb)) {
 
  $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”) {
  // 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 tudouembed($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://www.tudou.com/v/’.$vcode.’”></param>
<param name=”allowScriptAccess” value=”always”></param>
<param name=”wmode” value=”transparent”></param>
<embed src=”http://www.tudou.com/v/’.$vcode.’” type=”application/x-shockwave-flash” width=”‘.$videowidth.’” height=”‘.$videoheight.’” allowFullScreen=”true” wmode=”transparent” allowScriptAccess=”always”></embed>
</object>
  ’;
 }
 
 return $embedvideo;
}
 
function tudougeneratevideodownloadlink($vcode, $pro, $dltask)
{
 global $database, $mosConfig_live_site, $mosConfig_absolute_path;
 
 $vtype = “tudou”;
 
 $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;
 }
}
?>