....................................../////.===Shadow-Here===./////................................................ > < > < > < > < > < > < > < > < > < > < > < > < > < > < > < > < > < > < > < > < > < > < > < > < > < > < > < > < > < ------------------------------------------------------------------------------------------------------------------- /////////////////////////////////////////////////////////////////////////////////////////////////////////////////// RIFF¤ WEBPVP8 ˜ ðÑ *ôô>‘HŸK¥¤"§£±¨àð enü¹%½_F‘åè¿2ºQú³íªú`N¿­3ÿƒügµJžaÿ¯ÿ°~¼ÎùnúîÞÖô•òíôÁÉß®Sm¥Ü/ ‡ó˜f£Ùà<˜„xëJ¢Ù€SO3x<ªÔ©4¿+ç¶A`q@Ì“Úñè™ÍÿJÌ´ª-˜ÆtÊÛL]Ïq*‘Ý”ì#ŸÌÏãY]@ê`¿ /ªfkØB4·®£ó z—Üw¥Pxù–ÞLШKÇN¾AkÙTf½è'‰g gÆv›Øuh~ a˜Z— ïj*á¥t d£“uÒ ¨`K˜¹ßþ]b>˜]_ÏÔ6W—è2r4x•íÖ…"ƒÖNîä!¦å Ú}ýxGøÌ —@ ;ÆÚŠ=ɾ1ý8lªË¥ô ^yf®Œ¢u&2©nÙÇ›ñÂñŒ³ aPo['½»øFùà­+4ê“$!lövlüÞ=;N®3ð‚õ›DÉKòÞ>ÄÍ ¥ˆuߤ#ˆ$6ù™¥îЇy’ÍB¼ çxÛ;X"WL£R÷͝*ó-¶Zu}º.s¸sšXqù–DþÿvªhüïwyŸ ¯é³lÀ:KCûÄ£Ëá\…­ ~—ýóî ¼ûûÜTÓüÇy…ŽÆvc»¾×U ñ¸žþоP÷¦ó:Ò¨¨5;Ð#&#ÖúñläÿÁœ GxÉ­/ñ‡áQðìYÉtÒw޼GÔ´zàÒò ð*ëzƒ•4~H]Ø‹f ñÓÈñ`NåWçs'ÆÏW^ø¹!XžµmQ5ÃËoLœÎ: ÞËÍ¥J ù…î èo£ßPÎñ¶ž8.Œ]ʵ~5›ÙË-ù*8ÙÖß±~ ©¹rÓê‚j¶d¸{^Q'˜±Crß ÚH—#¥¥QlÀ×ëã‡DÜ«èî þ&Çæžî;ŽÏºò6ÒLÃXy&ZŒ'j‚¢Ù€IßÚù+–MGi‰*jE€‘JcÜ ÓÌ EÏÚj]o˜ Þr <¾U ûŪæÍ/šÝH¥˜b”¼ ÁñßX GP›ï2›4WŠÏà×£…íÓk†¦H·ÅíMh–*nó÷à]ÁjCº€b7<ب‹¨5車bp2:Á[UªM„QŒçiNMa#<5›áËó¸HýÊ"…×Éw¹¦ì2º–x<›»a±¸3Weü®FÝ⑱ö–î–³|LPÈ~çð~Çå‡|º kD¢µÏàÆAI %1À% ¹Ò – ”ϝS¦‰4&¶£°à Öý”û_Ò Áw°A«Å€?mÇÛgHÉ/8)á¾ÛìáöŽP í¨PŸNÙµº¦‡§Ùš"ÿ«>+ªÕ`Ê÷‡‚ß Õû˜þãÇ-PÍ.¾XV‘€ dÜ"þ4¹ ±Oú‘©t¥¦FªÄÃÄ•b‚znýu½—#cDs˜ÃiÑOˆñ×QO=*IAÊ,¶ŽZƒ;‡wøXè%EÐk:F±Ú” .Ѽ+Áu&Ç`."pÈÉw o&¿dE6‘’EqTuK@Ì¥ã™À(Êk(h‰,H}RÀIXÛš3µ1©_OqÚÒJAñ$ÊÙÜ;D3çŒ[þùœh¬Ã³™ö6ç†NY".Ú‰ï[ªŸŒ '²Ð öø_¨ÂÉ9ué¶³ÒŠõTàîMØ#û¯gN‡bÙ놚X„ö …ÉeüÌ^J ‹€.œ$Æ)βÄeæW#óüßĺŸ€ ÀzwV 9oä»f4V*uB «Ë†¹ì¯žR霓æHXa=&“I4K;¯ç‹h×·"UŠ~<•╪Vêª&ÍSÃÆÅ?ÔqÎ*mTM ˜›µwêd#[C¡©§‘D<©àb†–ÁœøvH/,í:¯( ²£|4-„Æövv„Yͼ™^Á$ˆ„¢Û[6yB.åH*V¨æ?$=˜Ñ€•ñ·­(VlŸ‘ nÀt8W÷´Bûba?q9ú¶Xƒl«ÿ\ù¶’þòUÐj/õ¢Ìµ³g$ƒÎR!¸»|Oߍë’BhîÚÑ¢ñåŒJ„®„£2Ð3•ô02Nt…!£Í]Ïc½Qÿ?ˆ<&ÃA¾Ú,JˆijÌ#5yz„‰Î|ÊŽ5QÏ:‹ÐaóVÔxW—CpeÏzÐïíçôÿÅ_[hãsÐ_/ŽTÝ?BîˆííV$<¿i>²F¬_Eß¿ †bÊŒº­ÿ®Z H“C}”¬,Mp ý/Bá£w>˜YV°aƒúh+cŠ- r/[%|üUMHäQ°X»|û/@|°¥Ð !BÔ Ç¢Ä©š+Õì D«7ìN¶ŽðÔ " ƶ’ÖçtA‰Û×}{tþz­¾GÍ›k¹OEJR$ Â׃ «ëÁ"oÉôž$oUK(Ä)Ãz³Ê-‹êN[Ò3Œñbï8P 4ƒ×q¢bo|?<ÛX¬òÄͰL–±›(™ûG?ýË©ÚÄ–ÂDØÐ_Ç¡ô ¾–ÄÏø ×e8Ë©$ÄF¹Å‹ì[©óìl:F¾f´‹‹Xì²ï®\¬ôùƒ ÿat¥óèÒùHß0äe‚;ü×h:ÆWðHž=Ã8骣"kœ'Y?³}Tûè€>?0l›e1Lòñ„aæKÆw…hÖŠùW…ÈÆÄ0ši·›[pcwËþñiêíY/~-Á5˜!¿†A›™Mÿþ(±“t@â“ö2­´TG5yé]çå僳 .·ÍïçÝ7UÚ±Ð/Nè»,_Ï ùdj7\ï Wì4›„»c¸àešg#ÒÊ⥭áØo5‘?ÌdÝô¯ ¹kzsƒ=´#ëÉK›Ø´±-¥eW?‡çßtòTã…$Ý+qÿ±ƒ÷_3Ô¥í÷:æ–ž<·Ö‡‰Å¢ š‡%Ô—utÌÈìðžgÖÀz²À—ï÷Óîäõ{K'´È÷³yaÏÁjƒô}ž§®æÊydÕÈë5¯èˆõvÕ©ã*çD„ “z„Ó‡^^xÂ3M§A´JG‚öï 3W'ˆ.OvXè¡ÊÕª?5º7†˜(˜Ç¶#çê’¶!ÌdZK§æ 0fãaN]òY³RV ™î$®K2R¨`W!1Ôó\;Ý ýB%qæK•&ÓÈe9È0êI±žeŸß -ú@žQr¦ ö4»M¼Áè¹µmw 9 EÆE_°2ó„ŸXKWÁ×Hóì^´²GѝF©óäR†¦‰ç"V»eØ<3ùd3ÿÚ¤Žú“Gi" —‘_ÙËÎ~Üö¯¥½Î»üŸEÚŽåmÞþí ;ÞólËΦMzA"Âf(´òá;Éï(/7½ûñÌ­cïÕçлþÝz¾-ÍvÑ“pH­–ðÓj$¸Äû¤‚‘ãUBË-n“2åPkS5&‹Â|+g^œ®Ì͆d!OïäîU«c;{Û!ÅŽ«ëZ9Ókóˆ]¯ƒ›né `ÇÒ+tÆš (ØKá¾—=3œ®•vuMñg²\ï Ec€ 05±d™‡×iÇ×›UúvÌ¢£Èþ¡ÕØô¶ßÎA"ß±#Ö²ˆÊŸ¦*Ä~ij|àø.-¼'»Ú¥£h ofº¦‡VsR=N½„Î v˜Z*SÌ{=jÑB‹tê…;’HžH¯8–îDù8ñ¢|Q•bÛçš–‹m³“ê¨ åÏ^m¬Žãþ©ïêO‡½6] µÆ„Ooòü ²x}N¦Ë3ïé¿»€›HA˜m%çÞ/¿í7Fø“‹léUk)É°Œµ8Q8›:ÀŠeT*šõ~ôڝG6 ¢}`ùH­–”¡k ‰P1>š†®9z11!X wKfmÁ¦xÑ,N1Q”–æB¶M…ÒÃv6SMˆhU¬ÊPŽï‘öj=·CŒ¯u¹ƒVIЃsx4’ömÛýcå¡¶7ßŠß 57^\wÒÐÆ k§h,Œý î«q^R½3]J¸ÇðN ‚çU¬ôº^Áì} ³f©Õœ§ˆã:FÄÈ‚é(€™?àýÓüè1Gô£¼éj‚OÅñ  #>×—ßtà 0G¥Åa뀐kßhc™À_ÉñÞ#±)GD" YîäË-ÿÙ̪ ¹™a¯´¢E\ÝÒö‚;™„ë]_ p8‰o¡ñ+^÷ 3‘'dT4œŽ ðVë½° :¬víÑ«£tßÚS-3¶“þ2 †üüʨòrš¹M{É_¤`Û¨0ìjœøJ‡:÷ÃáZ˜†@GP&œÑDGÏs¡þ¦þDGú‘1Yá9Ôþ¼ ûø…§÷8&–ÜÑnÄ_m®^üÆ`;ÉVÁJ£?â€-ßê}suÍ2sõA NÌúA磸‘îÿÚ»ƒìö·á¿±tÑÐ"Tÿü˜[@/äj¬€uüªìù¥Ý˜á8Ý´sõj 8@rˆð äþZÇD®ÿUÏ2ùôõrBzÆÏÞž>Ì™xœ“ wiÎ×7_… ¸ \#€MɁV¶¥üÕÿPÔ9Z‡ø§É8#H:ƒ5ÀÝå9ÍIŒ5åKÙŠ÷qÄ>1AÈøžj"µÂд/ªnÀ qªã}"iŸBå˜ÓÛŽ¦…&ݧ;G@—³b¯“•"´4í¨ôM¨åñC‹ïùÉó¯ÓsSH2Ý@ßáM‡ˆKÀªÛUeø/4\gnm¥‹ŸŒ qÄ b9ÞwÒNÏ_4Ég³ú=܆‚´ •â¥õeíþkjz>éÚyU«Íӝ݃6"8/ø{=Ô¢»G¥ äUw°W«,ô—¿ãㆅү¢³xŠUû™yŒ (øSópÐ 9\åTâ»—*oG$/×ÍT†Y¿1¤Þ¢_‡ ¼ „±ÍçèSaÓ 3ÛMÁBkxs‰’R/¡¤ˆÙçª(*õ„üXÌ´ƒ E§´¬EF"Ù”R/ÐNyÆÂ^°?™6¡œïJ·±$§?º>ÖüœcNÌù¯G ‹ñ2ЁBB„^·úìaz¨k:#¨Æ¨8LÎõލ£^§S&cŒÐU€ü(‡F±Š¼&P>8ÙÁ ‰ p5?0ÊÆƒZl¸aô š¼¡}gÿ¶zÆC²¹¬ÎÖG*HB¡O<º2#ñŒAƒ–¡B˜´É$¥›É:FÀÔx¾u?XÜÏÓvN©RS{2ʈãk9rmP¼Qq̳ è¼ÐFׄ^¡Öì fE“F4A…!ì/…¦Lƒ… … $%´¾yã@CI¬ á—3PþBÏNÿ<ý°4Ü ËÃ#ØÍ~âW«rEñw‹eùMMHß²`¬Öó½íf³:‹k˜¯÷}Z!ã¿<¥,\#öµÀ¯aÒNÆIé,Ћ–lŽ#Àæ9ÀÒS·I’½-Ïp Äz¤Š Â* ­íÄ9­< h>׍3ZkËU¹§˜ŒŠ±f­’¤º³Q ÏB?‹#µíÃ¥®@(Gs«†vI¥Mµ‹Á©e~2ú³ÁP4ìÕi‚²Ê^ö@-DþÓàlÜOÍ]n"µã:žpsŽ¢:! Aõ.ç~ÓBûH÷JCÌ]õVƒd «ú´QÙEA–¯¯Œ!.ˆˆëQ±ù œ·Ì!Õâ )ùL„ÅÀlÚè5@B…o´Æ¸XÓ&Û…O«˜”_#‡ƒ„ûÈt!¤ÁÏ›ÎÝŠ?c9 â\>lÓÁVÄÑ™£eØY]:fÝ–—ù+p{™ðè û³”g±OƒÚSù£áÁÊ„ä,ï7š²G ÕÌBk)~ÑiCµ|h#u¤¶îK¨² #²vݯGãeÖ϶ú…¾múÀ¶þÔñ‚Š9'^($¤§ò “š½{éúp÷J›ušS¹áªCÂubÃH9™D™/ZöØÁ‡¦ÝÙŸ·kð*_”.C‹{áXó€‡c¡c€§/šò/&éš÷,àéJþ‰X›fµ“C¨œ®r¬"kL‰Â_q…Z–.ÉL~O µ›zn‚¹À¦Öª7\àHµšÖ %»ÇníV[¥*Õ;ƒ#½¾HK-ÖIÊdÏEÚ#=o÷Óò³´Š: Ç?{¾+9›–‘OEáU·S€˜j"ÄaÜ ŒÛWt› á–c#a»pÔZÞdŽtWê=9éöÊ¢µ~ ë ;Öe‡Œ®:bî3±ýê¢wà¼îpêñ¹¾4 zc¾ðÖÿzdêŒÑÒŝÀ‰s6¤í³ÎÙB¿OZ”+F¤á‡3@Ñëäg©·Ž ˆèª<ù@É{&S„œÕúÀA)‰h:YÀ5^ÂÓŒ°õäU\ ùËÍû#²?Xe¬tu‰^zÒÔãë¼ÛWtEtû …‚g¶Úüâî*moGè¨7%u!]PhÏd™Ý%Îx: VÒ¦ôÊD3ÀŽKÛËãvÆî…N¯ä>Eró–ð`5 Œ%u5XkñÌ*NU%¶áœÊ:Qÿú»“úzyÏ6å-၇¾ ´ ÒÊ]y žO‘w2Äøæ…H’²f±ÎÇ.ª|¥'gîV•Ü .̘¯€šòü¤U~Ù†*¢!?ò wý,}´°ÔÞnïoKq5µb!áÓ3"vAßH¡³¡·G(ÐÎ0Îò¼MG!/ài®@—¬04*`…«é8ªøøló“ˆÊ”èù¤…ßÊoÿé'ËuÌÖ5×È¡§ˆˆfŽë9}hìâ_!!¯  B&Ëö¶‰ÀAÙNVŸ Wh›¸®XÑJì¨ú“¿÷3uj²˜¨ÍÎìë±aúŠÝå¯ð*Ó¨ôJ“yºØ)m°WýOè68†ŸÏ2—‰Ïüꪫٚ¥‹l1 ø ÏÄFjêµvÌbü¦èÝx:X±¢H=MÐß—,ˆÉÇ´(9ú¾^ÅÚ4¿m‡$âX‘å%(AlZo@½¨UOÌÕ”1ø¸jÎÀÃÃ_ µ‘Ü.œº¦Ut: Æï’!=¯uwû#,“pþÇúŒø(é@?³ü¥‘Mo §—s@Œ#)§ŒùkL}NOÆêA›¸~r½¼ÙA—HJ«eˆÖ´*¡ÓpÌŸö.m<-"³ûÈ$¬_6­åf£ïÚâj1y§ÕJ½@dÞÁr&Í\Z%D£Íñ·AZ Û³øüd/ªAi†/Й~  ‡âĮҮÏh§°b—›Û«mJžòG'[ÈYýŒ¦9psl ýÁ ®±f¦x,‰½tN ‚Xª9 ÙÖH.«Lo0×?͹m¡å†Ѽ+›2ƒF ±Ê8 7Hցϓ²Æ–m9…òŸï]Â1äN†VLâCˆU .ÿ‰Ts +ÅÎx(%¦u]6AF Š ØF鈄‘ |¢¶c±soŒ/t[a¾–û:s·`i햍ê›ËchÈ…8ßÀUÜewŒðNOƒõD%q#éû\9¤x¹&UE×G¥ Í—™$ð E6-‡¼!ýpãÔM˜ Âsìe¯ñµK¢Ç¡ùôléœ4Ö£”À Š®Ðc ^¨À}ÙËŸ§›ºê{ÊuÉC ×Sr€¤’fÉ*j!úÓ’Gsùìoîßîn%ò· àc Wp÷$¨˜)û»H ×8ŽÒ€Zj¤3ÀÙºY'Ql¦py{-6íÔCeiØp‘‡XÊîÆUߢ܂ž£Xé¼Y8þ©ëgñß}é.ÎógÒ„ÃØËø¯»™§Xýy M%@NŠ À(~áÐvu7&•,Ù˜ó€uP‡^^®=_E„jt’ 403WebShell
403Webshell
Server IP : 213.186.33.2  /  Your IP : 216.73.216.250
Web Server : Apache
System : Linux webd003.cluster102.gra.hosting.ovh.net 5.15.206-ovh-vps-grsec-zfs-classid #1 SMP Fri May 15 02:41:25 UTC 2026 x86_64
User : uneseuleoc ( 96096)
PHP Version : 7.4.33
Disable Function : _dyuweyrj4,_dyuweyrj4r,dl
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /home/uneseuleoc/www/plugins/auto/videos/v0.12.9/lib/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /home/uneseuleoc/www/plugins/auto/videos/v0.12.9/lib/Videopian.php
<?php
/**
 * Videopian
 * get everything about a video
 * 
 * -------------------------------------------------------------------
 * NEW BSD LICENSE
 * 
 * Copyright (C) 2009-2010 Upian.com and contributors
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without modification,
 * are permitted provided that the following conditions are met:
 *
 * - Redistributions of source code must retain the above copyright notice,
 *   this list of conditions and the following disclaimer.
 *
 * - Redistributions in binary form must reproduce the above copyright notice,
 *   this list of conditions and the following disclaimer in the documentation
 *   and/or other materials provided with the distribution.
 *
 * - Neither the name of Upian.com nor the names of its
 *   contributors may be used to endorse or promote products derived from this
 *   software without specific prior written permission.
 *
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 * 
 * -------------------------------------------------------------------
 * 
 * @author Denis Hovart <denis@upian.com>
 * @author Hans Lemuet <hans@upian.com>
 * @license http://opensource.org/licenses/bsd-license.php New BSD license
 * @version 0.2
 */

class Videopian_Exception extends Exception {
    # ================================================================================
    # Let's define our error messages
    # You can translate / adapt them to your project

    const GENERIC_ERROR         = 'Error while getting the video data.';
    const SERVICE_NOT_SUPPORTED = 'Please make sure the service you are trying to use is supported by Videopian';
    const API_KEY_NEEDED        = 'You need to specify an API key to grab video information from this service';
    const NOT_A_VIDEO           = 'The media you are trying to get is not a video';
    const URL_UNAVAILABLE       = 'The video you are trying to get is unavailable';
    const INFO_FILE_UNAVAILABLE = 'The information file for the video you are trying to get is unavailable';
    const WRONG_OEMBED_FORMAT   = 'Allowed formats for oEmbed are xml and json';
    const NO_HTML_PARSER        = 'You need to include simple_html_dom first to enable support of this service in Videopian';
}

class Videopian {

    # ================================================================================
    # Specify here the API keys for the services you want to use.
    # You'll need to request one for each.
    
    const VEOH_API_KEY      = '';
    const FLICKR_API_KEY    = '';
    const SEVENLOAD_API_KEY = '';
    const VIDDLER_API_KEY   = '';
    const REVVER_LOGIN      = '';
    const REVVER_PASSWORD   = '';



    # ================================================================================
    # Do not change anything under this line

    private static $url;
    private static $service;
    private static $id;
    private static $video;
    private static $oembed;
    private static $format;
    private static $max_width;
    private static $max_height;
    private static $html_parser;

    # ================================================================================
    # Process the URL to extract the service and the video id
    private static function processUrl() {
        self::$url = preg_replace('#\#.*$#', '', trim(self::$url));

        if (!preg_match('#http://#', self::$url)) self::$url = 'http://' . self::$url;

        $services_regexp = array(
            '#atom\.com.*/funny_videos/(?P<id>[^/]*)#i'                => 'atom',
            '#blip\.tv.*/file/(?P<id>[0-9]*)#i'                        => 'blip',
            '#collegehumor\.com.*/video:(?P<id>[0-9]*)#i'              => 'collegehumor',
            '#dailymotion\.com.*/(?:video|swf)/(?P<id>[^_]*)#i'        => 'dailymotion',
            '#flickr\.com.*/photos/[a-zA-Z0-9]*/(?P<id>[^/]*)#'        => 'flickr',
            '#video\.google\.[a-z]{0,5}/.*[\?&]docid=(?P<id>[^&]*)#i'  => 'googlevideo',
            '#metacafe\.com/watch/(?P<id>.[^/]*)#i'                    => 'metacafe',
            '#myspace\.com/.*[\?&]videoid=(?P<id>[^&]*)#i'             => 'myspace',
            '#revver\.com/video/(?P<id>[^/]*)#i'                       => 'revver',
            '#sevenload.com/.*/(?:videos|episodes)/(?P<id>[^-]*)#i'    => 'sevenload',
            '#veoh\.com/.*/(?P<id>[^?&]*)/?#i'                         => 'veoh',
            '#viddler\.com/explore/.*/videos/(?P<id>[0-9]*)/?#i'       => 'viddler',
            '#vimeo\.com\/(?P<id>[0-9]*)[\/\?]?#i'                     => 'vimeo',
            '#youtu\.be\/(?P<id>[a-zA-Z0-9_-]*)[\/\?]?#i'               => 'youtube',
            '#youtube\.[a-z]{0,5}/.*[\?&]?v(?:\/|=)?(?P<id>[^&]{10,12})#i'   => 'youtube'
        );
        // avant (rev 83853) était utilisé ===> '#vimeo\.com\/([0-9]*)#i' => 'vimeo',


        foreach ($services_regexp as $pattern => $service) {
            if (preg_match($pattern, self::$url, $matches)) {
                self::$service = $service;
                self::$id = $matches['id'];
            }
        }
    }

    /** checkAvailability
     * 
     * Check the availability of an URL, throwing an exception if the resource is unavailable for some reason
     * (a bit tricky but working nontheless)
     * 
     * @param $url
    */
    private static function checkAvailability($url) {

        include_spip('inc/distant');
        $headers = @recuperer_url($url, array('taille_max' => 0));
        if(!$headers['status']) throw new Videopian_Exception(Videopian_Exception::INFO_FILE_UNAVAILABLE);
        $http_status_code = $headers['status'];
        if($http_status_code > 300) throw new Videopian_Exception(Videopian_Exception::INFO_FILE_UNAVAILABLE . " ($http_status)");
        return true;
    }

    
    /**
     * url_get_contents
     *
     * <http://stackoverflow.com/questions/3979802/alternative-to-file-get-contents>
     *
     * @param $url
     * 
    */
    private static function url_get_contents($url) {
        include_spip('inc/distant');

        $url_get_contents_data = recuperer_url($url);
        
        return $url_get_contents_data['page'];
    }
    
    
    # ================================================================================
    # Fetch and return the video data
    public static function get($url, $oembed = false, $format = 'xml', $max_width = 640, $max_height = 385) {

        self::$url = $url;
        self::$oembed = $oembed;
        if($format != 'xml' && $format != 'json')
            throw new Videopian_Exception(Videopian_Exception::WRONG_OEMBED_FORMAT);
        else
            self::$format = $format;
            
        self::$max_width = $max_width;
        self::$max_height = $max_height;

        // Detecting PHP Simple HTML DOM Parser
        if (class_exists('simple_html_dom'))
            self::$html_parser = new simple_html_dom();

        self::processUrl();

        self::$video = new stdClass;
        self::$video->url = self::$url;
        self::$video->site = self::$service;
        
        if(null === self::$service)
            return self::getPageMetadata();

        $method = sprintf('get%s', ucfirst(self::$service));
        
        if (!is_callable(array(__CLASS__, $method))) {
            throw new Videopian_Exception(Videopian_Exception::SERVICE_NOT_SUPPORTED);
        }
        
        return call_user_func(array(__CLASS__, $method));
    }

    # --------------------------------------------------------------------------------
    # Check if the <head> section of the page countains the information of the video 
    public static function getPageMetadata() {

        if (null === self::$html_parser) throw new Videopian_Exception(Videopian_Exception::NO_HTML_PARSER);
        
        self::$html_parser->load_file(self::$url);
        
        if(self::$oembed) {
            switch(self::$format) {
                case 'xml' :
                $oembed_url_query = self::$html_parser->find('link[type="text/xml+oembed"]', 0);
                if($oembed_url_query) $oembed_url = $oembed_url_query->href;
                else break;
                if(self::checkAvailability($oembed_url)) return @file_get_contents($oembed_url);
                break;
        
                case 'json' :
                $oembed_url_query = self::$html_parser->find('link[type="text/json+oembed"]', 0);
                if($oembed_url_query)  $oembed_url = $oembed_url_query->href;
                else break;
                if(self::checkAvailability($oembed_url)) return @file_get_contents($oembed_url);
                break;
            }
        }
        
        // we're checking if there's a <link rel="video_src" /> on the page we loaded; otherwise we throw an exception
        // http://wiki.developers.facebook.com/index.php/Facebook_Share/Specifying_Meta_Tags
        $player_url_query = self::$html_parser->find('link[rel="video_src"]', 0);
        self::$video->player_url = $player_url_query ? $player_url_query->href : null;
        if(null === self::$video->player_url) throw new Videopian_Exception(Videopian_Exception::NOT_A_VIDEO);
        
        # Title
        $title_query = self::$html_parser->find('meta[name="title"]', 0);
        self::$video->title = $title_query ? $title_query->content : null;
        
        # Description
        $description_query = self::$html_parser->find('meta[name="description"]', 0);
        self::$video->description = $description_query ? $description_query->content : null;
        
        # Dimensions
        $width_query = self::$html_parser->find('meta[name="video_width"]', 0);
        $height_query = self::$html_parser->find('meta[name="video_height"]', 0);
        self::$video->width = $width_query ? intval($width_query->content) : null;
        self::$video->height = $height_query ? intval($height_query->content) : null;
        
        # Thumbnails
        $thumbnail_query = self::$html_parser->find('link[rel="image_src"]', 0);
        if($thumbnail_query) {
            $thumbnail = new stdClass;
            $thumbnail->url = strval($thumbnail_query->href);
            list($thumbnail->width, $thumbnail->height) = getimagesize($thumbnail->url);
            self::$video->thumbnails[] = $thumbnail;
        }
        return self::$oembed ? self::generateOEmbed() : self::$video;
    }


    
    public static function getAtom() {
        
        # since there is no API for AtomFilms, we have to parse the (pretty rich) page metadata
        if (null === self::$html_parser) throw new Videopian_Exception(Videopian_Exception::NO_HTML_PARSER);
        self::$html_parser->load_file(self::$url);
        
        # Title
        $title_query = self::$html_parser->find('meta[name="title"]', 0);
        self::$video->title = $title_query ? $title_query->content : null;

        # Description
        $description_query = self::$html_parser->find('meta[name="description"]', 0);
        self::$video->description = $description_query ? $description_query->content : null;

        # Tags
        $tags_query = self::$html_parser->find('meta[name="keywords"]', 0);
        if($tags_query) {
            $tags = explode(',', $tags_query->content);
            foreach($tags as $t) self::$video->tags[] = trim($t);
        }

        # Duration
        $duration_query = self::$html_parser->find('meta[name="duration"]', 0);
        $duration_raw = $duration_query ? $duration_query->content : null;
        preg_match('#(?:(?:(?P<hr>[0-9]*):)?(?P<min>[0-5]?[0-9]):)?(?P<sec>[0-5]?[0-9])#', $duration_raw, $matches);
        $hours = $matches['hr'] ? intval($matches['hr']) : 0;
        $minutes = $matches['min'] ? intval($matches['min']) : 0;
        $seconds = $matches['sec'] ? intval($matches['sec']) : 0;
        self::$video->duration = ($hours * 60 * 60) + ($minutes * 60) + $seconds;

        # Dimensions
        $width_query = self::$html_parser->find('meta[name="video_width"]', 0);
        self::$video->width = $width_query ? $width_query->content : null;
        $height_query = self::$html_parser->find('meta[name="video_height"]', 0);
        self::$video->height_query = $height_query ? $height_query->content : null;

        # Author & author URL
        $author_query = self::$html_parser->find('meta[name="created_by"]', 0);
        self::$video->author = $author_query ? $author_query->content : null;
        $author_url_query = self::$html_parser->find('meta[name="created_by_url"]', 0);
        self::$video->author_url = $author_url_query ? $author_url_query->content : null;

        # Publication date
        $date_published_query = self::$html_parser->find('meta[name="date_added"]', 0);
        self::$video->date_published = $date_published_query ? new DateTime(date(DATE_RSS, strtotime(strval($date_published_query->content)))) : null;

        # Thumbnails
        $thumbnail_query = self::$html_parser->find('meta[name="thumbnail_url"]', 0);
        if($thumbnail_query) {
            $thumbnail = new stdClass;
            $thumbnail->url = $thumbnail_query->content;
            list($thumbnail->width, $thumbnail->height) = getimagesize($thumbnail->url);
            self::$video->thumbnails[] = $thumbnail;
        }

        # Player URL
        $player_url_query = self::$html_parser->find('link[rel="video_src"]', 0);
        self::$video->player_url = $player_url_query ? $player_url_query->href : null;

        return self::$oembed ? self::generateOEmbed() : self::$video;
    }

    # --------------------------------------------------------------------------------
    public static function getBlip() {

        if(self::$oembed) {
            $oembed_url = 'http://blip.tv/oembed/?url='.urlencode(self::$url).'&format='.self::$format;
            if(self::checkAvailability($oembed_url)) return @file_get_contents($oembed_url);
        }

        # XML data URL
        $file_data = "http://blip.tv/file/".self::$id."?skin=rss";
        self::checkAvailability($file_data);
        self::$video->xml_url = $file_data;
        
        # XML
        $xml = new SimpleXMLElement(file_get_contents($file_data));
        
        # Title
        $title_query = $xml->xpath('/rss/channel/item/title');
        self::$video->title = $title_query ? strval($title_query[0]) : null;
        
        # Description
        $description_query = $xml->xpath('/rss/channel/item/blip:puredescription');
        self::$video->description = $description_query ? strval(trim($description_query[0])) : null;
        
        # Tags
        $tags_query = $xml->xpath('/rss/channel/item/media:keywords');
        self::$video->tags = $tags_query ? explode(', ',strval(trim($tags_query[0]))) : null;
        
        # Duration
        $duration_query = $xml->xpath('/rss/channel/item/blip:runtime');
        self::$video->duration = $duration_query ? intval($duration_query[0]) : null;
        
        # Dimensions
        $dimensions_query = $xml->xpath('/rss/channel/item/media:group/media:content[@type="video/x-flv"]');
        $dimensions_query = $dimensions_query[0]->attributes();
        self::$video->height = $dimensions_query ? intval($dimensions_query['height']) : null;
        self::$video->width = $dimensions_query ? intval($dimensions_query['width']) : null;
        
        # Author & author URL
        $author_query = $xml->xpath('/rss/channel/item/blip:user');
        self::$video->author = $author_query ? strval($author_query[0]) : null;
        $author_safe_query = $xml->xpath('/rss/channel/item/blip:safeusername');
        self::$video->author_url = 'http://'.strval($author_safe_query[0]).'.blip.tv';
        
        # Publication date
        $date_published_query = $xml->xpath('/rss/channel/item/blip:datestamp');
        self::$video->date_published = $date_published_query ? new DateTime($date_published_query[0]) : null;
        
        # Last update date
        self::$video->date_updated = null;
        
        # Thumbnails
        $thumbnail_small_query = $xml->xpath('/rss/channel/item/blip:smallThumbnail');
        if($thumbnail_small_query) {
            $thumbnail = new stdClass;
            $thumbnail->url = strval($thumbnail_small_query[0]);
            list($thumbnail->width, $thumbnail->height) = getimagesize($thumbnail->url);
            self::$video->thumbnails[] = $thumbnail;
        }
        $thumbnail_query = $xml->xpath('/rss/channel/item/media:thumbnail/@url');
        if($thumbnail_query) {
            $thumbnail = new stdClass;
            $thumbnail->url = strval($thumbnail_query[0]);
            list($thumbnail->width, $thumbnail->height) = getimagesize($thumbnail->url);
            self::$video->thumbnails[] = $thumbnail;
        }
        
        # Player URL
        $player_url_query = $xml->xpath('/rss/channel/item/blip:embedUrl');
        self::$video->player_url = $player_url_query ? strval($player_url_query[0]) : null;
        
        # FLV file URL
        $flv_url_query = $xml->xpath('/rss/channel/item/media:group/media:content[@type="video/x-flv"]/@url');
        self::$video->files['video/x-flv'] = $flv_url_query ? strval($flv_url_query[0]) : null;
        
        # MOV file URL
        $mov_url_query = $xml->xpath('/rss/channel/item/media:group/media:content[@type="video/quicktime"]/@url');
        self::$video->files['video/quicktime'] = $mov_url_query ? strval($mov_url_query[0]) : null;
        
        return self::$video;
    }
        

    # --------------------------------------------------------------------------------
    public static function getCollegehumor() {

        # XML data URL
        $file_data = 'http://www.collegehumor.com/moogaloop/video:'.self::$id;
        self::checkAvailability($file_data);
        self::$video->xml_url = $file_data;
        
        # XML
        $xml = new SimpleXMLElement(file_get_contents($file_data));
        
        # Title
        $title_query = $xml->xpath('/videoplayer/video/caption');
        self::$video->title = $title_query ? strval($title_query[0]) : false;
        
        # Description
        $description_query = $xml->xpath('/videoplayer/video/description');
        self::$video->description = $description_query ? strval(trim($description_query[0])) : false;
        
        # Tags
        $tags_query = $xml->xpath('/videoplayer/video/tags');
        if($tags_query) {
            $tags = explode(',', strval($tags_query[0]));
            foreach($tags as $t) self::$video->tags[] = trim($t);
        }
        
        # Author & author URL
        self::$video->author = null;
        self::$video->author_url = null;
        
        # Publication date
        self::$video->date_published = null;
        
        # Last update date
        self::$video->date_updated = null;
        
        # Duration
        $duration_query = $xml->xpath('/videoplayer/video/duration');
        self::$video->duration = $duration_query ? intval($duration_query[0]) : false;
        
        # Thumbnails
        $thumbnails_query = $xml->xpath('/videoplayer/video/thumbnail');
        $thumbnail = new stdClass;
        $thumbnail->url = strval($thumbnails_query[0]);
        list($thumbnail->width, $thumbnail->height) = getimagesize($thumbnail->url);
        self::$video->thumbnails[] = $thumbnail;
        
        # Player URL
        self::$video->player_url = 'http://www.collegehumor.com/moogaloop/moogaloop.swf?clip_id='.self::$id;
        
        # FLV file URL
        $flv_url_query = $xml->xpath('/videoplayer/video/file');
        self::$video->files['video/x-flv'] = $flv_url_query ? strval($flv_url_query[0]) : null;
        
        return self::$oembed ? self::generateOEmbed() : self::$video;
    }

        
    # --------------------------------------------------------------------------------
    public static function getDailymotion() {
        
        if(self::$oembed) {
            $oembed_url = 'http://www.dailymotion.com/api/oembed/?url='.urlencode(self::$url).'&format='.self::$format;
            if(self::checkAvailability($oembed_url)) return @file_get_contents($oembed_url);
        }

        # XML data URL
        $file_data = 'http://www.dailymotion.com/rss/video/'.self::$id;
        self::checkAvailability($file_data);
        self::$video->xml_url = $file_data;
        
        # XML
        $xml = new SimpleXMLElement(file_get_contents($file_data));
        
        # Title
        $title_query = $xml->xpath('/rss/channel/item/title');
        self::$video->title = $title_query ? strval($title_query[0]) : null;
        
        # Description
        $description_query = $xml->xpath('/rss/channel/item/itunes:summary');
        self::$video->description = $description_query ? strval(trim($description_query[0])) : null;
        
        # Tags
        $tags_query = $xml->xpath('/rss/channel/item/itunes:keywords');
        if($tags_query) {
            $tags = explode(',', strval($tags_query[0]));
            foreach($tags as $t) self::$video->tags[] = trim($t);
        }
        
        # Duration
        $duration_query = $xml->xpath('/rss/channel/item/media:group/media:content/@duration');
        self::$video->duration = $duration_query ? intval($duration_query[0]) : null;
        
        # Dimensions
        $dimensions_query = $xml->xpath('/rss/channel/item/media:player');
        $dimensions_query = $dimensions_query[0]->attributes();
        self::$video->height = $dimensions_query ? intval($dimensions_query['height']) : null;
        self::$video->width = $dimensions_query ? intval($dimensions_query['width']) : null;
        
        # Author & author URL
        $author_query = $xml->xpath('/rss/channel/item/dm:author');
        self::$video->author = $author_query ? strval($author_query[0]) : null;
        self::$video->author_url = 'http://www.dailymotion.com/'.self::$video->author;
        
        # Publication date
        $date_published_query = $xml->xpath('/rss/channel/item/pubDate');
        self::$video->date_published = $date_published_query ? new DateTime($date_published_query[0]) : null;
        
        # Last update date
        self::$video->date_updated = null;
        
        # Thumbnails
        $thumbnail = new stdClass;
        $thumbnail->url = 'http://www.dailymotion.com/thumbnail/320x240/video/'.self::$id;
        $thumbnail->width = 320;
        $thumbnail->height = 240;
        self::$video->thumbnails[] = $thumbnail;

        $thumbnail = new stdClass;
        $thumbnail->url = 'http://www.dailymotion.com/thumbnail/160x120/video/'.self::$id;
        $thumbnail->width = 160;
        $thumbnail->height = 120;
        self::$video->thumbnails[] = $thumbnail;

        $thumbnail = new stdClass;
        $thumbnail->url = 'http://www.dailymotion.com/thumbnail/80x60/video/'.self::$id;
        $thumbnail->width = 80;
        $thumbnail->height = 60;
        self::$video->thumbnails[] = $thumbnail;

        # Player URL
        self::$video->player_url = 'http://www.dailymotion.com/swf/'.self::$id;
        
        # FLV file URL
        $flv_url_query = $xml->xpath('/rss/channel/item/media:group/media:content[@type="video/x-flv"]/@url');
        self::$video->files['video/x-flv'] = $flv_url_query ? strval($flv_url_query[0]) : null;
        
        # MP4 file URL
        // TODO: Récupération de l'URL du fichier mp4
        //$mp4_query = $xml->xpath('/rss/channel/item/media:group/media:content[@type="video/mp4"]/@url');
        //self::$mp4 = $mp4_query ? $mp4_query[0] : null;
        
        return self::$video;
    }        

    # --------------------------------------------------------------------------------
    public static function getFlickr() {
        
        if(self::$oembed) {
            $oembed_url = 'http://www.flickr.com/services/oembed/?url='.urlencode(self::$url).'&format='.self::$format;
            if(self::checkAvailability($oembed_url)) $oembed = @file_get_contents($oembed_url);
            /*
                $xml = new SimpleXMLElement($oembed);
                # Media type check
                $type_query = $xml->xpath('/oembed/type');
                if($type_query[0] != 'video') throw new Videopian_Exception(Videopian_Exception::NOT_A_VIDEO);
            */
            return $oembed;
        }

        # API key check
        if (self::FLICKR_API_KEY == '') throw new Videopian_Exception(Videopian_Exception::API_KEY_NEEDED);
        
        # XML data URL
        $file_data = 'http://api.flickr.com/services/rest/?method=flickr.photos.getInfo&api_key=' . self::FLICKR_API_KEY . '&photo_id=' . self::$id;
        self::checkAvailability($file_data);
        self::$video->xml_url = $file_data;
        
        # XML
        $xml = new SimpleXMLElement(file_get_contents($file_data));
        
        # Media type check
        $media_query = $xml->xpath('/rsp/photo/@media');
        if($media_query[0] != 'video') throw new Videopian_Exception(Videopian_Exception::NOT_A_VIDEO);
        
        # Title
        $title_query = $xml->xpath('/rsp/photo/title');
        self::$video->title = $title_query ? strval($title_query[0]) : null;
        
        # Description
        $description_query = $xml->xpath('/rsp/photo/description');
        self::$video->description = empty($description_query) ? strval(trim($description_query[0])) : null;
        
        # Tags
        $tags_query = $xml->xpath('/rsp/photo/tags/tag');
        $tags = array();
        foreach ($tags_query as $tag_query) {
            $tag = (array) $tag_query;
            $tags[] = $tag[0];
        }
        self::$video->tags = $tags_query ? $tags : null;
        
        # Duration
        $duration_query = $xml->xpath('/rsp/photo/video/@duration');
        self::$video->duration = empty($duration_query) ? intval($duration_query[0]) : null;
        
        # Author & author URL
        $author_query = $xml->xpath('/rsp/photo/owner/@username');
        self::$video->author = $author_query ? strval($author_query[0]) : null;
        $author_id_query = $xml->xpath('/rsp/photo/owner/@nsid');
        self::$video->author_url = $author_id_query ? 'http://www.flickr.com/photos/'.strval($author_query[0]) : null;
        
        # Publication date
        $date_published_query = $xml->xpath('/rsp/photo/dates/@posted');
        self::$video->date_published = $date_published_query ? new DateTime(date(DATE_RSS, intval($date_published_query[0]))) : null;
        
        # Last update date
        $date_updated_query = $xml->xpath('/rsp/photo/dates/@lastupdate');
        self::$video->date_updated = $date_updated_query ? new DateTime(date(DATE_RSS, intval($date_updated_query[0]))) : null;
        
        # XML for files data URL
        $file_sizes_data = 'http://api.flickr.com/services/rest/?method=flickr.photos.getSizes&api_key=' . self::FLICKR_API_KEY . '&photo_id=' . self::$id;
        
        # XML
        $xml_sizes = new SimpleXMLElement(file_get_contents($file_sizes_data));

        # Thumbnails
        $photo_url_query = $xml_sizes->xpath('/rsp/sizes/size[@media="photo"]');
        foreach ($photo_url_query as $p) {
            $thumbnail = new stdClass;
            $thumbnail->url = strval($p['source']);
            $thumbnail->width = intval($p['width']);
            $thumbnail->height = intval($p['height']);
            self::$video->thumbnails[] = $thumbnail;
        }
    
        # Player & files URL
        $files_url_query = $xml_sizes->xpath('/rsp/sizes/size[@media="video"]');
        foreach ($files_url_query as $p) {
            switch (strval($p['label'])) {
                case 'Video Player': self::$video->player_url = $files_url_query ? strval($p['source']) : null; break;
                case 'Site MP4': self::$video->files['video/mp4'] = $files_url_query ? strval($p['source']) : null; break;
            }
        }
        
        return self::$video;
    }
        
        
    # --------------------------------------------------------------------------------
    public static function getGooglevideo() {

        # XML data URL
        $file_data = 'http://video.google.com/videofeed?docid='.self::$id;
        self::checkAvailability($file_data);
        self::$video->xml_url = $file_data;
        
        # XML
        $xml = new SimpleXMLElement(utf8_encode(file_get_contents($file_data)));
        $xml->registerXPathNamespace('media', 'http://search.yahoo.com/mrss/');
        
        # Title
        $title_query = $xml->xpath('/rss/channel/item/title');
        self::$video->title = $title_query ? strval($title_query[0]) : null;
        
        # Description
        $description_query = $xml->xpath('/rss/channel/item/media:group/media:description');
        self::$video->description = $description_query ? strval(trim($description_query[0])) : null;
        
        # Tags
        self::$video->tags = null;
        
        # Duration
        $duration_query = $xml->xpath('/rss/channel/item/media:group/media:content/@duration');
        self::$video->duration = $duration_query ? intval($duration_query[0]) : null;
        
        # Author & author URL
        // TODO: WTF?
        // $author_query = $xml->xpath('/rss/channel/item/author');
        // self::$video->author = $author_query ? strval($author_query[0]) : false;
        self::$video->author = null;
        self::$video->author_url = null;
        
        # Publication date
        $date_published_query = $xml->xpath('/rss/channel/item/pubDate');
        self::$video->date_published = $date_published_query ? new DateTime($date_published_query[0]) : null;
        
        # Last update date
        self::$video->date_updated = null;
        
        # Thumbnails
        $thumbnails_query = $xml->xpath('/rss/channel/item/media:group/media:thumbnail');
        $thumbnails_query = $thumbnails_query[0]->attributes();
        $thumbnail = new stdClass;
        $thumbnail->url = strval(preg_replace('#&amp;#', '&', $thumbnails_query['url']));
        $thumbnail->width = intval($thumbnails_query['width']);
        $thumbnail->height = intval($thumbnails_query['height']);
        self::$video->thumbnails[] = $thumbnail;
        
        # Player URL
        $player_url_query = $xml->xpath('/rss/channel/item/media:group/media:content[@type="application/x-shockwave-flash"]/@url');
        self::$video->player_url = $player_url_query ? strval($player_url_query[0]) : null;
        
        # AVI file URL
        $avi_url_query = $xml->xpath('/rss/channel/item/media:group/media:content[@type="video/x-msvideo"]/@url');
        self::$video->files['video/x-msvideo'] = $avi_url_query ? preg_replace('#&amp;#', '&', $avi_url_query[0]) : null;
        
        # FLV file URL
        $flv_url_query = $xml->xpath('/rss/channel/item/media:group/media:content[@type="video/x-flv"]/@url');
        self::$video->files['video/x-flv'] = $flv_url_query ? strval($flv_url_query[0]) : null;
        
        # MP4 file URL
        $mp4_url_query = $xml->xpath('/rss/channel/item/media:group/media:content[@type="video/mp4"]/@url');
        self::$video->files['video/mp4'] = $mp4_url_query ? preg_replace('#&amp;#', '&', $mp4_url_query[0]) : null;
        
        return self::$oembed ? self::generateOEmbed() : self::$video;
    }
        
        
    # --------------------------------------------------------------------------------
    public static function getMetacafe() {

        # XML data URL
        $file_data = "http://www.metacafe.com/api/item/".self::$id;
        self::checkAvailability($file_data);
        self::$video->xml_url = $file_data;
        
        # XML
        $xml = new SimpleXMLElement(file_get_contents($file_data));
        
        # Title
        $title_query = $xml->xpath('/rss/channel/item/title');
        self::$video->title = $title_query ? strval($title_query[0]) : null;
        
        # Description
        $description_query = $xml->xpath('/rss/channel/item/media:description');
        self::$video->description = $description_query ? strval($description_query[0]) : null;
        
        # Tags
        $tags_query = $xml->xpath('/rss/channel/item/media:keywords');
        if($tags_query) {
            $tags = explode(',', strval($tags_query[0]));
            foreach($tags as $t) self::$video->tags[] = trim($t);
        }
        
        # Duration
        self::$video->duration = null;
        
        # Author & author URL
        $author_query = $xml->xpath('/rss/channel/item/author');
        self::$video->author = $author_query ? strval($author_query[0]) : null;
        self::$video->author_url = "http://www.metacafe.com/".self::$video->author;
        
        # Publication date
        $date_published_query = $xml->xpath('/rss/channel/item/pubDate');
        self::$video->date_published = $date_published_query ? new DateTime($date_published_query[0]) : null;
        
        # Last update date
        self::$video->date_updated = null;
        
        # Thumbnails
        $thumbnails_query = $xml->xpath('/rss/channel/item/media:thumbnail/@url');
        $thumbnail = new stdClass;
        $thumbnail->url = strval($thumbnails_query[0]);
        list($thumbnail->width, $thumbnail->height) = getimagesize($thumbnail->url);
        self::$video->thumbnails[] = $thumbnail;
        
        # Player URL
        $player_url_query = $xml->xpath('/rss/channel/item/media:player/@url');
        self::$video->player_url = $player_url_query ? substr(str_replace('watch','fplayer',strval($player_url_query[0])),0,-1).'.swf' : null;
        
        # Files URL
        self::$video->files = array();
        
        return self::$oembed ? self::generateOembed() : self::$video;
    }
        
        
    # --------------------------------------------------------------------------------
    public static function getMyspace() {
        
        # XML data URL
        $file_data = "http://mediaservices.myspace.com/services/rss.ashx?type=video&videoID=".self::$id;
        self::checkAvailability($file_data);
        self::$video->xml_url = $file_data;
        
        # XML
        $xml = new SimpleXMLElement(file_get_contents($file_data));
        
        # Title
        $title_query = $xml->xpath('/rss/channel/item/title');
        self::$video->title = $title_query ? strval($title_query[0]) : null;

        # Description
        $description_query = $xml->xpath('/rss/channel/item/myspace:videodescription');
        self::$video->description = $description_query ? strval($description_query[0]) : null;
        
        # Tags
        self::$video->tags = null;
        
        # Duration
        $duration_query = $xml->xpath('/rss/channel/item/media:content[@type="video/x-flv"]/@duration');
        self::$video->duration = $duration_query ? intval($duration_query[0]) : null;
        
        # Author & author URL
        $author_query = $xml->xpath('/rss/channel/item/myspace:artistName');
        self::$video->author = $author_query ? strval($author_query[0]) : null;
        $author_url_query = $xml->xpath('/rss/channel/item/myspace:vanityURL');
        self::$video->author_url = $author_url_query ? preg_replace('#&amp;#','&', strval($author_url_query[0])) : null;
        
        # Publication date
        $date_published_query = $xml->xpath('/rss/channel/item/pubDate');
        self::$video->date_published = $date_published_query ? new DateTime($date_published_query[0]) : null;
        
        # Last update date
        self::$video->date_updated = null;
        
        # Thumbnails
        $thumbnails_query = $xml->xpath('/rss/channel/item/media:thumbnail/@url');
        $thumbnail = new stdClass;
        $thumbnail->url = strval($thumbnails_query[0]);
        list($thumbnail->width, $thumbnail->height) = getimagesize($thumbnail->url);
        self::$video->thumbnails[] = $thumbnail;
        $thumbnails_query = $xml->xpath('/rss/channel/item/media:still/@url');
        $thumbnail = new stdClass;
        $thumbnail->url = strval($thumbnails_query[0]);
        list($thumbnail->width, $thumbnail->height) = getimagesize($thumbnail->url);
        self::$video->thumbnails[] = $thumbnail;
        
        # Player URL
        self::$video->player_url = "http://lads.myspace.com/videos/vplayer.swf?m=" . self::$id;
        
        return self::$oembed ? self::generateOembed() : self::$video;
    }
        
        
    # --------------------------------------------------------------------------------
    public static function getRevver() {
        
        # Account check
        # if (self::REVVER_LOGIN == '' || self::REVVER_PASSWORD == '') throw new Videopian_Exception(Videopian_Exception::API_KEY_NEEDED);
        
        throw new Videopian_Exception(Videopian_Exception::SERVICE_NOT_SUPPORTED);
        
        return self::$oembed ? self::generateOembed() : self::$video;
    }
        
        
    # --------------------------------------------------------------------------------
    public static function getVeoh() {
        
        # API key check
        if (self::VEOH_API_KEY == '') throw new Videopian_Exception(Videopian_Exception::API_KEY_NEEDED);
        
        # XML data URL
        $file_data = "http://www.veoh.com/rest/v2/execute.xml?method=veoh.video.findByPermalink&permalink=" . self::$id . "&apiKey=" . self::VEOH_API_KEY;
        self::checkAvailability($file_data);
        self::$video->xml_url = $file_data;
        
        # XML
        $xml = new SimpleXMLElement(file_get_contents($file_data));
        
        # Title
        $title_query = $xml->xpath('/rsp/videoList/video/@title');
        self::$video->title = $title_query ? strval($title_query[0]) : null;
        
        # Description
        $description_query = $xml->xpath('/rsp/videoList/video/@description');
        self::$video->description = $description_query ? strval($description_query[0]) : null;
        
        # Tags
        $tags_query = $xml->xpath('/rsp/videoList/video/tagList/tag/@tagName');
        foreach($tags_query as $tag) self::$video->tags[] = strval($tag[0]);
        
        # Duration
        $duration_query = $xml->xpath('/rsp/videoList/video/@length');
        $duration_raw = $duration_query ? strval($duration_query[0]) : null;
        preg_match('#(?:(?P<hr>[0-9]*) hr )?(?:(?P<min>[0-5]?[0-9]) min )?(?P<sec>[0-5]?[0-9]) sec#', $duration_raw, $matches);
        $hours = $matches['hr'] ? intval($matches['hr']) : 0;
        $minutes = $matches['min'] ? intval($matches['min']) : 0;
        $seconds = $matches['sec'] ? intval($matches['sec']) : 0;
        self::$video->duration = ($hours * 60 * 60) + ($minutes * 60) + $seconds;
        
        # Author & author URL
        $author_query = $xml->xpath('/rsp/videoList/video/@username');
        self::$video->author = $author_query ? strval($author_query[0]) : null;
        self::$video->author_url = "http://www.veoh.com/users/".self::$video->author;
        
        # Publication date
        $date_published_query = $xml->xpath('/rsp/videoList/video/@dateAdded');
        self::$video->date_published = $date_published_query ? new DateTime($date_published_query[0]) : null;
        
        # Last update date
        self::$video->date_updated = null;
        
        # Thumbnails
        $thumbnail_medres_query = $xml->xpath('/rsp/videoList/video/@medResImage');
        $thumbnail = new stdClass;
        $thumbnail->url = strval($thumbnail_medres_query[0]);
        list($thumbnail->width, $thumbnail->height) = getimagesize($thumbnail->url);
        self::$video->thumbnails[] = $thumbnail;
        $thumbnail_highres_query = $xml->xpath('/rsp/videoList/video/@highResImage');
        $thumbnail = new stdClass;
        $thumbnail->url = strval($thumbnail_highres_query[0]);
        list($thumbnail->width, $thumbnail->height) = getimagesize($thumbnail->url);
        self::$video->thumbnails[] = $thumbnail;
        
        # Player URL
        self::$video->player_url = "http://www.veoh.com/veohplayer.swf?permalinkId=" . self::$id;
        
        # FLV file URL
        $flv_url_query = $xml->xpath('/rsp/videoList/video/@previewUrl');
        self::$video->files['video/x-flv'] = $flv_url_query ? strval($flv_url_query[0]) : null;
        
        return self::$oembed ? self::generateOembed() : self::$video;
    }
        
        
    # --------------------------------------------------------------------------------
    public static function getViddler() {
        
        if(self::$oembed) {
            $oembed_url = 'http://lab.viddler.com/services/oembed/?url='.urlencode(self::$url).'&format='.self::$format;
            if(self::checkAvailability($oembed_url)) return @file_get_contents($oembed_url);
        }

        # API key check
        # if (self::VIDDLER_API_KEY == '') throw new Videopian_Exception(Videopian_Exception::API_KEY_NEEDED);
        
        throw new Videopian_Exception(Videopian_Exception::SERVICE_NOT_SUPPORTED);
        
        return self::$video;
    }
        
        
    // -----------------------------------------------------------
    // A revoir ...
    // -----------------------------------------------------------
    public static function getVimeo() {

        if(self::$oembed) {
            $oembed_url = 'http://www.vimeo.com/api/oembed.'.self::$format.'?url='.urlencode(self::$url);
            if(self::checkAvailability($oembed_url)) return @file_get_contents($oembed_url);
        }
        
        # PHP serialized data URL
        // $url_data = 'http://vimeo.com/api/clip/'.self::$id.'/php';
        $url_data = 'http://vimeo.com/api/v2/video/'.self::$id.'.php';

        # Data
        $data = unserialize(file_get_contents($url_data));
        
        # Title
        self::$video->title = $data[0]['title'];
        
        # Description
        self::$video->description = $data[0]['caption'];
        
        # Tags
        self::$video->tags = explode(', ',$data[0]['tags']);
        
        # Duration
        self::$video->duration = $data[0]['duration'];
        
        # Author & author URL
        self::$video->author = $data[0]['user_name'];
        self::$video->author_url = $data[0]['user_url'];
        
        # Publication date
        self::$video->date_published = new DateTime($data[0]['upload_date']);

        # Last update date
        self::$video->date_updated = null;
        
        # Thumbnails
        // $thumbnail = new stdClass;
        // $thumbnail->url = $data[0]['thumbnail_small'];
        // list($thumbnail->width, $thumbnail->height) = getimagesize($thumbnail->url);
        // self::$video->thumbnails[] = $thumbnail;
        $thumbnail = new stdClass;
        $thumbnail->url = $data[0]['thumbnail_medium'];
        list($thumbnail->width, $thumbnail->height) = getimagesize($thumbnail->url);
        self::$video->thumbnails[] = $thumbnail;
        $thumbnail = new stdClass;
        $thumbnail->url = $data[0]['thumbnail_large'];
        list($thumbnail->width, $thumbnail->height) = getimagesize($thumbnail->url);
        self::$video->thumbnails[] = $thumbnail;
        
        # Player URL
        self::$video->player_url = 'http://vimeo.com/moogaloop.swf?clip_id='.self::$id;
        
        # Files URL
        self::$video->files = array();
        
        return self::$video;
    }
        
        
    # --------------------------------------------------------------------------------
    public static function getSevenload() {
        
        # API key check
        # if (self::SEVENLOAD_API_KEY == '') throw new Videopian_Exception(Videopian_Exception::API_KEY_NEEDED);
        
        throw new Videopian_Exception(Videopian_Exception::SERVICE_NOT_SUPPORTED);
        
        return self::$oembed ? self::generateOembed() : self::$video;
    }
        
        
    /**
     * getYoutube
     * 
    */
    public static function getYoutube() {
        
        if(self::$oembed) {
            $oembed_url = 'http://www.youtube.com/oembed?url='.urlencode(self::$url).'&format='.self::$format;
            
            if(self::checkAvailability($oembed_url))
                return @file_get_contents($oembed_url);
        }
        
        # API KEY
        include_spip('inc/config');
        if(!$youtube_api_key = lire_config('videos/youtube_api_key')){
            throw new Videopian_Exception(Videopian_Exception::API_KEY_NEEDED);
        }
        //$file_data = 'http://gdata.youtube.com/feeds/api/videos/'.self::$id;
        $file_data = 'https://www.googleapis.com/youtube/v3/videos?part=snippet,contentDetails&id='.self::$id.'&key='.trim($youtube_api_key);
        
        self::checkAvailability($file_data);
        //self::$video->xml_url = $file_data;
        
        $json_datas = json_decode(self::url_get_contents($file_data), true);
        if(!$json_datas)
            throw new Videopian_Exception(Videopian_Exception::GENERIC_ERROR);

        $video_infos = $json_datas['items'][0]['snippet'];

        $content_details = $json_datas['items'][0]['contentDetails'];
        
        #Title
        self::$video->title = $video_infos['title'] ? strval($video_infos['title']) : false ;
        # Description
        self::$video->description = $video_infos['description'] ? strval($video_infos['description']) : false ;

        # Duration
        self::$video->duration = $content_details['duration'] ? intval($content_details['duration']) : false ;
        
        
        # Thumbnails
        $thumbnails = $video_infos['thumbnails'];
        
        if ($thumbnails) {
            foreach ($thumbnails as $t) {
                $thumbnail = new stdClass;
                $thumbnail_query = $t;
                $thumbnail->url = strval($thumbnail_query['url']);
                $thumbnail->width = intval($thumbnail_query['width']);
                $thumbnail->height = intval($thumbnail_query['height']);
                self::$video->thumbnails[] = $thumbnail;
            }
        }
        
        
        
        
        // # Tags
        // @todo
        //$tags_query = $xml->xpath('/a:entry/media:group/media:keywords');
        //if($tags_query) {
        //    $tags = explode(',', strval($tags_query[0]));
        //    foreach($tags as $t) self::$video->tags[] = trim($t);
        //}
        
        
        
        # Author & author URL: @todo
        //$author_query = $xml->xpath('/a:entry/a:author/a:name');
        //self::$video->author = $author_query ? strval($author_query[0]) : false;
        //self::$video->author_url = 'http://www.youtube.com/'.self::$video->author;
        
        # Publication date
        //$date_published_query = $xml->xpath('/a:entry/a:published');
        //self::$video->date_published = $date_published_query ? new DateTime($date_published_query[0]) : false;
        
        # Last update date
        //$date_updated_query = $xml->xpath('/a:entry/a:updated');
        //self::$video->date_updated = $date_updated_query ? new DateTime($date_updated_query[0]) : false;
        
       
        # Player URL
        //self::$video->player_url = 'http://www.youtube.com/v/'.self::$id;
        
        # Files URL
        // self::$video->files = array();
        //
        //$files_data = 'http://www.youtube.com/get_video_info?&video_id='.self::$id;
        //$files = file_get_contents($files_data);
        //preg_match('#&token=([^&]*)#', $files, $matches);
        //$token = $matches[1];
        //
        //# FLV file URL
        //self::$video->files['video/x-flv'] = 'http://www.youtube.com/get_video?video_id='.self::$id.'&t='.$token;
        //self::$video->files['video/mp4'] = 'http://www.youtube.com/get_video?video_id='.self::$id.'&t='.$token.'&fmt=18';

// var_dump(self::$video);       
        return self::$video;
    }
    
    // -----------------------------------------------------------

    
    # --------------------------------------------------------------------------------
    public static function generateOEmbed() {

        $player_width  = self::$max_width;
        $player_height = self::$max_height;
        $player_html =  '<object width="' . $player_width . '" height="'. $player_height .'">' .
                        '<param name="movie" value="' . self::$video->player_url . '"></param>' .
                        '<param name="allowFullScreen" value="true"></param>' .
                        '<param name="allowscriptaccess" value="always"></param>' .
                        '<embed src="'. self::$video->player_url .'" type="application/x-shockwave-flash"' .
                        'width="'.  $player_width .'" height="'.  $player_height .'" allowscriptaccess="always"'.
                        'allowfullscreen="true"></embed>' .
                        '</object>';

        switch(self::$format) {
            case 'json':
                $json = '{'.
                        '"version": "1.0",'.
                        '"type": "video",'.
                        '"provider_name": "'. self::$video->site .'",'.
                        '"provider_url": "'. self::$video->url .'",'.
                        '"width": '. $player_width .','.
                        '"height": '. $player_height .','.
                        '"title": "'. htmlentities(self::$video->title) .'",'.
                        '"author_name": "'. htmlentities(self::$video->author) .'",'.
                        '"author_url": "'.self::$video->author_url  .'",'.
                        '"html": "'. addslashes($player_html) .'"'.
                        '}';
                return $json;
                break;

            case 'xml':
                $xml = new SimpleXMLElement('<oembed></oembed>');
                $xml->addChild('version', '1.0');
                $xml->addChild('type', 'video');
                $xml->addChild('provider_name', self::$video->site);
                $xml->addChild('provider_url', self::$video->url);
                $xml->addChild('width', $player_width);
                $xml->addChild('height', $player_height);
                $xml->addChild('title', self::$video->title);
                $xml->addChild('author_name', self::$video->author);
                $xml->addChild('author_url', self::$video->url);
                $xml->addChild('html', htmlentities($player_html));
                return $xml->asXML();
                break;
        }
    }
}
?>

Youez - 2016 - github.com/yon3zu
LinuXploit