Closed odv closed 4 years ago
fetch('https://coub.com/api/v2/search?q=best%20coub%20ever&order_by=newest_popular')
.then((response) => {
return response.json();
})
.then((data) => {
return data.coubs[0].file_versions.share.default
})
.catch(error => ('https://www.youtube.com/watch?v=CYfjFb7WjGQ'));
API: https://coub.com/dev/docs/Coub+API%2FOverview Input: string representing a search query, for example: 'best coub ever'
Please sort by 'newest_popular'.
Output example: https://coubsecure-s.akamaihd.net/get/b122/p/coub/simple/cw_video_for_sharing/690b14e0d62/faf6703df0169864806fc/1568905880_looped_1568905875.mp4
Please note that there is a hint in the URL. If the API returns "none" please show this link instead: https://www.youtube.com/watch?v=CYfjFb7WjGQ