elm-media
is a small Elm library for extracting social media URLs from text.
The typical use-case for this library is to embed videos and images from around
the web into webpages.
import Media
import Media.Site as Site
text = """https://imgur.com/cjCGCNH
https://youtu.be/oYk8CKH7OhE
https://www.youtube.com/watch?v=DfLvDFxcAIA
"""
{- This will extract media references in "text" for all supported sites, and
generate URLs for each reference.
-}
results =
text
|> Media.find Site.all
|> Media.urls
- Github
- Gist
- Google+
- Vine
- Vimeo
- Steam
- Linking to videos at specific times
- Supporting embeds that require script tags
- oEmbed URLs
Want to add a new site? No problem! Just fork this repo and create a pull-request. Once you have a copy on your local machine:
cd elm-media
npm install
npm start