Skip to content

Commit a85aa81

Browse files
author
Andrei Igna
committed
update Readme & examples
1 parent 50b0be5 commit a85aa81

3 files changed

Lines changed: 67 additions & 34 deletions

File tree

CONTRIBUTING

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ Contributions are **welcome** and will be fully **credited**.
44

55
We accept contributions via Pull Requests on [Github](https://github.com/LayeredStudio/url-preview).
66

7+
Please check [Issues](https://github.com/LayeredStudio/url-preview/issues) and [Pull Requests](https://github.com/LayeredStudio/url-preview/pulls), your patch/fix may be already in progress.
78

89
## Pull Requests
910

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"description": "Get preview data from any URL from the internet",
44
"type": "library",
55
"license": "MIT",
6-
"keywords": ["scraper", "url-preview", "opengraph"],
6+
"keywords": ["scraper", "url-preview", "link-preview", "opengraph", "embed", "oembed"],
77
"require": {
88
"fabpot/goutte": "^3.2"
99
},

example.php

Lines changed: 65 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -5,38 +5,70 @@
55

66
echo '<pre>';
77

8-
echo '<h1>YouTube</h1>';
9-
print_r(Layered\UrlPreview::load('https://www.youtube.com/')->getData());
10-
print_r(Layered\UrlPreview::load('https://www.youtube.com/watch?v=3iTYpWfP0Og')->getData());
11-
12-
echo '<h1>WordPress</h1>';
13-
print_r(Layered\UrlPreview::load('http://roberthajnal.ro/blog/2017/07/23/maraton-7500-2017/')->getData());
14-
print_r(Layered\UrlPreview::load('http://roberthajnal.ro/blog/2017/07/01/lavaredo-ultra-trail-la-ultra-si-cei-mai-buni-din-lume-se-taie/')->getData());
15-
16-
echo '<h1>Medium</h1>';
17-
print_r(Layered\UrlPreview::load('https://rokm.ro/')->getData());
18-
print_r(Layered\UrlPreview::load('https://medium.com/@andrewcouldwell/plasma-design-system-4d63fb6c1afc')->getData());
19-
print_r(Layered\UrlPreview::load('https://rokm.ro/what-makes-a-good-fitness-app-b5416d410002')->getData());
20-
21-
echo '<h1>Instagram</h1>';
22-
print_r(Layered\UrlPreview::load('https://instagram.com')->getData());
23-
print_r(Layered\UrlPreview::load('https://instagram.com/andreihere')->getData());
24-
print_r(Layered\UrlPreview::load('https://instagr.am/p/BYOgma8hoUK/')->getData());
25-
print_r(Layered\UrlPreview::load('https://www.instagram.com/p/BYjGxqkgQCm/?taken-by=daria_solak_illustrations')->getData());
26-
print_r(Layered\UrlPreview::load('https://www.instagram.com/p/BPezVTTjP7g/?taken-by=andreihere')->getData());
27-
28-
echo '<h1>Facebook</h1>';
29-
print_r(Layered\UrlPreview::load('https://facebook.com')->getData());
30-
print_r(Layered\UrlPreview::load('https://facebook.com/andreiigna')->getData());
31-
print_r(Layered\UrlPreview::load('https://www.facebook.com/cciuca/posts/1857443374282334')->getData());
32-
print_r(Layered\UrlPreview::load('https://www.facebook.com/mxgur/posts/10107274070905477')->getData());
33-
print_r(Layered\UrlPreview::load('https://www.facebook.com/photo.php?fbid=1889887641037956&set=a.764654416894623.1073741851.100000502141017&type=3&theater')->getData());
34-
35-
echo '<h1>Twitter</h1>';
36-
print_r(Layered\UrlPreview::load('https://twitter.com')->getData());
37-
print_r(Layered\UrlPreview::load('https://twitter.com/AndreiIgna')->getData());
38-
print_r(Layered\UrlPreview::load('https://twitter.com/AndreiIgna/status/903558303065759744')->getData());
39-
print_r(Layered\UrlPreview::load('https://twitter.com/AndreiIgna/status/890510906819571719')->getData());
40-
print_r(Layered\UrlPreview::load('https://twitter.com/AndreiIgna/status/902280395336626176')->getData());
8+
echo '<h1>Instagram site</h1>';
9+
$url = new Layered\UrlPreview('https://instagr.am');
10+
print_r($url->getPreview());
11+
print_r($url->getProfile());
12+
print_r($url->getSite());
13+
14+
echo '<h1>Instagram photo</h1>';
15+
$url = new Layered\UrlPreview('https://www.instagram.com/p/BYjGxqkgQCm/?taken-by=daria_solak_illustrations');
16+
print_r($url->getPreview());
17+
print_r($url->getProfile());
18+
print_r($url->getSite());
19+
20+
echo '<h1>Instagram video</h1>';
21+
$url = new Layered\UrlPreview('https://www.instagram.com/p/BPezVTTjP7g/?taken-by=andreihere');
22+
print_r($url->getPreview());
23+
print_r($url->getProfile());
24+
print_r($url->getSite());
25+
26+
echo '<h1>YouTube video</h1>';
27+
$url = new Layered\UrlPreview('https://www.youtube.com/watch?v=3iTYpWfP0Og');
28+
print_r($url->getPreview());
29+
print_r($url->getProfile());
30+
print_r($url->getSite());
31+
32+
echo '<h1>Tweet</h1>';
33+
$url = new Layered\UrlPreview('https://twitter.com/AndreiIgna/status/890510906819571719');
34+
print_r($url->getPreview());
35+
print_r($url->getProfile());
36+
print_r($url->getSite());
37+
38+
echo '<h1>Medium site</h1>';
39+
$url = new Layered\UrlPreview('https://rokm.ro/');
40+
print_r($url->getPreview());
41+
print_r($url->getProfile());
42+
print_r($url->getSite());
43+
44+
echo '<h1>Medium article</h1>';
45+
$url = new Layered\UrlPreview('https://medium.com/@andrewcouldwell/plasma-design-system-4d63fb6c1afc');
46+
print_r($url->getPreview());
47+
print_r($url->getProfile());
48+
print_r($url->getSite());
49+
50+
echo '<h1>Medium article</h1>';
51+
$url = new Layered\UrlPreview('https://rokm.ro/what-makes-a-good-fitness-app-b5416d410002');
52+
print_r($url->getPreview());
53+
print_r($url->getProfile());
54+
print_r($url->getSite());
55+
56+
echo '<h1>WordPress article</h1>';
57+
$url = new Layered\UrlPreview('http://roberthajnal.ro/blog/2017/07/23/maraton-7500-2017/');
58+
print_r($url->getPreview());
59+
print_r($url->getProfile());
60+
print_r($url->getSite());
61+
62+
echo '<h1>Facebook profile</h1>';
63+
$url = new Layered\UrlPreview('https://facebook.com/andreiigna');
64+
print_r($url->getPreview());
65+
print_r($url->getProfile());
66+
print_r($url->getSite());
67+
68+
echo '<h1>Facebook post</h1>';
69+
$url = new Layered\UrlPreview('https://www.facebook.com/mxgur/posts/10107274070905477');
70+
print_r($url->getPreview());
71+
print_r($url->getProfile());
72+
print_r($url->getSite());
4173

4274
echo '</pre>';

0 commit comments

Comments
 (0)