LexSanchez Posted February 23, 2018 Share Posted February 23, 2018 Video or Social Post Embed Based on the TextformatterVideoEmbed module developed by Ryan Cramer, we have added the possibility to embed publications of the main social networks Facebook, Twitter and Instagram. ProcessWire Textformatter module that enables translation of YouTube, Vimeo, Instagram, Facebook, Twitter or Issuu URLs to full embed codes, resulting in a viewable video or social post in textarea fields you apply it to. How to install Download or Clone from Github: https://github.com/lexsanchez/VideoOrSocialPostEmbed Copy the VideoOrSocialPostEmbed.module file to your /site/modules/ directory (or place it in /site/modules/VideoOrSocialPostEmbed/). Click check for new modules in ProcessWire Admin Modules screen. Click install for the module labeled: "Video or Social Post Embed". Now you will be on the module config screen. Please make note of the config options and set as you see fit. How to use Edit your body field in Setup > Fields (or whatever field(s) you will be placing videos in). On the details tab, find the Text Formatters field and select "Video or Social Post Embed". Save. Edit a page using the field you edited and paste in YouTube, Vimeo, Facebook, Twitter, Instagram and/or Issuu URLs each on their own paragraph. Example How it might look in your editor (like TinyMCE): Here are two videos about ProcessWire http://www.youtube.com/watch?v=Wl4XiYadV_k http://www.youtube.com/watch?v=XKnG7sikE-U And here is a great video I watched earlier this week: http://vimeo.com/18280328 Embed social post and Issuu Presentation: https://www.instagram.com/p/BeA8p9AhA3b/ https://twitter.com/rpc_radio/status/954315569838411776 https://www.facebook.com/TNTLA/videos/10155549598252758/ https://issuu.com/madsoundsmagazine/docs/mad_sounds_issue_no._17_issuu How it works This module uses YouTube, Vimeo, Instagram, Facebook, Twitter and Issuu oEmbed services to generate the embed codes populated in your content. After these services are queried the first time, the embed code is cached so that it doesn't need to be pulled again. Configuration You may want to update the max width and max height settings on the module's configuration screen. You should make these consistent with what is supported by your site design. If you change these max width / max height settings you may also want to check the box to clear cache, so that YouTube/Vimeo/Facebook/Twitter/Instagram/Issuu oembed services will generate new embed codes for you. Using with Markdown, Textile or other LML This text formatter is looking for a YouTube, Vimeo, Instagram, Facebook, Twitter or Issuu video URL surrounded by paragraph tags. As a result, if you are using Markdown or Textile (or something else like it) you want that text formatter to run before this one. That ensures that the expected paragraph tags will be present when VideoOrSocialPostEmbed runs. You can control the order that text formatters are run in by drag/drop sorting in the field editor. Copyright 2018 by Ryan Cramer / Updated by Lex Sanchez 18 1 Link to comment Share on other sites More sharing options...
theo Posted February 24, 2018 Share Posted February 24, 2018 Thank you. There is a problem here with https://www.instagram.com/p/BeA8p9AhA3b/ Error: Exception: SQLSTATE[22001]: String data, right truncated: 1406 Data too long for column 'embed_code' at row 1 (in /home/theo/public_html/pwdev/site/modules/VideoOrSocialPostEmbed/TextformatterVideoOrSocialPostEmbed.module line 113) #0 /home/theo/public_html/pwdev/site/modules/VideoOrSocialPostEmbed/TextformatterVideoOrSocialPostEmbed.module(113): PDOStatement->execute() #1 /home/theo/public_html/pwdev/site/modules/VideoOrSocialPostEmbed/TextformatterVideoOrSocialPostEmbed.module(337): TextformatterVideoOrSocialPostEmbed->getEmbedCode('://api.instagra...', 'ig-BeA8p9AhA3b') #2 /home/theo/public_html/pwdev/site/modules/VideoOrSocialPostEmbed/TextformatterVideoOrSocialPostEmbed.module(152): TextformatterVideoOrSocialPostEmbed->embedInstagram('<p>https://www....') #3 /home/theo/public_html/pwdev/wire/core/Textformatter.php(60): TextformatterVideoOrSocialPostEmbed->format('<p>https://www.... Link to comment Share on other sites More sharing options...
LexSanchez Posted February 25, 2018 Author Share Posted February 25, 2018 Hello Theo: Thanks for your comment; I have made an update to the module that solves this error, please uninstall the module replace with the new version. Regards, 1 Link to comment Share on other sites More sharing options...
bernhard Posted March 3, 2018 Share Posted March 3, 2018 Thanks, would be interesting to see how your example looks like on the frontend. Maybe you have a screenshot? 2 Link to comment Share on other sites More sharing options...
LexSanchez Posted March 15, 2018 Author Share Posted March 15, 2018 Hi Bernhard: Sorry for answering something late, I attached 2 images of how it is shown in social network content. 1 Link to comment Share on other sites More sharing options...
FL0RIAN Posted March 24, 2018 Share Posted March 24, 2018 Is there a way to get this module to work with CKeditor? For me it is not working Only the links are visible in frontend. Link to comment Share on other sites More sharing options...
FL0RIAN Posted March 24, 2018 Share Posted March 24, 2018 Got it. The URL has to be pain text instead of a link. Link to comment Share on other sites More sharing options...
Christophe Posted May 18, 2018 Share Posted May 18, 2018 (edited) Hello, When I try to install Video or Social Post Embed in ProcessWire 3.0.102, I have an error page with: Error Class '\VideoOrSocialPostEmbed' not found and File: /home/********/public_html/wire/core/Modules.php:535 525: ProcessWire::setCurrentInstance($wire2); 526: } else { 527: $wire1 = null; 528: } 529: } else { 530: $wire1 = null; 531: $wire2 = null; 532: } 533: 534: try { 535: $module = $this->wire(new $className()); 536: } catch(\Exception $e) { 537: $this->error(sprintf($this->_('Failed to construct module: %s'), $className) . " - " . $e->getMessage()); 538: $module = null; 539: } In version 2.8.62, the class wasn't found as well. If I disable Tracy Debugger, I see: Fatal error: Uncaught Error: Class '\VideoOrSocialPostEmbed' not found in /home/********/public_html/wire/core/Modules.php:535 Stack trace: #0 /home/********/public_html/wire/core/Modules.php(1704): ProcessWire\Modules->newModule('\\VideoOrSocialP...') #1 /home/********/public_html/wire/core/Wire.php(386): ProcessWire\Modules->___install('VideoOrSocialPo...', Array) #2 /home/********/public_html/wire/core/WireHooks.php(723): ProcessWire\Wire->_callMethod('___install', Array) #3 /home/********/public_html/wire/core/Wire.php(442): ProcessWire\WireHooks->runHooks(Object(ProcessWire\Modules), 'install', Array) #4 /home/********/public_html/wire/modules/Process/ProcessModule/ProcessModule.module(262): ProcessWire\Wire->__call('install', Array) #5 /home/********/public_html/wire/core/Wire.php(380): ProcessWire\ProcessModule->___execute() #6 /home/********/public_html/wire/core/WireHooks.php(723): ProcessWire\Wire->_callMethod('___execute', Array) #7 /home/********/public_html/wire/core/Wire.php(442): ProcessWire\WireHooks->runH in /home/********/public_html/wire/core/Modules.php on line 535 and Error: Uncaught Error: Class '\VideoOrSocialPostEmbed' not found in /home/********/public_html/wire/core/Modules.php:535 Stack trace: #0 /home/********/public_html/wire/core/Modules.php(1704): ProcessWire\Modules->newModule('\\VideoOrSocialP...') #1 /home/********/public_html/wire/core/Wire.php(386): ProcessWire\Modules->___install('VideoOrSocialPo...', Array) #2 /home/********/public_html/wire/core/WireHooks.php(723): ProcessWire\Wire->_callMethod('___install', Array) #3 /home/********/public_html/wire/core/Wire.php(442): ProcessWire\WireHooks->runHooks(Object(ProcessWire\Modules), 'install', Array) #4 /home/********/public_html/wire/modules/Process/ProcessModule/ProcessModule.module(262): ProcessWire\Wire->__call('install', Array) #5 /home/********/public_html/wire/core/Wire.php(380): ProcessWire\ProcessModule->___execute() #6 /home/********/public_html/wire/core/WireHooks.php(723): ProcessWire\Wire->_callMethod('___execute', Array) #7 /home/********/public_html/wire/core/Wire.php(442): ProcessWire\WireHooks->runH (line 535 of /home/********/public_html/wire/core/Modules.php) This error message was shown because: site is in debug mode. ($config->debug = true; => /site/config.php). Error has been logged. EDIT: I've just been able to install it via the backend (via the .zip URL from GitHub). I had done it manually before. I had renamed the folder and the .module file VideoOrSocialPostEmbed (like in the documentation(s)). I hadn't done it again without renaming anything (or had I? I don't remember. Perhaps both, or the folder or the file) so I don't know if it was the reason (or one of them). I've changed the PHP version from 7.1 to 7.2. Not sure it had an effect. Edited May 29, 2018 by Christophe Solved Link to comment Share on other sites More sharing options...
Christophe Posted May 29, 2018 Share Posted May 29, 2018 (edited) Hello again, For YouTube videos, would it be possible to make it work with &rel=0 added at the end of the URL (like it is the case with Video Embed For YouTube/Vimeo). It works with the Video embed for YouTube and Vimeo module. Thanks in advance for considering it. Or if anyone knows how to enable it properly. Edited October 11, 2019 by Christophe Link to comment Share on other sites More sharing options...
gen Posted March 13, 2019 Share Posted March 13, 2019 Nice module. You should add this: $embedCode = utf8_encode($data['html']); When fetching data from providers, and set the data tables to mb4. Otherwise the output gets chewed up and throws errors. Test with instagram embed where there is an emoji in the title, e.g. https://www.instagram.com/p/BjXM8mInfN-/ Thanks for the module. 1 Link to comment Share on other sites More sharing options...
Leftfield Posted March 30, 2019 Share Posted March 30, 2019 Tried to install via zip and class, in both cases I got empty settings page: Link to comment Share on other sites More sharing options...
Leftfield Posted April 6, 2019 Share Posted April 6, 2019 Managed to install. It is not working in ANY editor. Neither youtube, nore twitter, nor facebook, nothing. I can write exact same non-working module for like 1 sec and less. Please, someone delete this module. Link to comment Share on other sites More sharing options...
wbmnfktr Posted April 8, 2019 Share Posted April 8, 2019 Quick YouTube test... ProcessWire 3.0.123 VideoOrSocialPostEmbed 1.2.1 So... you might want to check your setup and settings. Link to comment Share on other sites More sharing options...
zitzko Posted December 21, 2019 Share Posted December 21, 2019 Module works fine with YouTube and Vimeo Links, but all other (Instagram, Twitter,Facebook, ...) do not work. My core-version is 3.0.98, module-version is 1.2.2. Link to comment Share on other sites More sharing options...
fliwire Posted May 2, 2020 Share Posted May 2, 2020 tested with 3.0.155 all embed works after two changes: 1- Find textformatter_video_or_social_embed table change embed_code collation to utf8mb4 if not // changed to utf8mb4_unicode_ci 2- https://github.com/lexsanchez/VideoOrSocialPostEmbed/blob/57c254e64ae3c03139e2bb5119ffc676d92af39c/TextformatterVideoOrSocialPostEmbed.module#L103 update this line $embedCode = utf8_encode($data['html']); 1 Link to comment Share on other sites More sharing options...
Benjamin Posted July 17, 2020 Share Posted July 17, 2020 I am having difficulty implementing the fix that fliwire suggests above. Can someone share with me the proper syntax for the first step "1- Find textformatter_video_or_social_embed table change embed_code collation to utf8mb4 if not // changed to utf8mb4_unicode_ci" I understand the need to change the characterset but don't know how as I'm very new to processwire, php and this forum so thanks in advance to anyone who can help. Link to comment Share on other sites More sharing options...
medcompanama Posted July 17, 2020 Share Posted July 17, 2020 5 hours ago, Benjamin said: I am having difficulty implementing the fix that fliwire suggests above. Can someone share with me the proper syntax for the first step "1- Find textformatter_video_or_social_embed table change embed_code collation to utf8mb4 if not // changed to utf8mb4_unicode_ci" I understand the need to change the characterset but don't know how as I'm very new to processwire, php and this forum so thanks in advance to anyone who can help. Hi Benjamin: I have made the update indicated by Fliwire, update the module, it is an excellent recommendation Fliwire thanks. Link to comment Share on other sites More sharing options...
Benjamin Posted July 18, 2020 Share Posted July 18, 2020 Thanks MedcomPanama for doing the updates suggested by Fliwire. The module is working well for me now. It's great to have such a fast and helpful reply. Link to comment Share on other sites More sharing options...
Gideon So Posted October 16, 2020 Share Posted October 16, 2020 Hi, Just installed this amazing module. All works fine but I am not able to embed FB videos. I get this error on the page: Video Unavailable This video may no longer exist, or you don't have permission to view it. Is there a solution for this? Thanks. Gideon Link to comment Share on other sites More sharing options...
mel47 Posted November 4, 2020 Share Posted November 4, 2020 Hi, I have a strange question. I embed twitter link without problem, but the rendering is in spanish (and I tried many links with the same result). Believe me, I have absolutely nothing set to this language on my computer (either PW, or twitter cookie or anything). Have an idea how to revert back this to my language? Thanks Mel Link to comment Share on other sites More sharing options...
fliwire Posted November 4, 2020 Share Posted November 4, 2020 delete "&lang=es" from query string:https://github.com/lexsanchez/VideoOrSocialPostEmbed/blob/12b939514f574f5885e2c0d1ea12ad04e85c873b/TextformatterVideoOrSocialPostEmbed.module#L278 Link to comment Share on other sites More sharing options...
999design Posted December 17, 2020 Share Posted December 17, 2020 I've just noticed from today that YouTube video urls don't appear to be working. Vimeo and Twitter examples worked fine but I can't seem to get any Youtube URL to work now. Is anyone aware of what this could be. I've tried different urls in different fileds but am having no joy. Previous links that works have now just reverted to a line of text. Any help or advice would be greatly appreciated. Thanks Link to comment Share on other sites More sharing options...
gebeer Posted December 18, 2020 Share Posted December 18, 2020 Thank you for this module! It was not working for me until I found out that the HTML created by CKEditor was something like <p style="margin-left:0cm; margin-right:0cm">https://www.youtube.com/watch?v=Lh63JcccM7k</p> So the <p> tag has a style attribute. The regex (line 180 in module php) does not cater for that. $regex = '#<p>\s*(https?://(?:www\.)?youtu(?:.be|be.com)+/(?:watch/?\?v=|v/)?([^\s&<\'"]+))(&[-_,.=&;a-zA-Z0-9]*)?.*?</p>#'; I adjusted it, so that it also works for paragraphs with attributes $regex = '#<p.*>\s*(https?://(?:www\.)?youtu(?:.be|be.com)+/(?:watch/?\?v=|v/)?([^\s&<\'"]+))(&[-_,.=&;a-zA-Z0-9]*)?.*?</p>#'; @Lex Sanchez maybe you want to implement this in your module. 1 Link to comment Share on other sites More sharing options...
Jozsef Posted December 18, 2020 Share Posted December 18, 2020 On 10/16/2020 at 5:36 AM, Gideon So said: All works fine but I am not able to embed FB videos. I get this error on the page: Video Unavailable This video may no longer exist, or you don't have permission to view it. @Gideon So Unfortunately Facebook doesn't allow embedding content anymore (started on 24th October 2020) unless the site is authenticated. More here: https://developers.facebook.com/docs/plugins/oembed This includes Facebook and Instagram Link to comment Share on other sites More sharing options...
Jozsef Posted December 18, 2020 Share Posted December 18, 2020 @999design I have the same issue, even though the paragraph tags have no attributes in my case. Tried it as links and as plain text between p tags, no luck. 1 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now