Make the text box accepts embeds from Facebook, twitter, tiktok Etc.

Hello Team,

Please make the text box accepts embeds from Facebook, twitter, tiktok Etc.
the users simply can copy codes from these service and embed and play them in Libarea webiste.

12 Ответов

  1. In our country, such services as Facebook, Twitter, Instagram and the Meta company itself are recognized as extremist and hostile to our country. Therefore, my opinion is that it makes no sense to implement such functionality in Libarea.

    1. Oh, i see, this makes same sense.

    1. I disagree with that statement. You making «international» script which include English. Therefore any one can download it and use it. Russia's problems with other countries has nothing to do with the scripts ability to be fully functioning for everyone.

      It's like, if I personally don't have a twitter I would delete «log in using twitter» from my website, because I don't like twitter. Not cool thing to do.

  1. I can look at how to make the parser more flexible. Now it's done pretty hard.

    After the release (on Monday) I'll see what can be done.


    Я могу посмотреть, как сделать парсер более гибким. Сейчас это сделано достаточно жестко.

    После релиза (в понедельник) посмотрю, что можно сделать.

  1. Я думаю это будет проблематично.
    Данные соц. сети у нас заблокированы.

  1. Not that difficult to do actually. I will see if I can make some of them to work later on

  1. elseif (preg_match('/[http|https]+:\/\/(?:www\.|)twitter.com\/.*\/status\/(.+)$/i', $Element['element']['attributes']['href'], $id)) {
    
                $src = 'https://publish.twitter.com/oembed/' . $id[1];
            }
    
    elseif (preg_match('/[http|https]+:\/\/(?:www\.|)facebook.com\/watch\/(.+)$/i', $Element['element']['attributes']['href'], $id)) {
    
                $src = 'https://graph.facebook.com/v12.0/oembed_video?url=' . $id[0];
            }
    
            elseif (preg_match('/[http|https]+:\/\/(?:www\.|)facebook.com\/.*\/videos\/(.+)$/i', $Element['element']['attributes']['href'], $id)) {
    
                $src = 'https://graph.facebook.com/v12.0/oembed_video?url=' . $id[0];
            }

    header("Content-Security-Policy: default-src 'self' https://twitter.com https://graph.facebook.com https://publish.twitter.com https://www.facebook.com

    Тяжеловато конечно, когда у меня нет ни одного аккаунта. Твиттер видео не будет работать через iframe

    1. Спасибо, я посмотрю.

  1. elseif (preg_match('/[http|https]+:\/\/(?:www\.|)soundcloud.com(.+)$/i', $Element['element']['attributes']['href'], $id)) {
    
                $src = 'https://w.soundcloud.com/player/?url=' . $id[1];
            }

    Soundcloud, работает. Соответственно добавляем soundcloud.com и w.soundcloud.com в index.php

    Dailymotion.com

    elseif (preg_match('/[http|https]+:\/\/(?:www\.|)dailymotion.com\/(.+)$/i', $Element['element']['attributes']['href'], $id)) {
    
                $src = 'https://www.dailymotion.com/embed/video/' . $id[1];
            }
    
            elseif (preg_match('/[http|https]+:\/\/(?:www\.|)dai.ly\/(.+)$/i', $Element['element']['attributes']['href'], $id)) {
    
                $src = 'https://www.dailymotion.com/embed/video/' . $id[1];
            }

    https://dailymotion.com https://dai.ly — index.php

Комментарий удален...
  1. Twitch.com

    elseif (preg_match('/[http|https]+:\/\/(?:www\.|)twitch.tv\/videos\/(.+)$/i', $Element['element']['attributes']['href'], $id)) {
    
                $src = 'https://player.twitch.tv/?video=' . $id[1] . '&parent=libarea.ru';
            }

    Тут немного сложней, не очень знаком с этим скриптом. Я не знаю как вывести ДОМАИН сайта на котором будет стоять ЛибАреа. Так что надо заменить &parent=libarea.ru на домаин ЮЗЕРА, в данном случае я поставил ВАШ.

    Itemfix.com

    elseif (preg_match('/[http|https]+:\/\/(?:www\.|)itemfix.com\/(.+)$/i', $Element['element']['attributes']['href'], $id)) {
    
                $src = 'https://www.itemfix.com/e/' . $id[1];
            }

    Vimeo.com

    elseif (preg_match('/[http|https]+:\/\/(?:www\.|)vimeo.com\/(.+)$/i', $Element['element']['attributes']['href'], $id)) {
    
                $src = 'https://player.vimeo.com/video/' . $id[1];
            }

    Вроде все что я знаю. Если что забыл, отпишитесь

    PS. instacrap и tiktok = делать не буду, из собственных соображений. Не буду распространять это дерьмо. Я не враг своему здоровью.

    1. Спасибо. Я объединил множественные ответы в один.

Комментарий удален...
  1. Почему кстати особо и не делаю. Для LibArea это не надо, прям сейчас, а кто хочет, тот сможет для своего экземпляра поставить это. В сети миллионы сайтов, могут быть такие частные случаи, что жуть.

    Хотя, возможно вынести это отдельно и туда кидать эти парсеры на разные сайты. Ну это потом, где-то видел библиотеку с поддержкой, надо посмотреть.

    Эти правила поддерживать на самом деле не очень хочется (когда их будет много). Они отваливаться будут на раз. Надо стороннюю посмотреть библиотеку.