Skip to content

Commit

Permalink
MediaEmbed: updated Giphy
Browse files Browse the repository at this point in the history
  • Loading branch information
JoshyPHP committed May 25, 2024
1 parent 34912a8 commit 3001de2
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/Bundles/MediaPack.php

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ class CachedDefinitionCollection extends SiteDefinitionCollection
'gamespot'=>['attributes'=>[],'example'=>['https://www.gamespot.com/destiny/videos/destiny-the-moon-trailer-6415176/','https://www.gamespot.com/events/game-crib-tsm-snapdragon/gamecrib-extras-cooking-with-dan-dinh-6412922/','https://www.gamespot.com/videos/beat-the-pros-pax-prime-2013/2300-6414307/'],'extract'=>['!gamespot\\.com.*?/(?:events|videos)/.*?-(?\'id\'\\d+)/(?:[#?].*)?$!'],'homepage'=>'https://www.gamespot.com/','host'=>['gamespot.com'],'iframe'=>['src'=>'//www.gamespot.com/videos/embed/{@id}/'],'name'=>'Gamespot','scrape'=>[],'tags'=>['gaming']],
'getty'=>['attributes'=>['et'=>['required'=>true],'height'=>['defaultValue'=>360,'filterChain'=>['#uint']],'sig'=>['required'=>true],'width'=>['defaultValue'=>640,'filterChain'=>['#uint']]],'example'=>['https://gty.im/3232182','https://www.gettyimages.com/detail/3232182','https://www.gettyimages.com/detail/news-photo/the-beatles-travel-by-coach-to-the-west-country-for-some-news-photo/3232182','https://www.gettyimages.co.uk/detail/3232182'],'extract'=>[],'homepage'=>'https://www.gettyimages.com/','host'=>['gettyimages.be','gettyimages.cn','gettyimages.co.jp','gettyimages.co.uk','gettyimages.com','gettyimages.com.au','gettyimages.de','gettyimages.dk','gettyimages.es','gettyimages.fr','gettyimages.ie','gettyimages.it','gettyimages.nl','gettyimages.pt','gettyimages.se','gty.im'],'iframe'=>['height'=>'{@height}','src'=>'//embed.gettyimages.com/embed/{@id}?et={@et}&tld=com&sig={@sig}&caption=false&ver=1','width'=>'{@width}'],'name'=>'Getty Images','scrape'=>[['extract'=>['!/embed/(?\'id\'\\d+)!','!"height":[ "]*(?\'height\'\\d+)!','!"width":[ "]*(?\'width\'\\d+)!','!\\?et=(?\'et\'[-=\\w]+)!','!\\\\u0026sig=(?\'sig\'[-=\\w]+)!'],'match'=>['!(?:gty\\.im|gettyimages\\.[.\\w]+/detail(?=/).*?)/(?\'id\'\\d+)!'],'url'=>'https://embed.gettyimages.com/preview/{@id}']],'tags'=>['images']],
'gifs'=>['attributes'=>['height'=>['defaultValue'=>360,'filterChain'=>['#uint']],'width'=>['defaultValue'=>640,'filterChain'=>['#uint']]],'example'=>['https://gifs.com/gif/zm4DLy','https://j.gifs.com/Y6YZoO.gif'],'extract'=>['!gifs\\.com/(?:gif/)?(?\'id\'\\w+)!'],'homepage'=>'https://gifs.com/','host'=>['gifs.com'],'iframe'=>['height'=>'{@height}','src'=>'//gifs.com/embed/{@id}','width'=>'{@width}'],'name'=>'Gifs.com','scrape'=>[['extract'=>['!meta property="og:image:width" content="(?\'width\'\\d+)!','!meta property="og:image:height" content="(?\'height\'\\d+)!'],'match'=>['//'],'url'=>'https://gifs.com/gif/{@id}']],'tags'=>['images'],'video'=>['height'=>'{@height}','poster'=>'https://j.gifs.com/{@id}.jpg','source'=>[['src'=>'https://j.gifs.com/{@id}@large.mp4','type'=>'video/mp4'],['src'=>'https://j.gifs.com/{@id}.mp4','type'=>'video/mp4']],'width'=>'{@width}']],
'giphy'=>['attributes'=>['height'=>['defaultValue'=>360,'filterChain'=>['#uint']],'width'=>['defaultValue'=>640,'filterChain'=>['#uint']]],'example'=>['https://media.giphy.com/media/UGUqsAtHh3T1e/source.gif','https://giphy.com/gifs/cheezburger-sloth-yawn-FsjDdnIRcroIM','https://i.giphy.com/l41m1wcjpWJZi5w7S.gif','https://giphy.com/videos/quinnxcii-coffee-VG8PNQDwsfOzU4mQAL'],'extract'=>['!giphy\\.com/(?\'type\'gif|video|webp)\\w+/(?:[-\\w]+-)*(?\'id\'\\w+)!','!giphy\\.com/media/(?\'id\'\\w+)/\\w+\\.(?\'type\'gif|webp)!','!i\\.giphy\\.com/(?\'id\'\\w+)\\.(?\'type\'gif|webp)!'],'homepage'=>'https://giphy.com/','host'=>['giphy.com'],'iframe'=>['height'=>'{@height}','src'=>'//giphy.com/embed/<xsl:value-of select="@id"/><xsl:if test="@type=\'video\'">/video</xsl:if>','width'=>'{@width}'],'name'=>'GIPHY','scrape'=>[['extract'=>['!"height"\\s*:\\s*(?\'height\'\\d+)!','!"width"\\s*:\\s*(?\'width\'\\d+)!'],'match'=>['//'],'url'=>'https://giphy.com/services/oembed?url=https://media.giphy.com/media/{@id}/giphy.gif']],'tags'=>['images'],'video'=>['height'=>'{@height}','poster'=>'https://media.giphy.com/media/{@id}/giphy_s.gif','source'=>['src'=>'https://media.giphy.com/media/{@id}/giphy.mp4','type'=>'video/mp4'],'width'=>'{@width}']],
'giphy'=>['attributes'=>['height'=>['defaultValue'=>360,'filterChain'=>['#uint']],'width'=>['defaultValue'=>640,'filterChain'=>['#uint']]],'example'=>['https://media.giphy.com/media/UGUqsAtHh3T1e/source.gif','https://giphy.com/gifs/cheezburger-sloth-yawn-FsjDdnIRcroIM','https://i.giphy.com/l41m1wcjpWJZi5w7S.gif','https://giphy.com/videos/quinnxcii-coffee-VG8PNQDwsfOzU4mQAL'],'extract'=>['!giphy\\.com/(?\'type\'gif|video|webp)\\w+/(?:[-\\w]+-)*(?\'id\'\\w+)!','!giphy\\.com/media/(?\'id\'\\w+)/\\w+\\.(?\'type\'gif|webp)!','!i\\.giphy\\.com/(?\'id\'\\w+)\\.(?\'type\'gif|webp)!'],'homepage'=>'https://giphy.com/','host'=>['giphy.com'],'iframe'=>['height'=>'{@height}','src'=>'//giphy.com/embed/<xsl:value-of select="@id"/><xsl:if test="@type=\'video\'">/video</xsl:if>','width'=>'{@width}'],'name'=>'GIPHY','scrape'=>[['extract'=>['!"height"\\s*:\\s*(?\'height\'\\d+)!','!"width"\\s*:\\s*(?\'width\'\\d+)!'],'header'=>['Accept: */*','User-agent: PHP'],'match'=>['//'],'url'=>'https://giphy.com/services/oembed?url=https://media.giphy.com/media/{@id}/giphy.gif']],'tags'=>['images'],'video'=>['height'=>'{@height}','poster'=>'https://media.giphy.com/media/{@id}/giphy_s.gif','source'=>['src'=>'https://media.giphy.com/media/{@id}/giphy.mp4','type'=>'video/mp4'],'width'=>'{@width}']],
'gist'=>['amp'=>['custom-element'=>'amp-gist','src'=>'https://cdn.ampproject.org/v0/amp-gist-0.1.js','template'=>'<amp-gist layout="fixed-height" height="180"><xsl:attribute name="data-gistid"><xsl:choose><xsl:when test="contains(@id,\'/\')"><xsl:choose><xsl:when test="contains(substring-after(@id,\'/\'),\'/\')"><xsl:value-of select="substring-before(substring-after(@id,\'/\'),\'/\')"/></xsl:when><xsl:otherwise><xsl:value-of select="substring-after(@id,\'/\')"/></xsl:otherwise></xsl:choose></xsl:when><xsl:otherwise><xsl:value-of select="@id"/></xsl:otherwise></xsl:choose></xsl:attribute></amp-gist>'],'attributes'=>[],'example'=>['https://gist.github.com/JoshyPHP/0ee8433f5a9a779d08ef','https://gist.github.com/6806305','https://gist.github.com/JoshyPHP/6806305/ad88d904b082c8211afa040162402015aacb8599'],'extract'=>['@gist\\.github\\.com/(?\'id\'(?:[-\\w]+/)?[\\da-f]+(?:/[\\da-f]+)?\\b(?!/archive))@'],'homepage'=>'https://gist.github.com/','host'=>['github.com'],'iframe'=>['data-s9e-livepreview-ignore-attrs'=>'style','height'=>180,'onload'=>'let c=new MessageChannel;c.port1.onmessage=e=>this.style.height=e.data+\'px\';this.contentWindow.postMessage(\'s9e:init\',\'*\',[c.port2])','scrolling'=>'','src'=>'https://s9e.github.io/iframe/2/gist.min.html#{@id}','width'=>'100%'],'name'=>'GitHub Gist','scrape'=>[],'tags'=>['programming'],'tracking_policy'=>'https://docs.github.com/en/site-policy/privacy-policies/github-privacy-statement#cookies-and-tracking-technologies'],
'globalnews'=>['attributes'=>[],'example'=>['https://globalnews.ca/video/1647385/mark-channels-his-70s-look/','https://globalnews.ca/video/rd/350539843530/?jwsource=cl'],'extract'=>['!globalnews\\.ca/video/(?\'id\'\\d+)!'],'homepage'=>'https://globalnews.ca/','host'=>['globalnews.ca'],'iframe'=>['src'=>'//globalnews.ca/video/embed/{@id}/'],'name'=>'Global News','scrape'=>[['extract'=>['!globalnews\\.ca/video/(?\'id\'\\d+)!'],'match'=>['!globalnews\\.ca/video/rd/!']]],'tags'=>['.ca','news']],
'gofundme'=>['attributes'=>[],'example'=>'https://www.gofundme.com/2p37ao','extract'=>['@gofundme\\.com/(?\'id\'\\w+)(?![^#?])@'],'homepage'=>'https://www.gofundme.com/','host'=>['gofundme.com'],'iframe'=>['height'=>207,'padding-height'=>208,'src'=>'//www.gofundme.com/mvc.php?route=widgets/mediawidget&fund={@id}&image=1&coinfo=1','width'=>349],'name'=>'GoFundMe','scrape'=>[],'tags'=>['fundraising']],
Expand Down
2 changes: 2 additions & 0 deletions src/Plugins/MediaEmbed/Configurator/sites/giphy.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
<extract>!giphy\.com/media/(?'id'\w+)/\w+\.(?'type'gif|webp)!</extract>
<extract>!i\.giphy\.com/(?'id'\w+)\.(?'type'gif|webp)!</extract>
<scrape url="https://giphy.com/services/oembed?url=https://media.giphy.com/media/{@id}/giphy.gif">
<header>Accept: */*</header>
<header>User-agent: PHP</header>
<extract>!"height"\s*:\s*(?'height'\d+)!</extract>
<extract>!"width"\s*:\s*(?'width'\d+)!</extract>
</scrape>
Expand Down

0 comments on commit 3001de2

Please sign in to comment.