Skip to content

Commit 29948f4

Browse files
authored
More provider validation (iamcal#679)
- removed providers that don't follow the API, since they should only use discovery - removed/disabled providers that need wildcard domains - removed wildcards from API URLs - fixed example URLs to be oEmbed URLs, not regular page URLs - adding missing schemes in example URLs - fixed typo in API URL (.com.com) - dev and staging domains don't need to be in a public catalog - stronger tests for API URL and example URLs
1 parent c9b5e7e commit 29948f4

20 files changed

+39
-73
lines changed
File renamed without changes.
File renamed without changes.
File renamed without changes.

providers/wiredrive.yml renamed to providers-disabled/wiredrive.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@
66
- https://*.wiredrive.com/*
77
url: http://*.wiredrive.com/present-oembed/
88
example_urls:
9-
- deckers.wiredrive.com/present-oembed?url=deckers.wiredrive.com/363254/851732644105a5a8b3fa14fe164452df
9+
- http://deckers.wiredrive.com/present-oembed?url=deckers.wiredrive.com/363254/851732644105a5a8b3fa14fe164452df
1010
formats:
1111
- json
1212
discovery: true
1313
notes:
1414
- 'URL Scheme: `http://*.wiredrive.com/*` (where wiredrive.com = Wiredrive customer domain)'
15-
...
15+
...

providers/HASH.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
- https://core.hash.ai/@*
77
url: https://api.hash.ai/oembed
88
example_urls:
9-
- https://core.hash.ai/@hash/wildfires-regrowth/stable
10-
- https://core.hash.ai/@hash/warehouse-logistics/stable
11-
- https://core.hash.ai/@hash/traffic-intersection/stable
9+
- https://api.hash.ai/oembed?url=https://core.hash.ai/@hash/wildfires-regrowth/stable
10+
- https://api.hash.ai/oembed?url=https://core.hash.ai/@hash/warehouse-logistics/stable
11+
- https://api.hash.ai/oembed?url=https://core.hash.ai/@hash/traffic-intersection/stable
1212
discovery: false
1313
...

providers/adways.yml

Lines changed: 0 additions & 10 deletions
This file was deleted.

providers/apester.yml

Lines changed: 0 additions & 12 deletions
This file was deleted.

providers/avocode.yml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,7 @@
66
- https://app.avocode.com/view/*
77
url: https://stage-embed.avocode.com/api/oembed
88
example_urls:
9-
- https://app.avocode.com/view/a851fc49602446be8c1ef6e5dc3845d8
10-
- https://app.avocode.com/view/a851fc49602446be8c1ef6e5dc3845d8/_/comments/
11-
- https://app.avocode.com/view/a851fc49602446be8c1ef6e5dc3845d8/33250729/comments/
9+
- https://stage-embed.avocode.com/api/oembed?url=https://app.avocode.com/view/a851fc49602446be8c1ef6e5dc3845d8
1210
formats:
1311
- json
1412
...

providers/buttondown.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
- https://buttondown.email/*
66
url: https://buttondown.email/embed
77
example_urls:
8-
- https://buttondown.email/jmduke
8+
- https://buttondown.email/embed?url=https://buttondown.email/jmduke
99
formats:
1010
- json
1111
discovery: true

providers/codehs.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
endpoints:
55
- schemes:
66
- https://codehs.com/editor/share_abacus/*
7-
url: https://codehs.com/api/sharedprogram/*/oembed/
7+
url: https://codehs.com/api/sharedprogram/1/oembed/
88
docs_url: http://www.codehs.com
99
example_urls:
1010
- https://codehs.com/api/sharedprogram/1/oembed/?url=https://codehs.com/editor/share_abacus/xtOPDik2wNFjSDUoyl2T

providers/codepoints.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,5 @@
1111
example_urls:
1212
- https://codepoints.net/api/v1/oembed?url=https%3A%2F%2Fcodepoints.net%2FU%2B00E4&format=json
1313
- https://codepoints.net/api/v1/oembed?url=https%3A%2F%2Fcodepoints.net%2FA&format=xml&maxwidth=64
14-
- https://codepoints.net/U+2665
1514
discovery: true
1615
...

providers/exco.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
- https://www.playbuzz.com/*
88
url: https://oembed.ex.co/item
99
example_urls:
10-
- https://oembed.ex.co/item?id=8fb2343f-fa5d-48d4-8723-f8b5d51cc1a9
1110
- https://oembed.ex.co/item?url=https://app.ex.co/stories/item/8fb2343f-fa5d-48d4-8723-f8b5d51cc1a9
1211
- https://oembed.ex.co/item?url=https://app.ex.co/stories/paolagarcia10/remembering-september-11th-flash-back-to-images-we-will-never-forget
1312
- https://oembed.ex.co/item?url=https://www.playbuzz.com/paolagarcia10/remembering-september-11th-flash-back-to-images-we-will-never-forget

providers/knowledgepad.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@
66
- https://knowledgepad.co/#/knowledge/*
77
url: https://api.spoonacular.com/knowledge/oembed
88
example_urls:
9-
- https://knowledgepad.co/#/knowledge/1
10-
- https://knowledgepad.co/#/knowledge/0
11-
- https://knowledgepad.co/#/knowledge/0/183
9+
- https://api.spoonacular.com/knowledge/oembed?url=https://knowledgepad.co/#/knowledge/1
10+
- https://api.spoonacular.com/knowledge/oembed?url=https://knowledgepad.co/#/knowledge/0
11+
- https://api.spoonacular.com/knowledge/oembed?url=https://knowledgepad.co/#/knowledge/0/183
1212
formats:
1313
- json
1414
...

providers/ora_tv.yml

Lines changed: 0 additions & 9 deletions
This file was deleted.

providers/pitchhub.yml

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,9 @@
33
provider_url: https://www.pitchhub.com/
44
endpoints:
55
- schemes:
6-
- https://*.pitchhub.com/en/public/player/*
7-
url: https://*.pitchhub.com.com/en/public/oembed
6+
- https://player.pitchhub.com/en/public/player/*
7+
url: https://player.pitchhub.com/en/public/oembed
88
discovery: true
99
example_urls:
10-
- https://player-dev.pitchhub.com/en/public/oembed?url=https://player-dev.pitchhub.com/en/public/player/9330fd8734deb58345c80dd124203b57&format=json
11-
- https://player-staging.pitchhub.com/en/public/oembed?url=https://player-staging.pitchhub.com/en/public/player/296599c9ff2a945eb33d403929e92f35&format=json
1210
- https://player.pitchhub.com/en/public/oembed?url=https://player.pitchhub.com/en/public/player/296599c9ff2a945eb33d403929e92f35&format=json
13-
notes:
14-
- 'URL Scheme: `https://*.pitchhub.com.com/*` (where subdomain can be `player`, `player-staging`, `player-dev` )'
1511
...

providers/rcvis.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@
1010
url: https://animatron.com/oembed
1111
docs_url: https://rcvis.readthedocs.io/en/latest/index.html?highlight=oembed#oembed
1212
example_urls:
13-
- https://rcvis.com/v/macomb-multiwinner-surplusjson-3
14-
- https://rcvis.com/v/opavote2json
15-
- https://rcvis.com/v/2018_maine_gov_primary_demjson
13+
- https://rcvis.com/oembed?url=https%3A%2F%2Frcvis.com%2Fvo%2Fmacomb-multiwinner-surplusjson-3%2Fbarchart-interactive
14+
- https://rcvis.com/oembed?url=https%3A%2F%2Frcvis.com%2Fvo%2Fopavote2json%2Fbarchart-interactive
15+
- https://rcvis.com/oembed?url=https%3A%2F%2Frcvis.com%2Fvo%2F2018_maine_gov_primary_demjson%2Fbarchart-interactive
1616
discovery: true
1717
...

providers/switcherstudio.yml

Lines changed: 0 additions & 16 deletions
This file was deleted.

providers/tumblr.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,5 @@
77
url: https://www.tumblr.com/oembed/1.0
88
docs_url: https://www.tumblr.com/docs/en/api/v2
99
example_urls:
10-
- https://staff.tumblr.com/post/619193383820410880/have-a-post-youre-particularly-proud-of
10+
- https://www.tumblr.com/oembed/1.0?url=https://staff.tumblr.com/post/619193383820410880/have-a-post-youre-particularly-proud-of
1111
...

providers/voxsnap.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
discovery: true
99
example_urls:
1010
- https://data.voxsnap.com/oembed?url=https%3A%2F%2Farticle.voxsnap.com%2Fnirandfar%2Fthe-psychology-of-a-billion-dollar-enterprise-app
11-
- https://article.voxsnap.com/nirandfar/the-psychology-of-a-billion-dollar-enterprise-app
1211
formats:
1312
- json
1413
...

test.php

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,28 @@
8989
exit(1);
9090
}
9191

92+
if (preg_match('!\*!', $endpoint['url'])){
93+
echo "Endpoint URL contains a wildcard in provider file providers/$file\n";
94+
print_r($endpoint);
95+
exit(1);
96+
}
97+
98+
if (isset($endpoint['example_urls']))
99+
foreach ($endpoint['example_urls'] as $example){
100+
101+
if (!preg_match('!^https?://!', $example)){
102+
echo "Endpoint example URL does not start with http:// or https:// in provider file providers/$file\n";
103+
print_r($endpoint);
104+
exit(1);
105+
}
106+
107+
if (!preg_match('!url=!', $example)){
108+
echo "Endpoint example URL does not contain url= param in provider file providers/$file\n";
109+
print_r($endpoint);
110+
exit(1);
111+
}
112+
}
113+
92114
if (isset($endpoint['schemes'])){
93115
foreach ($endpoint['schemes'] as $scheme){
94116

0 commit comments

Comments
 (0)