ElkArte Community

Project Support => Support => Topic started by: fritzelly on August 23, 2018, 05:23:46 pm

Title: Disable Youtube parsing
Post by: fritzelly on August 23, 2018, 05:23:46 pm
Hi
I have one particular thread that has loads of youtube videos - this kills the loading of the thread
Is there anyway to disable the auto parsing/preview for this particular thread so that it just shows the links instead? Or point me to the code where I can add some exclusion for this particular thread?

Thanks
Title: Re: Disable Youtube parsing
Post by: Spuds on August 23, 2018, 08:34:33 pm
There is no setting that I can think of for that ... The loading of the images (it only loads the preview image) happens on the client end, the server simply dumps out the link and then the client JS reads the page and fetches the images from youtube.

You could edit elk_jquery_embed.js and use a window.location.href call to see if the topic=1234 in question is in the url and then skip the processing.  Thats a "hack" but its all I can think of ATM
Title: Re: Disable Youtube parsing
Post by: radu81 on August 24, 2018, 04:16:58 am
What about editing that topic and insert the YouTube links this way:

Link YouTube (https://youtube.com/watch?v=Ku4bRF8YCP0)

 [url=https://youtube.com/watch?v=Ku4bRF8YCP0]Link YouTube [/url]
Title: Re: Disable Youtube parsing
Post by: fritzelly on August 24, 2018, 02:44:59 pm
Will give that a go thanks
Title: Re: Disable Youtube parsing
Post by: emanuele on August 25, 2018, 03:26:38 am
We could also do with a "limit per page", something like with the attached.

Code: [Select]
		var oDefaultsSettings = {
preview_image : '',
embed_limit : 10,

Code: [Select]
		var domain_regex = /^[^:]*:\/\/(?:www\.)?([^\/]+)(\/.*)$/,
already_embedded = 0,

Code: [Select]
			// One of our video provider domains?
if (already_embedded < oSettings.embed_limit && m !== null && typeof(handlers[m[1]]) !== "undefined" && handlers[m[1]] !== null)
{

Code: [Select]
				if (args)
{
already_embedded++;

TBH I didn't test it, so it may be badly wrong. xD
@Spuds what do you think?
Title: Re: Disable Youtube parsing
Post by: Spuds on August 25, 2018, 10:54:18 am
Good ides ... looks like that should work just fine.

We could add an setting in the next release so the admin can set this from ACP
Title: Re: Disable Youtube parsing
Post by: Frenzie on August 25, 2018, 01:26:32 pm
I think 10 would be a rather low default though. :)
Title: Re: Disable Youtube parsing
Post by: emanuele on August 25, 2018, 02:34:36 pm
I wonder how many videos are on the page that is causing problems to @fritzelly .
Title: Re: Disable Youtube parsing
Post by: fritzelly on August 25, 2018, 02:38:20 pm
Quote from: emanuele – I wonder how many videos are on the page that is causing problems to @fritzelly .
A lot! 60+ probably even more