Snippet List
This is a function based on django's urlize modified to show different media based on their url. It supports images, links, mp3/ogg links, youtube videos, vimeo videos and dailymotion videos.
I added a switch called mini to have two modes to show things in different places. When mini is activated it will only parse the first url provided and discard the rest as well as limiting the height.
- html
- youtube
- urlize
- parser
- vimeo
- dailymotion
- url-to-image
- url-to-video
- urlze
The default Django urlize filter does not work with html nicely so here I've used an HTML parser [BeautifulSoup](http://www.crummy.com/software/BeautifulSoup/) to quickly search through each text node and run the django urlize filter on it.
Optimizations could be made to include a regex in the soup.findAll() method's text argument to only search those text nodes which matched a url pattern. You could also modify the method to convert the text to urls, such as using your own custom url filter.
- beautifulsoup
- html
- urlize
- parser
- html parser
This snippet is based on djangos urlize filter. It converts http:// links to youtube into youtube-embed statements, so that one can provide a simple link to a youtube video and this filter will embed it. I used it for a fun blog app.
3 snippets posted so far.