Skip to content

Commit 14f29a5

Browse files
committed
new version
1 parent ab291e4 commit 14f29a5

File tree

5 files changed

+100
-23
lines changed

5 files changed

+100
-23
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,11 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](http://keepachangelog.com/)
66
and this project adheres to [Semantic Versioning](http://semver.org/).
77

8+
## [4.2.4] - 2020-07-06
9+
### Fixed
10+
- Ignore invalid urls instead throw an exception
11+
- Updated oembed list of endpoints
12+
813
## [4.2.3] - 2020-06-12
914
### Fixed
1015
- Suppport for other non-latin alphabets such Persian or Arabic [#366]
@@ -70,6 +75,7 @@ Full library refactoring.
7075
[#357]: https://github.com/oscarotero/Embed/issues/357
7176
[#366]: https://github.com/oscarotero/Embed/issues/366
7277

78+
[4.2.4]: https://github.com/oscarotero/Embed/compare/v4.2.3...v4.2.4
7379
[4.2.3]: https://github.com/oscarotero/Embed/compare/v4.2.2...v4.2.3
7480
[4.2.2]: https://github.com/oscarotero/Embed/compare/v4.2.1...v4.2.2
7581
[4.2.1]: https://github.com/oscarotero/Embed/compare/v4.2.0...v4.2.1

README.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,19 +9,19 @@
99
[![Software License][ico-license]](LICENSE)
1010
[![SensioLabs Insight][ico-sensiolabs]][link-sensiolabs]
1111

12-
> Note: If you're using version 3, use [`v3.x` branch](https://github.com/oscarotero/Embed/tree/v3.x)
13-
1412
PHP library to get information from any web page (using oembed, opengraph, twitter-cards, scrapping the html, etc). It's compatible with any web service (youtube, vimeo, flickr, instagram, etc) and has adapters to some sites like (archive.org, github, facebook, etc).
1513

1614
Requirements:
1715

1816
* PHP 7.4+
1917
* Curl library installed
20-
* PSR-7 implementation. By default [these popular libraries](https://github.com/middlewares/awesome-psr15-middlewares#psr-7-implementations) are detected automatically
18+
* PSR-17 implementation. By default these libraries are detected automatically:
19+
* [laminas/laminas-diactoros](https://github.com/laminas/laminas-diactoros)
20+
* [guzzle/psr7](https://github.com/guzzle/psr7) (Only the unreleased version 2.x, installed as `dev-master`)
21+
* [nyholm/psr7](https://github.com/Nyholm/psr7)
22+
* [sunrise/http-message](https://github.com/sunrise-php/http-message)
2123

22-
> * If you need PHP 5.3 support, use the 1.x version
23-
> * If you need PHP 5.4 support, use the 2.x version
24-
> * If you need PHP 5.5-7.3 support, [use the 3.x version](https://github.com/oscarotero/Embed/tree/v3.x)
24+
> If you need PHP 5.5-7.3 support, [use the 3.x version](https://github.com/oscarotero/Embed/tree/v3.x)
2525
2626
## Online demo
2727

src/ApiTrait.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55

66
use Datetime;
77
use Psr\Http\Message\UriInterface;
8+
use Throwable;
89

910
trait ApiTrait
1011
{
@@ -83,7 +84,11 @@ public function url(string ...$keys): ?UriInterface
8384
{
8485
$url = $this->str(...$keys);
8586

86-
return $url ? $this->extractor->resolveUri($url) : null;
87+
try {
88+
return $url ? $this->extractor->resolveUri($url) : null;
89+
} catch (Throwable $error) {
90+
return null;
91+
}
8792
}
8893

8994
public function time(string ...$keys): ?Datetime

src/QueryResult.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
use DOMElement;
88
use DOMNodeList;
99
use Psr\Http\Message\UriInterface;
10+
use Throwable;
1011

1112
class QueryResult
1213
{
@@ -86,7 +87,11 @@ public function url(string $attribute = null): ?UriInterface
8687
return null;
8788
}
8889

89-
return $this->extractor->resolveUri($value);
90+
try {
91+
return $this->extractor->resolveUri($value);
92+
} catch (Throwable $error) {
93+
return null;
94+
}
9095
}
9196

9297
private static function getAttribute(DOMElement $node, string $name): ?string

src/resources/oembed.php

Lines changed: 76 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,9 @@
1515
'|^https?://alpha\\.app\\.net/.*/post/.*$|i',
1616
'|^https?://photos\\.app\\.net/.*/.*$|i',
1717
],
18-
'https://api.altrulabs.com/social/oembed' => [
18+
'https://api.altrulabs.com/api/v1/social/oembed' => [
1919
'|^https?://app\\.altrulabs\\.com/.*/.*\\?answer_id\\=.*$|i',
20+
'|^https?://app\\.altrulabs\\.com/player/.*$|i',
2021
],
2122
'https://live.amcharts.com/oembed' => [
2223
'|^https?://live\\.amcharts\\.com/.*$|i',
@@ -38,24 +39,28 @@
3839
'|^https?://app\\.archivos\\.digital/app/view/.*$|i',
3940
],
4041
'https://audioboom.com/publishing/oembed/v4.json' => [
42+
'|^https?://audioboom\\.com/channels/.*$|i',
4143
'|^https?://audioboom\\.com/channel/.*$|i',
4244
'|^https?://audioboom\\.com/posts/.*$|i',
4345
],
4446
'https://audioclip.naver.com/oembed' => [
4547
'|^https?://audioclip\\.naver\\.com/channels/.*/clips/.*$|i',
4648
'|^https?://audioclip\\.naver\\.com/audiobooks/.*$|i',
4749
],
48-
'https://www.audiomack.com/oembed' => [
49-
'|^https?://www\\.audiomack\\.com/song/.*$|i',
50-
'|^https?://www\\.audiomack\\.com/album/.*$|i',
51-
'|^https?://www\\.audiomack\\.com/playlist/.*$|i',
50+
'https://audiomack.com/oembed' => [
51+
'|^https?://audiomack\\.com/.*/song/.*$|i',
52+
'|^https?://audiomack\\.com/.*/album/.*$|i',
53+
'|^https?://audiomack\\.com/.*/playlist/.*$|i',
5254
],
5355
'http://audiosnaps.com/service/oembed' => [
5456
'|^https?://audiosnaps\\.com/k/.*$|i',
5557
],
5658
'https://stage-embed.avocode.com/api/oembed' => [
5759
'|^https?://app\\.avocode\\.com/view/.*$|i',
5860
],
61+
'http://axiom.ninja/oembed/' => [
62+
'|^https?://axiom\\.ninja/.*$|i',
63+
],
5964
'https://backtracks.fm/oembed' => [
6065
'|^https?://backtracks\\.fm/.*/.*/e/.*$|i',
6166
'|^https?://backtracks\\.fm/.*/s/.*/.*$|i',
@@ -113,6 +118,9 @@
113118
'|^https?://clyp\\.it/.*$|i',
114119
'|^https?://clyp\\.it/playlist/.*$|i',
115120
],
121+
'https://app.ilovecoco.video/api/oembed.json' => [
122+
'|^https?://app\\.ilovecoco\\.video/.*/embed$|i',
123+
],
116124
'https://codehs.com/api/sharedprogram/*/oembed/' => [
117125
'|^https?://codehs\\.com/editor/share_abacus/.*$|i',
118126
],
@@ -150,6 +158,9 @@
150158
'https://www.dailymotion.com/services/oembed' => [
151159
'|^https?://www\\.dailymotion\\.com/video/.*$|i',
152160
],
161+
'https://api.datawrapper.de/v3/oembed/' => [
162+
'|^https?://datawrapper\\.dwcdn\\.net/.*$|i',
163+
],
153164
'https://embed.deseret.com/' => [
154165
'|^https?://.*\\.deseret\\.com/.*$|i',
155166
],
@@ -176,6 +187,7 @@
176187
'https://www.docdroid.net/api/oembed' => [
177188
'|^https?://.*\\.docdroid\\.net/.*$|i',
178189
'|^https?://docdro\\.id/.*$|i',
190+
'|^https?://.*\\.docdroid\\.com/.*$|i',
179191
],
180192
'http://dotsub.com/services/oembed' => [
181193
'|^https?://dotsub\\.com/view/.*$|i',
@@ -198,6 +210,9 @@
198210
'http://embedarticles.com/oembed/' => [
199211
'|^https?://embedarticles\\.com/.*$|i',
200212
],
213+
'https://embedery.com/api/oembed' => [
214+
'|^https?://embedery\\.com/widget/.*$|i',
215+
],
201216
'http://api.embed.ly/1/oembed' => [
202217
'|^https?://api\\.embed\\.ly/.*$|i',
203218
],
@@ -311,6 +326,9 @@
311326
'|^https?://hearthis\\.at/.*/.*/$|i',
312327
'|^https?://hearthis\\.at/.*/set/.*/$|i',
313328
],
329+
'https://player.hihaho.com/services/oembed/*' => [
330+
'|^https?://player\\.hihaho\\.com/.*$|i',
331+
],
314332
'https://homey.app/api/oembed/flow' => [
315333
'|^https?://homey\\.app/f/.*$|i',
316334
'|^https?://homey\\.app/.*/flow/.*$|i',
@@ -401,6 +419,9 @@
401419
'https://jdr.knacki.info/oembed' => [
402420
'|^https?://jdr\\.knacki\\.info/meuh/.*$|i',
403421
],
422+
'https://api.spoonacular.com/knowledge/oembed' => [
423+
'|^https?://knowledgepad\\.co/\\#/knowledge/.*$|i',
424+
],
404425
'http://learningapps.org/oembed.php' => [
405426
'|^https?://learningapps\\.org/.*$|i',
406427
],
@@ -450,6 +471,10 @@
450471
'https://api.microlink.io' => [
451472
'|^https?://api\\.microlink\\.io.*$|i',
452473
],
474+
'https://web.microsoftstream.com/oembed' => [
475+
'|^https?://.*\\.microsoftstream\\.com/video/.*$|i',
476+
'|^https?://.*\\.microsoftstream\\.com/channel/.*$|i',
477+
],
453478
'https://www.mixcloud.com/oembed/' => [
454479
'|^https?://www\\.mixcloud\\.com/.*/.*/$|i',
455480
],
@@ -496,6 +521,15 @@
496521
'|^https?://www\\.odds\\.com\\.au/.*$|i',
497522
'|^https?://odds\\.com\\.au/.*$|i',
498523
],
524+
'https://song.link/oembed' => [
525+
'|^https?://song\\.link/.*$|i',
526+
'|^https?://album\\.link/.*$|i',
527+
'|^https?://artist\\.link/.*$|i',
528+
'|^https?://playlist\\.link/.*$|i',
529+
'|^https?://pods\\.link/.*$|i',
530+
'|^https?://mylink\\.page/.*$|i',
531+
'|^https?://odesli\\.co/.*$|i',
532+
],
499533
'http://official.fm/services/oembed.json' => [
500534
'|^https?://official\\.fm/tracks/.*$|i',
501535
'|^https?://official\\.fm/playlists/.*$|i',
@@ -529,13 +563,19 @@
529563
'https://core.oz.com/oembed' => [
530564
'|^https?://www\\.oz\\.com/.*/video/.*$|i',
531565
],
566+
'https://padlet.com/oembed/' => [
567+
'|^https?://padlet\\.com/.*$|i',
568+
],
532569
'https://www.pastery.net/oembed' => [
533570
'|^https?://pastery\\.net/.*$|i',
534571
'|^https?://www\\.pastery\\.net/.*$|i',
535572
],
536573
'https://beta.pingvp.com.kpnis.nl/p/oembed.php' => [
537574
'|^https?://www\\.pingvp\\.com/.*$|i',
538575
],
576+
'https://tools.pinpoll.com/oembed' => [
577+
'|^https?://tools\\.pinpoll\\.com/.*$|i',
578+
],
539579
'https://store.pixdor.com/oembed' => [
540580
'|^https?://store\\.pixdor\\.com/place\\-marker\\-widget/.*/show$|i',
541581
'|^https?://store\\.pixdor\\.com/map/.*/show$|i',
@@ -561,12 +601,21 @@
561601
'|^https?://posixion\\.com/question/.*$|i',
562602
'|^https?://posixion\\.com/.*/question/.*$|i',
563603
],
604+
'https://oembed.qualifio.com/' => [
605+
'|^https?://qualifio\\.com/.*$|i',
606+
],
564607
'http://www.quiz.biz/api/oembed' => [
565608
'|^https?://www\\.quiz\\.biz/quizz\\-.*\\.html$|i',
566609
],
567610
'http://www.quizz.biz/api/oembed' => [
568611
'|^https?://www\\.quizz\\.biz/quizz\\-.*\\.html$|i',
569612
],
613+
'https://oembed.radiopublic.com/oembed' => [
614+
'|^https?://play\\.radiopublic\\.com/.*$|i',
615+
'|^https?://radiopublic\\.com/.*$|i',
616+
'|^https?://www\\.radiopublic\\.com/.*$|i',
617+
'|^https?://.*\\.radiopublic\\.com/.*\'$|i',
618+
],
570619
'https://rapidengage.com/api/oembed' => [
571620
'|^https?://rapidengage\\.com/s/.*$|i',
572621
],
@@ -600,6 +649,9 @@
600649
'https://rumble.com/api/Media/oembed.json' => [
601650
'|^https?://rumble\\.com/.*$|i',
602651
],
652+
'https://embed.runkit.com/oembed' => [
653+
'|^https?://embed\\.runkit\\.com/.*,$|i',
654+
],
603655
'http://videos.sapo.pt/oembed' => [
604656
'|^https?://videos\\.sapo\\.pt/.*$|i',
605657
],
@@ -664,9 +716,6 @@
664716
'|^https?://www\\.socialexplorer\\.com/.*/edit$|i',
665717
'|^https?://www\\.socialexplorer\\.com/.*/embed$|i',
666718
],
667-
'https://song.link/oembed' => [
668-
'|^https?://song\\.link/.*$|i',
669-
],
670719
'https://soundcloud.com/oembed' => [
671720
'|^https?://soundcloud\\.com/.*$|i',
672721
],
@@ -721,6 +770,10 @@
721770
'|^https?://www\\.tickcounter\\.com/ticker/.*$|i',
722771
'|^https?://www\\.tickcounter\\.com/worldclock/.*$|i',
723772
],
773+
'https://www.tiktok.com/oembed' => [
774+
'|^https?://www\\.tiktok\\.com/.*/video/.*$|i',
775+
'|^https?://.*\\.tiktok\\.com/.*$|i',
776+
],
724777
'https://widget.toornament.com/oembed' => [
725778
'|^https?://www\\.toornament\\.com/tournaments/.*/information$|i',
726779
'|^https?://www\\.toornament\\.com/tournaments/.*/registration/$|i',
@@ -802,12 +855,10 @@
802855
'|^https?://vidl\\.it/.*$|i',
803856
],
804857
'https://app-v2.vidmizer.com/api/oembed' => [
805-
'|^https?://players\\.vidmizer\\.com/.*$|i',
858+
'|^https?://players\\-cdn\\-v2\\.vidmizer\\.com/.*$|i',
806859
],
807860
'https://api.vidyard.com/dashboard/v1.1/oembed' => [
808-
'|^https?://embed\\.vidyard\\.com/.*$|i',
809-
'|^https?://play\\.vidyard\\.com/.*$|i',
810-
'|^https?://share\\.vidyard\\.com/.*$|i',
861+
'|^https?://.*\\.vidyard\\.com/.*$|i',
811862
'|^https?://.*\\.hubs\\.vidyard\\.com/.*$|i',
812863
],
813864
'https://vimeo.com/api/oembed.json' => [
@@ -839,6 +890,10 @@
839890
'https://data.voxsnap.com/oembed' => [
840891
'|^https?://article\\.voxsnap\\.com/.*/.*$|i',
841892
],
893+
'https://embed.wave.video/oembed' => [
894+
'|^https?://watch\\.wave\\.video/.*$|i',
895+
'|^https?://embed\\.wave\\.video/.*$|i',
896+
],
842897
'http://play.wecandeo.com/oembed' => [
843898
'|^https?://www\\.wecandeo\\.com/.*$|i',
844899
],
@@ -854,6 +909,9 @@
854909
'|^https?://.*\\.wizer\\.me/learn/.*$|i',
855910
'|^https?://.*\\.wizer\\.me/preview/.*$|i',
856911
],
912+
'https://wokwi.com/api/oembed' => [
913+
'|^https?://wokwi\\.com/share/.*$|i',
914+
],
857915
'http://www.wootled.com/oembed' => [
858916
'|^https?://www\\.wootled\\.com/.*$|i',
859917
],
@@ -877,6 +935,12 @@
877935
'|^https?://youtu\\.be/.*$|i',
878936
'|^https?://.*\\.youtube\\.com/playlist\\?.*$|i',
879937
],
938+
'https://app.zeplin.io/embed' => [
939+
'|^https?://app\\.zeplin\\.io/project/.*/screen/.*$|i',
940+
'|^https?://app\\.zeplin\\.io/project/.*/screen/.*/version/.*$|i',
941+
'|^https?://app\\.zeplin\\.io/project/.*/styleguide/components\\?coid\\=.*$|i',
942+
'|^https?://app\\.zeplin\\.io/styleguide/.*/components\\?coid\\=.*$|i',
943+
],
880944
'https://app.zingsoft.com/oembed' => [
881945
'|^https?://app\\.zingsoft\\.com/embed/.*$|i',
882946
'|^https?://app\\.zingsoft\\.com/view/.*$|i',
@@ -898,7 +962,4 @@
898962
'|^https?://imgur\\.com/.*$|i',
899963
'|^https?://i\\.imgur\\.com/.*$|i',
900964
],
901-
'https://www.tiktok.com/oembed' => [
902-
'|^https?://.*\\.tiktok\\.com/.*$|i',
903-
],
904965
];

0 commit comments

Comments
 (0)