Skip to content

Commit

Permalink
MediaEmbed: updated Rutube
Browse files Browse the repository at this point in the history
Fixes #207
  • Loading branch information
JoshyPHP committed Dec 29, 2022
1 parent a684ae4 commit ba76ce0
Show file tree
Hide file tree
Showing 6 changed files with 81 additions and 86 deletions.
2 changes: 1 addition & 1 deletion docs/Plugins/MediaEmbed/Sites.md
Expand Up @@ -343,7 +343,7 @@
</tr>
<tr title="Rutube" id="rutube">
<td><code>rutube</code></td>
<td>https://rutube.ru/play/embed/4782775<br/>https://rutube.ru/tracks/4118278.html?v=8b490a46447720d4ad74616f5de2affd</td>
<td>https://rutube.ru/video/0771e73d1d10eee9c43ce31decc1dfce/</td>
</tr>
<tr title="Scribd" id="scribd">
<td><code>scribd</code></td>
Expand Down
136 changes: 68 additions & 68 deletions src/Bundles/MediaPack.php

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions src/Bundles/MediaPack/Renderer.php

Large diffs are not rendered by default.

Expand Up @@ -95,7 +95,7 @@ class CachedDefinitionCollection extends SiteDefinitionCollection
'prezi'=>['attributes'=>[],'example'=>'https://prezi.com/5ye8po_hmikp/10-most-common-rookie-presentation-mistakes/','extract'=>['#//prezi\\.com/(?!(?:a(?:bout|mbassadors)|c(?:o(?:llaborate|mmunity|ntact)|reate)|exp(?:erts|lore)|ip(?:ad|hone)|jobs|l(?:ear|ogi)n|m(?:ac|obility)|pr(?:es(?:s|ent)|icing)|recommend|support|user|windows|your)/)(?\'id\'\\w+)/#'],'homepage'=>'https://prezi.com/','host'=>['prezi.com'],'iframe'=>['height'=>400,'src'=>'//prezi.com/embed/{@id}/','width'=>550],'name'=>'Prezi','scrape'=>[],'tags'=>['presentations']],
'reddit'=>['amp'=>['custom-element'=>'amp-reddit','src'=>'https://cdn.ampproject.org/v0/amp-reddit-0.1.js','template'=>'<amp-reddit layout="responsive" width="450" height="300" data-embedtype="post" data-src="https://www.reddit.com/r/{@id}/"/>'],'attributes'=>[],'example'=>['https://www.reddit.com/r/pics/comments/9wp1qg/my_mom_recently_started_watercolor_painting_and/','https://www.reddit.com/r/pics/comments/9wp1qg/my_mom_recently_started_watercolor_painting_and/e9m6pn9/'],'extract'=>['!(?\'id\'\\w+/comments/\\w+(?:/\\w+/\\w+)?)!'],'homepage'=>'https://www.reddit.com/','host'=>['reddit.com'],'iframe'=>['data-s9e-livepreview-ignore-attrs'=>'style','height'=>165,'onload'=>'let c=new MessageChannel;c.port1.onmessage=e=>this.style.height=e.data+\'px\';this.contentWindow.postMessage(\'s9e:init\',\'*\',[c.port2])','src'=>'https://s9e.github.io/iframe/2/reddit.min.html#{@id}{@path}#theme={$MEDIAEMBED_THEME}','width'=>800],'name'=>'Reddit threads and comments','scrape'=>[],'source'=>'https://www.reddit.com/wiki/embeds','tags'=>['social']],
'rumble'=>['attributes'=>[],'example'=>'https://rumble.com/vaxo02-i-cant-climb-.html','extract'=>['!rumble\\.com/embed/(?\'id\'\\w+)!'],'homepage'=>'https://rumble.com/','host'=>['rumble.com'],'iframe'=>['src'=>'https://rumble.com/embed/{@id}/'],'name'=>'Rumble','oembed'=>['endpoint'=>'https://rumble.com/api/Media/oembed.json','scheme'=>'https://rumble.com/embed/{@id}/'],'scrape'=>[['extract'=>['!video"?:"(?\'id\'\\w+)!'],'match'=>['#rumble\\.com/(?!embed/).#']]],'tags'=>['videos']],
'rutube'=>['attributes'=>[],'example'=>['https://rutube.ru/play/embed/4782775','https://rutube.ru/tracks/4118278.html?v=8b490a46447720d4ad74616f5de2affd'],'extract'=>['!rutube\\.ru/(?:play/embed|tracks)/(?\'id\'\\d+)!'],'homepage'=>'https://rutube.ru/','host'=>['rutube.ru'],'iframe'=>['height'=>405,'src'=>'//rutube.ru/play/embed/{@id}','width'=>720],'name'=>'Rutube','oembed'=>['endpoint'=>'https://rutube.ru/api/oembed/','scheme'=>'https://rutube.ru/video/{@vid}/'],'scrape'=>[['extract'=>['!rutube\\.ru/play/embed/(?\'id\'\\d+)!'],'match'=>['!rutube\\.ru/video/(?\'vid\'[0-9a-f]{32})!'],'url'=>'https://rutube.ru/api/oembed/?url=https://rutube.ru/video/{@vid}/']],'tags'=>['.ru']],
'rutube'=>['attributes'=>[],'example'=>'https://rutube.ru/video/0771e73d1d10eee9c43ce31decc1dfce/','extract'=>['!rutube\\.ru/(?:play/embed/|tracks/.*?v=|video/)(?\'id\'\\w+)!'],'homepage'=>'https://rutube.ru/','host'=>['rutube.ru'],'iframe'=>['src'=>'//rutube.ru/play/embed/{@id}'],'name'=>'Rutube','oembed'=>['endpoint'=>'https://rutube.ru/api/oembed/','scheme'=>'https://rutube.ru/video/{@id}/'],'scrape'=>[],'tags'=>['.ru']],
'scribd'=>['attributes'=>[],'example'=>['https://www.scribd.com/doc/237147661/Calculus-2-Test-1-Review','https://www.scribd.com/presentation/324333881/600-1450-World-History-Jeopardy'],'extract'=>['!scribd\\.com/(?:mobile/)?(?:doc(?:ument)?|presentation)/(?\'id\'\\d+)!'],'homepage'=>'https://www.scribd.com/','host'=>['scribd.com'],'iframe'=>['height'=>500,'src'=>'https://www.scribd.com/embeds/{@id}/content?view_mode=scroll&show_recommendations=false','style'=>['resize'=>'vertical'],'width'=>'100%'],'name'=>'Scribd','scrape'=>[],'tags'=>['documents','presentations']],
'sendvid'=>['attributes'=>[],'example'=>'https://sendvid.com/w99u3jjp','extract'=>['!sendvid\\.com/(?\'id\'\\w+)!'],'homepage'=>'https://www.sendvid.com/','host'=>['sendvid.com'],'iframe'=>['src'=>'//sendvid.com/embed/{@id}'],'name'=>'Sendvid','scrape'=>[],'tags'=>['videos']],
'slideshare'=>['attributes'=>[],'example'=>'https://www.slideshare.net/Slideshare/how-23431564','extract'=>['!slideshare\\.net/[^/]+/[-\\w]+-(?\'id\'\\d{6,})$!'],'homepage'=>'https://www.slideshare.net/','host'=>['slideshare.net'],'iframe'=>['height'=>356,'src'=>'//www.slideshare.net/slideshow/embed_code/{@id}','width'=>427],'name'=>'SlideShare','scrape'=>[['extract'=>['!"presentationId":(?\'id\'\\d+)!'],'match'=>['@slideshare\\.net/[^/]+/\\w(?![-\\w]+-\\d{6,}$)@']]],'source'=>'http://help.slideshare.com/forums/67665-Embedding-Sharing','tags'=>['presentations']],
Expand Down
13 changes: 4 additions & 9 deletions src/Plugins/MediaEmbed/Configurator/sites/rutube.xml
@@ -1,17 +1,12 @@
<site name="Rutube" homepage="https://rutube.ru/">
<example>https://rutube.ru/play/embed/4782775</example>
<example>https://rutube.ru/tracks/4118278.html?v=8b490a46447720d4ad74616f5de2affd</example>
<example>https://rutube.ru/video/0771e73d1d10eee9c43ce31decc1dfce/</example>

<oembed endpoint="https://rutube.ru/api/oembed/"
scheme="https://rutube.ru/video/{@vid}/"/>
scheme="https://rutube.ru/video/{@id}/"/>

<tags><tag>.ru</tag></tags>

<host>rutube.ru</host>
<extract>!rutube\.ru/(?:play/embed|tracks)/(?'id'\d+)!</extract>
<scrape url="https://rutube.ru/api/oembed/?url=https://rutube.ru/video/{@vid}/">
<match>!rutube\.ru/video/(?'vid'[0-9a-f]{32})!</match>
<extract>!rutube\.ru/play/embed/(?'id'\d+)!</extract>
</scrape>
<iframe width="720" height="405" src="//rutube.ru/play/embed/{@id}"/>
<extract>!rutube\.ru/(?:play/embed/|tracks/.*?v=|video/)(?'id'\w+)!</extract>
<iframe src="//rutube.ru/play/embed/{@id}"/>
</site>
10 changes: 5 additions & 5 deletions tests/Plugins/MediaEmbed/ParserTest.php
Expand Up @@ -3443,17 +3443,17 @@ function ($configurator)
}
],
[
'http://rutube.ru/tracks/4118278.html?v=8b490a46447720d4ad74616f5de2affd',
'<r><RUTUBE id="4118278">http://rutube.ru/tracks/4118278.html?v=8b490a46447720d4ad74616f5de2affd</RUTUBE></r>',
'https://rutube.ru/play/embed/4782775',
'<r><RUTUBE id="4782775">https://rutube.ru/play/embed/4782775</RUTUBE></r>',
[],
function ($configurator)
{
$configurator->MediaEmbed->add('rutube');
}
],
[
'https://rutube.ru/play/embed/4782775',
'<r><RUTUBE id="4782775">https://rutube.ru/play/embed/4782775</RUTUBE></r>',
'https://rutube.ru/video/0771e73d1d10eee9c43ce31decc1dfce/',
'<r><RUTUBE id="0771e73d1d10eee9c43ce31decc1dfce">https://rutube.ru/video/0771e73d1d10eee9c43ce31decc1dfce/</RUTUBE></r>',
[],
function ($configurator)
{
Expand Down Expand Up @@ -5071,7 +5071,7 @@ function ($configurator)
],
[
'http://rutube.ru/tracks/4118278.html?v=8b490a46447720d4ad74616f5de2affd',
'<span data-s9e-mediaembed="rutube" style="display:inline-block;width:100%;max-width:720px"><span style="display:block;overflow:hidden;position:relative;padding-bottom:56.25%"><iframe allowfullscreen="" loading="lazy" scrolling="no" src="//rutube.ru/play/embed/4118278" style="border:0;height:100%;left:0;position:absolute;width:100%"></iframe></span></span>',
'<span data-s9e-mediaembed="rutube" style="display:inline-block;width:100%;max-width:640px"><span style="display:block;overflow:hidden;position:relative;padding-bottom:56.25%"><iframe allowfullscreen="" loading="lazy" scrolling="no" src="//rutube.ru/play/embed/8b490a46447720d4ad74616f5de2affd" style="border:0;height:100%;left:0;position:absolute;width:100%"></iframe></span></span>',
[],
function ($configurator)
{
Expand Down

0 comments on commit ba76ce0

Please sign in to comment.