Guest User

PopupStatusDailymotion.js

a guest
May 9th, 2015
365
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 19.84 KB | None | 0 0
  1. //【登録場所】リンク、URLExec
  2. //【ラベル】Dailymotion動画情報
  3. //【内容】Dailymotion動画情報のポップアップ
  4. //【コマンド】${SCRIPT:FrxS} PopupStatusDailymotion.js
  5. //【URLExec*】h?ttps?://(?:\w+\.)?dailymotion\.com/video/([^_]+).* $& ${V2CSCRIPT:FrxS} PopupStatusDailymotion.js
  6. //【URLExec*(短縮URL用)】h?ttps?://dai\.ly/([\w\-\.]+) $& ${V2CSCRIPT:FrxS} PopupStatusDailymotion.js
  7. //【更新日時】2015/05/09 PopupStatusyoutube.jsを流用してひな型化
  8. //【スクリプト】
  9. //【他サイトへの適用】① 追加するサービス用にPopupStatusDailymotion.jsとPopupStatusDailymotionフォルダをコピペし、
  10. // PopupStatusサービス名.jsとPopupStatusサービス名フォルダを作成
  11. // ② var provider にサービス名を設定、ポップアップテンプレートフォルダ「PopupStatusXXXXXX」の「XXXXXX」になる
  12. // ③ var longUrl にurlの正規表現を記載、  (\w+)は(\\w+)と書かないとダメな模様
  13. // h?、s? : hが無いか、1つある sが無いか、1つある
  14. // .* : 文字(半角空白を)含むが0個以上連続する
  15. // (?:\w+\.)? : 『「半角英数字」か「_」の連続(順序問わず)+「.」』(「www.」とか「video2sv.」とか)が無いか、1つある(このjsの場合はwww.)
  16. // ([^_]+) : 「_」が出てくるまでの何かの文字の羅列(「/abcdefg_あいうえお」の「abcdefg」、このjsの場合は動画のID)
  17. // ④ var shortUrl に短縮urlの正規表現を記載、RegExpでは([\w\-\.]+)は([\\w\\-\.]+)と書かないとダメな模様
  18. // ([\\w\\-\.]+):『「半角英数字」か「_」か「-」か「.」の連続(順序問わず)』が1つある(このjsの場合は動画のID)
  19. // ⑤ 動画ページのhtmlを解析しitempropを頼りに、getInfoFromPageを修正
  20. // ⑥ ③と④の正規表現でURLExec2.txtにPopupStatusサービス名.jsの定義を追加、([\\w\\-\.]+)は([\w\-\.]+)とする
  21.  
  22. // 実行時間計測用
  23. // var odate = new Date;
  24.  
  25. // ============ 設定ここから ============
  26. var provider = 'Dailymotion';
  27. var longUrl = new RegExp('h?ttps?://(?:\w+\.)?dailymotion\.com/video/([^_]+).*', 'i');
  28. var shortUrl = new RegExp('h?ttps?://dai\.ly/([\\w\\-\.]+)', 'i');
  29.  
  30. var closePopup = true;// リンククリックでポップアップを閉じるかどうか
  31. var browseExt = false;// リンククリック時、外部ブラウザで開くかどうか(urlExecが優先)
  32. var urlExec = true;// リンククリック時、URLExec.datの設定に従うかどうか
  33. var browserPath = 'C:/Program Files/Internet Explorer/iexplore.exe';//URLEcex.datの設定に従うときに使用する規定のブラウザのパス(「\」は「/」に置換してください)
  34. var zeroDate = true;// 日付の桁揃えをするかどうか
  35. var zeroTime = true;// 時間の桁揃えをするかどうか
  36. var commentMax = 500;// 表示する投稿者コメントの最大文字数(0で無制限)
  37. var formatType = 2;// 数値のフォーマット(0:なし 1:3桁カンマ区切り 2:日本語表記)
  38. var tagSeparater = ' ';//タグの区切り文字(半角スペースは )
  39. var maxPopupWidth = 500;// ポップアップの最大横幅
  40. var closeOnMouseExit = true;// ポップアップからマウスカーソルを外した時、自動的に閉じるかどうか
  41. var errorPopup = true;// エラーの時、エラー内容をポップアップとして表示
  42. var ratingBarWidth = 150;// レーティングバーの長さ(単位pxを想定)
  43. var downloaderPath = '';// ダウンローダのパス(「\」は「/」に置換してください)
  44. var downloaderArgs = '$PSYURL';// ダウンローダに渡す引数($PSYURLを動画URLに置換して渡します)
  45. var popupFocusable = true;// ポップアップの文字列を選択できるようにするかどうか
  46. // ============ 設定ここまで ============
  47.  
  48. var info = [];
  49. v2c.setStatus('PopupStatus' + provider + 'スクリプト実行中...');
  50. PopupStatus();
  51.  
  52. // v2c.print( '実行時間:'+ (new Date - odate) + 'msec\n' );
  53.  
  54. // リンククリック時に呼ばれる関数
  55. function redirectURL( u ) {
  56. if ( u ) {
  57. // ポップアップを再度開く
  58. if ( !closePopup ) {
  59. v2c.context.setPopupHTML( html );
  60. v2c.context.setMaxPopupWidth( maxPopupWidth );
  61. v2c.context.setRedirectURL( true );
  62. v2c.context.setPopupID( info.vid );
  63. v2c.context.setPopupFocusable( popupFocusable );
  64. }
  65. // URLExec
  66. if ( urlExec ) {
  67. v2c.println('teste');
  68. var f = openURLExec( u );
  69. if (f) return;
  70. }
  71. // 外部ブラウザで開く
  72. if ( browseExt ) {
  73. v2c.println('teste');
  74. v2c.browseURLExt( u );
  75. }
  76. // JDICがあれば内部ブラウザで開く
  77. else{
  78. v2c.browseURL( u );
  79. }
  80. }
  81. return;
  82. }
  83.  
  84. function formSubmitted ( u, sm, sd ) {
  85. var data = '';
  86. if ( sd.match( /(.+)=.+/i ) ) {
  87. var data = RegExp.$1;
  88. data = decodeURIComponent(data);
  89. switch (data) {
  90. case 'Fix':
  91. v2c.context.closeOriginalPanel();
  92. closePopup = true;
  93. v2c.context.setPopupHTML( html );
  94. v2c.context.setCloseOnLinkClick( false )
  95. v2c.context.setCloseOnMouseExit( false );
  96. v2c.context.setMaxPopupWidth( maxPopupWidth );
  97. v2c.context.setTrapFormSubmission( true );
  98. v2c.context.setRedirectURL( true );
  99. v2c.context.setPopupID( info.vid );
  100. v2c.context.setPopupFocusable( popupFocusable );
  101. break;
  102. case 'DL':
  103. if ( downloaderPath ) {
  104. downloaderArgs = downloaderArgs.replace( /\$PSYURL/, info.url );
  105. v2c.exec( [ downloaderPath, downloaderArgs ] );
  106. } else {
  107. v2c.alert( 'ダウンローダーのパスを設定してください' );
  108. }
  109. break;
  110. case 'Ext':
  111. // 外部ブラウザボタンクリック時、
  112. // ポップアップを閉じない場合はこの下の行をコメントアウト
  113. v2c.context.closeOriginalPanel();
  114. v2c.browseURLExt( info.url );
  115. break;
  116. case 'CopyTitle':
  117. v2c.context.setClipboardText( info.title );
  118. break;
  119. case 'CopyURL':
  120. v2c.context.setClipboardText( info.url );
  121. break;
  122. case 'CopyTytle+URL':
  123. v2c.context.setClipboardText( info.title + '\n' + info.url );
  124. break;
  125. case 'CopyInfo':
  126. var str = info.title + '\n'
  127. + info.url + '\n'
  128. + '再生時間:' + info.time
  129. + '\n投稿者名:' + info.name
  130. + '\n投稿日時:' + info.ye + '/' + info.mo + '/' + info.da + ' ' + info.ho + ':' + info.mi + ':' + info.se
  131. + '\n再生回数:' + info.viewCount
  132. + '回\nお気に入り:' + info.favCount
  133. + '\n評価:高評価 ' + info.like + ' 人、低評価 ' + info.dislike + ' 人';
  134. v2c.context.setClipboardText( str );
  135. break;
  136. }
  137. }
  138. return;
  139. }
  140.  
  141. function PopupStatus() {
  142. info.vid = ''; // 動画ID
  143. info.url = ''; // 動画URL
  144. info.thumb = ''; // サムネイルURL
  145. info.title = ''; // 動画タイトル
  146. info.date = ''; // 投稿日時
  147. info.ye = ''; // 西暦
  148. info.mo = ''; // 月
  149. info.da = ''; // 日
  150. info.ho = ''; // 時
  151. info.mi = ''; // 分
  152. info.se = ''; // 秒
  153. info.ms = ''; // ミリ秒 ※多分常に0
  154. info.name = ''; // 投稿者名
  155. info.uri = ''; // 投稿者URI
  156. info.keywords = 'なし'; // キーワード(タグ)
  157. info.time = ''; // 再生時間
  158. info.viewCount = '0'; // 再生回数
  159. info.favCount = '0'; // お気に入り数
  160. info.comment = '説明はありません'; // 投稿者コメント
  161. info.like = 0; // 高評価
  162. info.dislike = 0; // 低評価
  163. info.likeWidth = 0; // 高評価バーの長さ
  164. info.state = ''; // エラー情報
  165.  
  166. // ポップアップIDの初期化
  167. var pid = 'idstring';
  168.  
  169. // URLオブジェクトの取得
  170. var url = v2c.context.link;
  171. info.url = url;
  172.  
  173. // URLオブジェクトがあるかどうかの確認
  174. if ( !url ) {
  175. v2c.print( 'URL取得失敗\n\n' );
  176. if ( errorPopup ) onErrorPopup( 'URL取得失敗' );
  177. return;
  178. }
  179.  
  180. // URLが妥当かどうか
  181. if ( url.toString().match(longUrl) ) {
  182. info.vid = RegExp.$1;
  183. } else if ( url.toString().match(shortUrl) ) {
  184. info.vid = RegExp.$1;
  185. }
  186. else{
  187. if ( errorPopup ) onErrorPopup( provider + 'のURLではない' );
  188. v2c.print( 'Error:' + provider + 'のURLではない\n' );
  189. return;
  190. }
  191.  
  192. // VIDEO_ID取得失敗
  193. if ( !info.vid ) {
  194. v2c.print( 'Error:VIDEO_ID取得失敗\n' + url + '\n' );
  195. if ( errorPopup ) onErrorPopup( 'VIDEO_ID取得失敗' );
  196. return;
  197. }
  198.  
  199. // 同じURLのポップアップを開いていたら終了
  200. if ( v2c.context.getPopupOfID( info.vid ) ) {
  201. v2c.print( 'Error:同じURLのポップアップ\n' );
  202. return;
  203. }
  204.  
  205. getInfoFromPage(info);
  206.  
  207. // 投稿日時をUTC→ローカル時間に ISO8601形式 例:2010-01-01T00:00:00.000Z
  208. if( info.date.match( /(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2})\.(\d{3})Z/ ) ) {
  209. var dd = new Date( RegExp.$1, RegExp.$2, RegExp.$3, RegExp.$4, RegExp.$5, RegExp.$6, RegExp.$7 );
  210. info.ye = dd.getUTCFullYear().toString();
  211. info.mo = dd.getUTCMonth().toString();
  212. info.da = dd.getUTCDate().toString();
  213. info.ho = dd.getUTCHours().toString();
  214. info.mi = dd.getUTCMinutes().toString();
  215. info.se = dd.getUTCSeconds().toString();
  216. info.ms = dd.getUTCMilliseconds().toString();
  217.  
  218. // 12月=0月?
  219. if ( info.mo==0 ) {
  220. info.mo = '12';
  221. }
  222.  
  223. // 日付の桁揃え
  224. if ( zeroDate ) {
  225. info.mo = zeroPlus( info.mo );
  226. info.da = zeroPlus( info.da );
  227. }
  228.  
  229. // 時間の桁揃え
  230. if ( zeroTime ) {
  231. info.ho = zeroPlus( info.ho );
  232. info.mi = zeroPlus( info.mi );
  233. info.se = zeroPlus( info.se );
  234. }
  235. }
  236.  
  237. // // キーワードにリンクを付ける
  238. // info.keywords = info.keywords.replace( ' ', '' );
  239. // info.keywords = info.keywords.replace( ' ', '' );
  240. // tmp = info.keywords.split( ',' );
  241. // if ( info.keywords != 'なし' ) {
  242. // info.keywords = '';
  243. // for ( i = 0; i < tmp.length; i++ ) {
  244. // info.keywords = info.keywords
  245. // + '<a href="http://www.youtube.com/results?search_query='
  246. // + encodeURIComponent( tmp[i] ) + '&search=tag">'
  247. // + tmp[i] + '</a>' + tagSeparater;
  248. // }
  249. // }
  250.  
  251. // 再生時間の整形
  252. info.time = zeroPlus( parseInt( info.time / 3600 ) ) + ':'
  253. + zeroPlus( parseInt ( ( info.time % 3600 ) / 60 ) ) + ':'
  254. + zeroPlus( ( info.time % 3600 ) % 60 );
  255.  
  256. // コメントの文字数制限の適用
  257. // コメントをjavascriptのString形式に変換
  258. info.comment += '';
  259. if ( commentMax ) {
  260. tmp = info.comment;
  261. tmp2 = 0;
  262. reg = new RegExp( '(https?:\/\/[\-_\.!~*\'\(\)a-zA-Z0-9;\/\?:\@&=?+\$,%#]+)', 'i' );
  263. // コメント中のURLが途中で切れないようにするための処理
  264. while(1){
  265. if( tmp.match( reg ) ) {
  266. tmp2 = tmp2 + RegExp.leftContext.length + RegExp.$1.length;
  267. if( tmp2 > commentMax ){
  268. commentMax = tmp2;
  269. break;
  270. }
  271. tmp = RegExp.rightContext;
  272. }
  273. else{
  274. break;
  275. }
  276. }
  277. // コメントのカット
  278. if ( info.comment.length > commentMax ) {
  279. info.comment = info.comment.slice( 0, commentMax ) + ' ...';
  280. }
  281. }
  282. // コメントにリンクを付ける
  283. tmp = info.comment;
  284. info.comment = '';
  285. while (1) {
  286. if ( tmp.match( reg ) ) {
  287. info.comment = info.comment + RegExp.leftContext
  288. + '<a href="' + RegExp.$1 + '">' + RegExp.$1 + '</a>';
  289. tmp = RegExp.rightContext;
  290. }
  291. else {
  292. info.comment += tmp;
  293. break;
  294. }
  295. }
  296.  
  297. // 数値の整形
  298. info.viewCount = formatNum( info.viewCount, formatType );
  299. info.favCount = formatNum( info.favCount, formatType );
  300.  
  301. // 置換文字に「$」が入っているとエラーが出る問題の修正
  302. info.title = (info.title+'').replace( /\$/g, '$' );
  303. info.comment = (info.comment+'').replace( /\$/g, '$' );
  304. info.keywords = (info.keywords+'').replace( /\$/g, '$' );
  305.  
  306. // エラーの場合コメントにエラーの理由を設定
  307. if ( !info.thumb && info.state ) {
  308. if ( errorPopup ) onErrorPopup( info.state );
  309. v2c.print( 'Error:' + info.state + '\n' );
  310. return;
  311. }
  312.  
  313. // テンプレートを読み込み
  314. var fs = java.io.File.separator;
  315. html = v2c.readFile( v2c.saveDir + fs + 'script' + fs + 'PopupStatus' + provider
  316. + fs + 'template.txt' );
  317.  
  318. // デバッグ用 変数出力
  319. //for ( i in info ) { v2c.print( 'info.' + i + ' = ' + info[i] + '\n' ); }
  320.  
  321. // パラメータの置換
  322. html = html.replaceAll( '%vid%', info.vid )
  323. .replaceAll( '%thumb%', info.thumb )
  324. .replaceAll( '%title%', info.title )
  325. .replaceAll( '%ye%', info.ye )
  326. .replaceAll( '%mo%', info.mo )
  327. .replaceAll( '%da%', info.da )
  328. .replaceAll( '%ho%', info.ho )
  329. .replaceAll( '%mi%', info.mi )
  330. .replaceAll( '%comment%', info.comment )
  331. .replaceAll( '%name%', info.name )
  332. .replaceAll( '%uri%', info.uri )
  333. .replaceAll( '%keywords%', info.keywords )
  334. .replaceAll( '%time%', info.time )
  335. .replaceAll( '%viewCount%', info.viewCount )
  336. .replaceAll( '%favCount%', info.favCount )
  337. .replaceAll( '%movie%', url )
  338. .replaceAll( '%like%', info.like )
  339. .replaceAll( '%dislike%', info.dislike )
  340. .replaceAll( '%likeWidth%', info.likeWidth );
  341.  
  342. // ポップアップの設定
  343. v2c.context.setPopupHTML( html );
  344. v2c.context.setMaxPopupWidth( maxPopupWidth );
  345. v2c.context.setCloseOnMouseExit( closeOnMouseExit );
  346. v2c.context.setTrapFormSubmission( true );
  347. v2c.context.setRedirectURL( true );
  348. v2c.context.setPopupID( info.vid );
  349. v2c.context.setPopupFocusable( popupFocusable );
  350. }
  351.  
  352. // 桁揃え関数
  353. function zeroPlus( str ) {
  354. return ( '0' + str ).slice( -2 );
  355. }
  356.  
  357. // フォーマット関数
  358. function formatNum( num, type ) {
  359. var str = java.lang.String.valueOf(num);
  360. var tmp = new Array();
  361. var mod,i;
  362. // 3桁カンマ区切り
  363. if ( type == 1 ) {
  364. mod = str.length() % 3;
  365. if ( mod ) {
  366. tmp.push( str.substring( 0, mod ) );
  367. }
  368. for ( i = 0; i < parseInt( str.length() / 3 ); i++) {
  369. tmp.push( str.substring( mod, mod + 3 ) );
  370. mod += 3;
  371. }
  372. return tmp.join(',');
  373. }
  374. // 日本語表記、億まで対応
  375. if ( type == 2 ) {
  376. mod = str.length() % 4;
  377. // 億以上
  378. if ( 2 <= parseInt( str.length() / 4 ) ){
  379. if ( mod ) {
  380. tmp.push( str.substring( 0, mod ) + '億' );
  381. }
  382. if ( str.substring( mod, mod + 4 ).match( /0{0,3}([1-9](\d+)?)/ ) ) {
  383. tmp.push( RegExp.$1 + '万' );
  384. }
  385. if ( str.substring( mod + 4, mod + 8 ).match( /0{0,3}([1-9](\d+)?)/ ) ) {
  386. tmp.push( RegExp.$1 );
  387. }
  388. }
  389. // 億未満、万以上
  390. else if ( 1 <= parseInt( str.length() / 4 ) ) {
  391. if ( mod ) {
  392. tmp.push( str.substring( 0, mod ) + '万' );
  393. }
  394. if ( str.substring( mod, mod + 4 ).match( /0{0,3}([1-9](\d+)?)/ ) ) {
  395. tmp.push( RegExp.$1 );
  396. }
  397. }
  398. // 万未満
  399. else {
  400. tmp.push( str );
  401. }
  402. return tmp.join('');
  403. }
  404. // そのまま
  405. else {
  406. return str;
  407. }
  408. }
  409.  
  410. function onErrorPopup( errStr, vid ) {
  411. if ( !vid ) vid = 'None';
  412. v2c.context.setPopupText( errStr );
  413. v2c.context.setMaxPopupWidth( maxPopupWidth );
  414. v2c.context.setCloseOnMouseExit( true );
  415. v2c.context.setTrapFormSubmission( false );
  416. v2c.context.setRedirectURL( false );
  417. v2c.context.setPopupID( 'PSY_' + vid );
  418. }
  419.  
  420. function openURLExec( url ) {
  421. var url = new java.lang.String( url );
  422. var fs = java.io.File.separator;
  423. var tmp = v2c.readFile( v2c.saveDir + fs + 'URLExec.dat', 'Shift-JIS' );
  424. if ( !tmp ) {
  425. v2c.println( 'URLExec.datが見つかりませんでした' );
  426. return false;
  427. }
  428. var lines = tmp.split( '\n' );
  429. var ptn = java.util.regex.Pattern.compile("^(?<!;|'|//)([^\t]+\t){2}[^\t]+$");
  430. for( var i=0,len=lines.length; i<len; i++ ) {
  431. var matcher = ptn.matcher(lines[i]);
  432. if ( matcher.matches() ) {
  433. //v2c.println( '有効行:' + matcher.group(0) );
  434. } else {
  435. //v2c.println( '!無効行:' + lines[i] );
  436. continue;
  437. }
  438.  
  439. var matchFlg = false;
  440. var item = lines[i].split( '\t' );
  441. if ( item.length != 3 ) { // 念のため
  442. v2c.println( 'Tabの数が不正:' + (item.length-1) );
  443. continue;
  444. }
  445. item[1] = (new java.lang.String(item[1])).replaceAll( '\\$&', '\\$0' );
  446.  
  447. try {
  448. var ptn2 = java.util.regex.Pattern.compile(item[0]);
  449. } catch( e ) { // 不正な正規表現を無視
  450. v2c.println( e );
  451. continue;
  452. }
  453. if ( ptn2.matcher(url).find() ) {
  454. matchFlg = true;
  455. url = url.replaceFirst( item[0], item[1] );
  456. break;
  457. }
  458. }
  459. if ( !matchFlg ) {
  460. v2c.println( 'URLExec.dat:マッチなし\n' + url );
  461. return false;
  462. }
  463.  
  464. var cmds = item[2].split( ' ' );
  465. if ( cmds.length == 0 ) {
  466. v2c.println( 'URLExec.dat:コマンドがありません' );
  467. return false;
  468. }
  469. for ( i=0; i<cmds.length; i++ ) {
  470. var matcher = java.util.regex.Pattern.compile('\\$VIEW').matcher(cmds[i]);
  471. if ( matcher.find() ) {
  472. if ( i==0 ){
  473. v2c.println( 'URLExec.dat:無効なキーワード"$VEIW"' );
  474. return false;
  475. }
  476. }
  477.  
  478. // $BROWSER
  479. if ( browserPath ) {
  480. cmds[i] = cmds[i].replaceAll( '\\$BROWSER', browserPath );
  481. } else {
  482. // ブラウザを指定していない場合で、更にURLExec.datのコマンドが、
  483. // ブラウザにURLを渡すだけの場合はデフォルト外部ブラウザで開く(応急処置)
  484. if( item[2].matches( '"?\\$BROWSER"? "?\\$(URL|LINK)"?' ) ) { //完全一致
  485. v2c.browseURLDefExt(url);
  486. v2c.println( 'cmd='+item[2] );
  487. return true;
  488. }
  489. }
  490.  
  491. // $LINK 置換しない場合は、この下の行をコメントアウト
  492. cmds[i] = cmds[i].replaceAll( '\\$LINK', url );
  493.  
  494. // $URL 置換しない場合は、この下行をコメントアウト
  495. cmds[i] = cmds[i].replaceAll( '\\$URL', url );
  496.  
  497. // $BASEPATH
  498. if ( i==0 ) { // コマンドの場合
  499. cmds[i] = cmds[i].replaceAll( '\\$BASEPATH', v2c.saveDir.toString()
  500. .replaceAll( '\\\\', '/' ) + '/' );
  501. } else { // 引数の場合
  502. cmds[i] = cmds[i].replaceAll( '\\$BASEPATH', v2c.saveDir.toString()
  503. .replaceAll( '\\\\', '\\\\\\\\' ) + '\\\\' );
  504. }
  505.  
  506. // $POSX $POSY
  507. var p = v2c.context.mousePos;
  508. if ( p ) {
  509. cmds[i] = cmds[i].replaceAll( '\\$POSX', p.x );
  510. cmds[i] = cmds[i].replaceAll( '\\$POSY', p.y );
  511. }
  512. v2c.println( 'cmd['+i+']='+cmds[i] );
  513. }
  514. v2c.exec(cmds);
  515. return true;
  516. }
  517.  
  518. //動画ページ から情報を取得
  519. function getInfoFromPage(info){
  520. //動画ページ情報を取得(動画ページのhtmlを解析してinfo.xxxに埋め込む)
  521.  
  522. var hr = v2c.createHttpRequest(info.url);
  523. var html = (hr.getContentsAsString()+'').replace(/\n|\r/gi, '');
  524. if(!(html.match( /itemprop="name" content="([^"]+)/))){
  525. info.thumb = 'http://s2.dmcdn.net/no-such-asset/320x240-XAN.jpg';
  526. info.title = info.url;
  527. info.comment = '動画が存在しません';
  528. return;
  529. }else{
  530. info.title = RegExp.$1;
  531. }
  532. if(html.match( /itemprop="thumbnail".+?href="([^"]+)/)){
  533. info.thumb = RegExp.$1;
  534. }
  535. if(html.match( /itemprop="author.+?>(.+?<\/div>)/)){
  536. var author = RegExp.$1;
  537. if(author.match( /itemprop="name" content="([^"]+)/)){
  538. info.name = RegExp.$1;
  539. }
  540. if(author.match( /itemprop="url" href="([^"]+)/)){
  541. info.uri = RegExp.$1;
  542. }
  543. }
  544. if(html.match( /itemprop="uploadDate" content="([^T]+)/)){
  545. info.date = RegExp.$1 + 'T09:00:00.000Z';
  546. }
  547. info.keywords = 'なし';// キーワード(タグ)
  548. if(html.match( /itemprop="duration" content="([^"]+)/)){
  549. info.time = RegExp.$1;
  550. }
  551. var temp = info.time.split(/[A-Z]/gi);
  552. info.time = 0;
  553. var cnt = 0;
  554. for(var hms=temp.length-1; hms>=0; hms--){
  555. if(temp[hms] != ''){
  556. info.time = info.time + (cnt==0?Number(temp[hms]):cnt*60*Number(temp[hms]));
  557. cnt++;
  558. if(cnt>=3) break;
  559. }
  560. }
  561. if(html.match( /itemprop="interactionCount" content="UserPlays:([^"]+)/)){
  562. info.viewCount = RegExp.$1;
  563. }
  564. info.favCount = "0";
  565. if(html.match( /itemprop="description" content="([^"]+)/)){
  566. info.comment = RegExp.$1;
  567. }
  568. info.like = 0;
  569. info.dislike = 0;
  570. info.likeWidth = 0; // 高評価バーの長さ
  571. info.state = ''; // エラー情報
  572. }
Add Comment
Please, Sign In to add comment