Browse Source

Trata URL mal formada do YouTube

pull/2950/head
Edward Ribeiro 5 years ago
parent
commit
9c3d22a445
  1. 6
      sapl/base/templatetags/common_tags.py

6
sapl/base/templatetags/common_tags.py

@ -249,8 +249,10 @@ def facebook_url(value):
def youtube_id(value): def youtube_id(value):
from urllib.parse import urlparse, parse_qs from urllib.parse import urlparse, parse_qs
u_pars = urlparse(value) u_pars = urlparse(value)
quer_v = parse_qs(u_pars.query).get('v')[0] quer_v = parse_qs(u_pars.query).get('v')
return quer_v if quer_v:
return quer_v[0]
return ''
@register.filter @register.filter

Loading…
Cancel
Save