Snippet List
Takes a tweet url, requests the json from Twitter oEmbed, parses the json for the html element and returns it to your template. The html returned is ready to go and will be shown as a tweet on your web page. This uses the Requests library for Python. A full example can be found on GitHub https://github.com/z3ke1r/django-tweet-embed.
- django
- templatetag
- json
- embed
- twitter
- parse
- requests
- tweet
[code]
{% get_video_urls url as url_object %}
or get object attribute:
{% get_video_urls obj "url" as url_object %}
{{ url_object }} original url
{{ url_object.video_id }} original url or video_id
{{ url_object.resource }} youtube, vimeo, None
{{ url_object.iframe_url }} original url or iframe_url
{{ url_object.js_api_url }} original url or js_api_url
[/code]
- url
- youtube
- embed
- iframe
- vimeo
- video_id
This is a simple way to embed images in emails, rather than use absolute links, which many clients will not show by default. It has not undergone extensive testing but it should get you started. Comments / suggestions welcome.
Given a youtube url (can copy and paste right from the browser) turns the url into an embedded video.
If you put this in your app's templatetags/filters.py, you can do the following
>{{ object.youtube_url|youtube }}
and it would embed the youtube video.
- template
- filter
- youtube
- embed
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.
6 snippets posted so far.