• Welcome to PHPVIBE Forums. Please log in.

Add external links?

Started by qnkov,

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

qnkovTopic starter

Hi, and sorry if that's not the correct topic.

I noticed that you can upload direct links to videos from youtube, vimeo, etc., but not from any other site? Neither as an embed nor as a direct link. Since I cannot use the system to directly upload to my server, since it is shared hosting, I will have to add links from foreign sites and those from my country. But those links are not allowed. By any chance, is there an option that I can activate so that I can and my Users upload similar links and embeds without a problem? Or just phpvibe doesn't have such an option? And if possible, to make an update in such a case so that this can be done. Even if it should be a paid plugin to the site to allow such upload, because I would like to use the site for online movies in my language, and the allowed links are not useful to me for that.

Thanks.
  •  

qnkovTopic starter

I've saw the link for the way to add another source by making plugin for that.
With the help of your tutorial and chatgtp, i've manage to add another link from another site, but it does not fetch the title,duration and image.
So i've asked chatgtp to try making the changes for the code to work, but it does not...
I've notice something else too. When i try to add embed code from the admin panel in the media, i'm getting this error - string(34) "saveImage:
QuoteThis is not a resource."
Fatal error: Uncaught mysqli_sql_exception: Unknown column 'tags' in 'field list' in /home/anisubs/public_html/aniwatch/app/classes/ez_sql_mysqli.php:264 Stack trace: #0 /home/anisubs/public_html/aniwatch/app/classes/ez_sql_mysqli.php(264): mysqli->query('INSERT INTO vib...') #1 /home/anisubs/public_html/aniwatch/moderator/add-by-iframe.php(26): ezSQL_mysqli->query('INSERT INTO vib...') #2 /home/anisubs/public_html/aniwatch/moderator/index.php(42): require_once('/home/anisubs/p...') #3 {main} thrown in /home/anisubs/public_html/aniwatch/app/classes/ez_sql_mysqli.php on line 264


And here is the plugin code that i've made. It works, it can add another video from direct link, but it cannot fetch the information and it will be good if it could. And i've notice that when u use youtube video, you could see the preview when editing, but not for tubebg which i'm working on. I will need some help if you can fixing all those things.

Quote<?php
/**
 * Plugin Name: tubebg.com source
 * Plugin URI: http://phpvibe.com/
 * Description: Adds Tubebg embed source to PHPVibe
 * Version: 2.0
 * Author: PHPVibe Crew
 * Author URI: http://www.phpvibe.com
 * License: Commercial
 */

function _Tubebg($hosts = array()){
    $hosts[] = 'tubebg.com';
    return $hosts;
}

function EmbedTubebg($txt =''){
    global $vid;
    if(isset($vid)) {
        if($vid->VideoProvider($vid->theLink()) == 'tubebg.com' ) {
            $link = $vid->theLink();
            if(!empty($link)) { // Използване на !empty вместо nullval
                preg_match("/tubebg\.com\/(\d+)/", $link, $matches);
                $id = $matches[1];
                if(!empty($id)) { // Използване на !empty вместо nullval
                    $tembed = '<iframe width="' . get_option('video-width') . '" height="' . get_option('video-height') . '" src="https://www.tubebg.com/embed/'.$id.'" frameborder="0" allowfullscreen></iframe>';
                    $txt .= $tembed;
                }
            }
        }
    }
    return $txt;
}

function DetailsTubebg($txt = ''){
    global $vid, $websLink;
    if(!isset($vid) && isset($websLink)) {
        $vid = new Vibe_Providers($websLink);
    }
    if(isset($vid)) {
        $link = $vid->theLink();
        if(!empty($link)) { // Използване на !empty вместо nullval
            $htmlContent = file_get_contents($link);
            $dom = new DOMDocument();
            libxml_use_internal_errors(true); // Избягване на предупреждения при зареждане на HTML
            $dom->loadHTML($htmlContent);
            libxml_clear_errors();

            $titleNodes = $dom->getElementsByTagName('title');
            if ($titleNodes->length > 0) {
                $txt['title'] = $titleNodes->item(0)->nodeValue;
            }

            // Допълнителна логика за извличане на миниатюрата, времетраенето и друга информация
            // Трябва да се адаптира според HTML структурата на tubebg.com
        }
    }
    return $txt;
}

add_filter('EmbedDetails', 'DetailsTubebg');
add_filter('EmbedModify', 'EmbedTubebg');
add_filter('vibe-video-sources', '_Tubebg');
?>
  •  

Marius P.

They blocked me but I was able to make a grabber for this.

QuoteArray
(
    [@context] => https://schema.org
    [@type] => VideoObject
    [name] => Tian Guan Ci Fu S2 E1 - TubeBG
    [description] => Благословията на небесния служител!
    [thumbnailUrl] => https://www.tubebg.com/uploads/videos/thumbs/ykc3459680om_t.jpg
    [uploadDate] => 2024-01-18T12:56:00+02:00
    [duration] => PT33M47S
    [contentUrl] => https://media.tubebg.com/videos/ykc3459680om.mp4
    [embedUrl] => https://www.tubebg.com/embed/160629
)
Happy with my help? Buy me a coffee.
Please, always use the search before opening a new topic! We're all here on our (limited) free time! Make sure you help yourself too!
  •  

Marius P.

Here you go https://github.com/PHPVibe/TubeBg.com-Source
You'll need to update the providers class as well https://github.com/PHPVibe/PHPVibe-CMS/blob/master/app/classes/class.providers.php

I haven't been able to test it, as I got banned fast, but I think it should work.
Happy with my help? Buy me a coffee.
Please, always use the search before opening a new topic! We're all here on our (limited) free time! Make sure you help yourself too!
  •  

qnkovTopic starter

#4
Thanks for the reply. I've switched those files with yours, but nothing happens. It's still the same. Blank fields. Was there changes in class proveders file that you gave link to? I have strange feeling that something isnt right with the site, as everything slides to right when u refresh, or maybe it was like that and i didnt notice. And i've made 2 other plugins for other sites which i could fetch a bit of information, but right now they are blank too. Not sure how i can fix that. As the sie had already added plugin for Izlesene and i could see that it was grabbing some information or preview screen, not working now. Maybe i should install the system again. :)
  •  

Marius P.

I'll update the Izlene plugins, as I've made some changes to the provider class.

Tubebg.com blocks you after just a few requests, this is why the details are grabbed and then they come up empty.
Happy with my help? Buy me a coffee.
Please, always use the search before opening a new topic! We're all here on our (limited) free time! Make sure you help yourself too!
  •  

Marius P.

Happy with my help? Buy me a coffee.
Please, always use the search before opening a new topic! We're all here on our (limited) free time! Make sure you help yourself too!
  •  

Marius P.

Happy with my help? Buy me a coffee.
Please, always use the search before opening a new topic! We're all here on our (limited) free time! Make sure you help yourself too!
  •  

Similar topics (2)