1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.
  2. This forum has been archived. New threads and replies may not be made. All add-ons/resources that are active should be migrated to the Resource Manager. See this thread for more information.

[Add More Video Sites] BB Code Media

Discussion in 'Tips and Guides [Archive]' started by D.O.A., Nov 4, 2010.

  1. Frankie

    Frankie Member

  2. jauburn

    jauburn Active Member


    This is super. It worked. Any way to give the code for pornhub, youporn, or others?
  3. Frankie

    Frankie Member

  4. Mutt

    Mutt Well-Known Member

    this was the only one I got to work. the others require more & I didn't get them to work yet.
  5. jauburn

    jauburn Active Member

    (y)
  6. EQnoble

    EQnoble Equilux Nobiliterà

    Media Site ID: splicd
    ________________________________________
    Site Title: Splicd.com
    ________________________________________
    Site URL: http://www.splicd.com/
    ________________________________________
    Match URLs: #splicd\.com/(?P<id>[a-z0-9-_]+/[0-9]+/[0-9]+)#si
    ________________________________________
    Embed HTML:
    HTML:
    <none>
    ________________________________________

    ____advanced options___________________________
    Regular Expression Matching: Use 'Match URLs' as PCRE regular expressions [ Checked ]
    ________________________________________
    Embed HTML Callback: MediaSites_Splicd::buildEmbed

    Spliced.php (for display only, download the file here).
    PHP:
    <?php
    //Template courtesy of Jake Bunce...again.  :-)  Modified for Splicd of course
     
    //  THE CLASS
    class MediaSites_Splicd
    {
        
    // THE METHOD
        
    public static function buildEmbed($mediaKey, array $site)
        {
            
    // ISOLATE THE PARAMS THAT ARE NEEDED FROM THE MEDIAKEY
            
    if(preg_match('#(?P<yid>[a-z0-9-_]+)/(?P<pstt>[0-9]+)/(?P<pstp>[0-9]+)#si'$mediaKey$match))
            {
                
    // DEFINE GENERIC EMBED HTML WITH TEMP TEXT STRINGS TO BE REPLACED LATER
                            
    $embedHtml '<div style="text-align: right; margin-top: 3px; width: 425px; height: 375px;">
                                <object width="425" height="344">
                                    <param name="movie" value="http://www.youtube.com/v/__ID__&start=__START__&end=__STOP__"></param>
                                    <param name="allowFullScreen" value="true"></param>
                                    <param name="wmode" value="transparent"></param>
                                    <embed src="http://www.youtube.com/v/__ID__&start=__START__&end=__STOP__" type="application/x-shockwave-flash" allowfullscreen="true" width="425" height="344" wmode="transparent"></embed>
                                </object>                     
                                    <a class="splicdLink" href="http://splicd.com">powered by <span class="splicdOrange"> Splicd.com</span></a>
                            </div>'
    ;
         
                
    //    REPLACE ALL INSTANCES OF TEMP __TXT__ PLACEHOLDER STRINGS
                
    $finalHtml str_replace(array('__ID__''__START__''__STOP__'), array($match['yid'], $match['pstt'], $match['pstp']), $embedHtml);
         
                
    //  RETURN PROCESSED EMBED CODE
                
    return $finalHtml;
            }
     
            
    // RETURN NOTHING IF NO MATCH
            
    else return '';
        }
    }

    Attached Files:

  7. Adimaryanto

    Adimaryanto Member

    How about www.issuu.com.
    Help :(
  8. EQnoble

    EQnoble Equilux Nobiliterà

    Media Site ID: issuudoc
    ________________________________________
    Site Title: Issuu.com Docs
    ________________________________________
    Site URL: http://issuu.com/
    ________________________________________
    Match URLs: #issuu\.com/(?P<id>[a-z0-9-_!\@\#\$\%\^\&\*()]+/docs/[a-z0-9-_!\@\#\$\%\^\&\*()]+)#si
    ________________________________________
    Embed HTML:
    HTML:
    <none>
    ________________________________________

    ____advanced options___________________________
    Regular Expression Matching: Use 'Match URLs' as PCRE regular expressions [ Checked ]
    ________________________________________
    Embed HTML Callback: MediaSites_IssuuDOC::buildEmbed


    IssuuDOC.php (for display only, download the file here).

    Goes in library/MediaSites/

    PHP:
    <?php
    class MediaSites_IssuuDOC
    {
        public static function 
    buildEmbed($mediaKey, array $site)
        {
            
    $pageHtml file_get_contents('http://issuu.com/' $mediaKey);
            if(
    preg_match('#<meta\sproperty="og:image"\scontent="http\://image\.issuu\.com/(?P<doxid>[a-z0-9-_]+)/jpg#si'$pageHtml$match))
            {
                
    $embedHtml '<div>
                                <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" style="width:420px;height:544px" id="0e4694d3-fdfb-452f-2227-3f9777b01fd0" >
                                    <param name="movie" value="http://static.issuu.com/webembed/viewers/style1/v2/IssuuReader.swf?mode=mini&amp;viewMode=singlePage&amp;backgroundColor=%23222222&amp;documentId=__DOCID__" />
                                    <param name="allowfullscreen" value="true"/>
                                    <param name="menu" value="false"/>
                                    <param name="wmode" value="transparent"/>
                                    <embed src="http://static.issuu.com/webembed/viewers/style1/v2/IssuuReader.swf" type="application/x-shockwave-flash" allowfullscreen="true" menu="false" wmode="transparent" style="width:420px;height:544px" flashvars="mode=mini&amp;viewMode=singlePage&amp;backgroundColor=%23222222&amp;documentId=__DOCID__" />
                                </object>
                                    <div style="width:420px;text-align:left;">
                                        <a href="http://issuu.com/__MEDIAKEY__?mode=window&amp;backgroundColor=%23222222" target="_blank">Open @ Issuu</a>
                                    </div>
                            </div>'
    ;
                
    $finalHtml str_replace(array('__DOCID__''__MEDIAKEY__'), array($match['doxid'], $mediaKey), $embedHtml);
                return 
    $finalHtml;
            }
            return 
    '';
        }
    }

    Attached Files:

    Adimaryanto likes this.
  9. yavuz

    yavuz Well-Known Member

    Hi EQnoble,

    I'm trying to add http://www.sunoyun.com to the list, an online flash game site, but without success.

    An URL Here: http://www.sunoyun.com/Baja-Motocross-Oyunu-4eb831185f788.html

    Code:
    <table style="margin:0 0 10px 0; width:244px; background:#fff; border:1px solid #ccc;" cellspacing="0" cellpadding="0">
    <tr><td style="font-family:verdana; font-size:11px; color:#000; padding:5px 6px;"><a href="http://www.sunoyun.com/Baja-Motocross-Oyunu-4eb831185f788.html" style="display:block; text-decoration:none;"><img src="http://www.sunoyun.com/oyun_img/bajamotocross.jpg" width="70" height="59" align="left" style="margin-right:5px; border: #000 1px solid;" alt="Bedava Türkçe Oyunlar Sunoyun.com - Baja Motocross" />
    <strong style="color:#000; border:none; text-decoration:underline;">Baja Motocross</strong><p style="margin:0; clear:none; text-decoration:none; color:#000;"><b>Baja Motocross Oyunu Hakkında</b></br>
    3D Motor yarışlarına girip ..</p></a></td></tr>
    <tr><td style="font-family:verdana; font-size:11px; color:#003366; padding:5px 10px; border-top:1px solid #ccc;"><a href="http://www.sunoyun.com/Baja-Motocross-Oyunu-4eb831185f788.html" title="Bedava Türkçe Oyunlar Sunoyun.com">Bu oyunu hemen bedava oyna!</a></td></tr>
    </table>
  10. EQnoble

    EQnoble Equilux Nobiliterà

  11. yavuz

    yavuz Well-Known Member


    Code:
          <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="700px" height="525px">
            <param name="movie" value="http://www.sunoyun.com/swf/muhtesemyuzyil.swf" />
            <param name="quality" value="high" /><param name="base" value="http://www.sunoyun.com/" /><param name="allowScriptAccess" value="sameDomain" />
            <!--[if !IE]>-->
            <object type="application/x-shockwave-flash" data="http://www.sunoyun.com/swf/muhtesemyuzyil.swf" width="700px" height="525px">
            <!--<![endif]-->
              <p>Lütfen Adobe Flash Player Yükleyiniz.</p>
            <!--[if !IE]>-->
                <param name="quality" value="high" /><param name="base" value="http://www.sunoyun.com/" /><param name="allowScriptAccess" value="sameDomain" /></object>
            <!--<![endif]-->
          </object>
    
    I looked at the source code perhaps it helps? They don't offer domain support you get redirected to their site if you use their code.
  12. EQnoble

    EQnoble Equilux Nobiliterà

    I think I can do it....but....of course there is a but...don't ask me what it is full of because you will be setting me up for a great joke :)

    I was testing the 50+ mediasites that will be in the mediasites pack addon and fixing the outdated and broken defs.

    This has taken me SUBSTANTIALLY longer than I ever could have guessed (I had planned on updating the addon right after new year...I am just a wee bit late).

    I promise I will check it out but it may be a couple of days...it is always more difficult when I have to translate the pages and if I get stuck tweaking one def to get it right...I am going to do what I did before and have the mediasites pack be another month late.



    Just as a heads up ....my plan in a post on the dev board
    Get all info together for this addon including new css template, listener, and all bbcodes.
    Test all bbcodes
    Fix broken and outdated defs. ( 5 left)
    Fill all requests(req. 9) (adult & non english can be skipped temp. - addon to be split into mediasites, non-english, adult/NSFW each of the three their own upgradeable pack)
    Export addon after edits and checks complete
    Package callback files and listeners together with a root /dir name of UPLOAD
    Add all relevant files to archive.
    SHARE
    yavuz likes this.
  13. Adimaryanto

    Adimaryanto Member

    Great.... CODE work..
    Thank you very much :)
  14. EQnoble

    EQnoble Equilux Nobiliterà

    Addon updated:
    http://xenforo.com/community/threads/bbcode-mediasites-package.24802/#post-301985

    I wanted to get all the requests filled first but it is not a perfect world...there is a list of requests still yet to fill...below is what I have...if one is missing from that list and was already posted, quote this post and state the site name otherwise just request as normal.


    These I did not add yet but am going to start working on one by one (if you are going to attempt one lemme know so I don't do the same one).
    Mutt likes this.
  15. EQnoble

    EQnoble Equilux Nobiliterà

    I will continue to organize the requests into lists like this to update request statuses

    Red is in need of work, green or being removed from the list means is completed, and underlined ones are being worked on by someone currently
    Current requests:
    hulu
    hulkshare
    Photobucket
    ictv-tf-ec.indieclicktv.com
    bet.com
    pornhub
    youporn
    videos.sapo.pt
    sunoyun.com
    5min.com
    mma-tube
    The8thLegion likes this.
  16. LPH

    LPH Well-Known Member

  17. Mutt

    Mutt Well-Known Member

    can somebody help me figure out why this won't work?

    I'm working on PornHub. I've X'd out the pornhub part in URLs an effort to avoid a problem but in my work it's spelled out correctly.

    a pornhub URL looks like this
    Code:
    http://www.pxxxxxb.com/view_video.php?viewkey=1741195814
    my match URL is this
    Code:
    http://www.pxxxxxb.com/view_video.php?viewkey={$id}
    I do NOT check "Use 'Match URLs' as PCRE regular expressions"

    this part works. I'm able to post the link & have it grab the viewkey.

    for Embed HTML Callback: I've entered MediaSites_PornHub & buildEmbed

    here's my PornHub.php file that is in MediaSites
    Code:
    <?php
     
    class MediaSites_PornHub
    {
        public static function buildEmbed($mediaKey, array $site)
        {
            // CAPTURE WEB PAGE
            $pageHtml = file_get_contents('http://www.pxxxxxb.com/view_video.php?viewkey=' . $mediaKey);
                                       
            // ISOLATE THE VIDEOID IN THE SOURCE
            if(preg_match('#<p class="notice" id="flagger_video_(?P<videoid>[0-9]+)_feedback">#si', $pageHtml, $match))
            {
                // DEFINE GENERIC EMBED HTML WITH REPLACEMENT VARIABLES __VIDEOID__ AND __MEDIAKEY__
                $embedHtml = '<object type="application/x-shockwave-flash" data="http://cdn1.static.pxxxxxb.phncdn.com/flash/embed_player.swf" width="608" height="476"><param name="movie" value="http://cdn1.static.pxxxxxb.phncdn.com/flash/embed_player.swf" /><param name="bgColor" value="#000000" /><param name="allowfullscreen" value="true" /><param name="allowScriptAccess" value="always" /><param name="FlashVars" value="options=http://www.pxxxxxb.com/embed_player.php?id=__VIDEOID__"/></object>';
               
                // MAKE THE REPLACEMENTS
                $finalHtml = str_replace('__VIDEOID__', $match['videoid'], $embedHtml);
     
                // RETURN THE FINISHED HTML
                return $finalHtml;
            } else {
                $finalHtml = "Could Not find VideoID for http://www.pxxxxxb.com/view_video.php?viewkey=" . $mediaKey;
                return $finalHtml;
            }
     
            // RETURN NOTHING IF NO MATCH
            return '';
        }
    }
    here's a a section of source from the pornhub page
    Code:
            <div class="bar-right">
                <a href="#" onclick="$j('.flag-box').hide(); return false">close</a>
     
            </div>
            <p class="notice" id="flagger_video_268865_feedback"></p>
    <div class="video-actions-panel-wrap clearfix">
        <div class="video-actions-panel-left">
    I've checked my preg_match using this tool and the source snippet above and it finds the videoid correctly but when I run this on my site, every time it says Could Not find VideoID. I put that part in just so I knew it was running my script & the issue was the preg_match isn't finding results.

    anyone have any idea where I've gone wrong?
    jauburn likes this.
  18. Mutt

    Mutt Well-Known Member

    it seems that $pageHtml is coming back blank.
  19. Mutt

    Mutt Well-Known Member

    ok, i have another one i'm stuck on. again I've xxx'd out the domain

    with this one the ID that I have to capture from the URL contain 2 forward slashes like this
    category/username/videoid

    here's my match url
    Code:
    #txxx8.com/(?P<id>([a-z0-9-_]+/[a-z0-9-_]+/[0-9-_]+))#si
    and my embed code
    Code:
    <iframe src='http://www.txxx8.com/embed/{$id}/' frameborder=0 height=481 width=608 scrolling=no name='t8_embed_video'></iframe>
    then the embed code appears to work but in the code that gets displayed the 2 "/"s are replaced w/ "%2F". that's enough for the code not to work.
    it should output "http://www.txxx8.com/embed/category/username/videoid/"
    instead I'm getting
    HTML:
    http://www.txxx8.com/embed/category%2Fusername%2Fvideoid/
    is there any way to get the system to stop converting the slashes? or do I need to make a .php file to handle this?
  20. EQnoble

    EQnoble Equilux Nobiliterà


    \s is your friend :) try this

    #<p\sclass="notice"\sid="flagger_video_(?P<videoid>[0-9]+)_feedback">#si

    Now I haven't tried out your code yet and this is me testing my debugging skills so if it doesn't work let me know and I will see if something else is in fact the issue. Your setup looks good at first glance so I go right to the regex in the callback

    I am looking at it as...if it is returning nothing to the forum post...// RETURN NOTHING IF NO MATCH is the part responding to in the forum which would mean i think as you suspected that your expression missed something. Now I have had to figure this out myself before too...and what it is I think is that when you make an expression and it checks out as correct with a regex tool...you have to mind that you need to physically represent the whitespace \s when doing your matches and or replacements in php.

    If that is right then this line....
    #<p class="notice" id="flagger_video_(?P<videoid>[0-9]+)_feedback">#si

    would become
    #<p\sclass="notice"\sid="flagger_video_(?P<videoid>[0-9]+)_feedback">#si

    does this help yah...?
    jauburn likes this.

Share This Page