use https if available: google.com, archive.org, wikipedia.org

This commit is contained in:
j 2014-08-12 10:56:20 +02:00
parent 336d646c9c
commit fbb702e349

View file

@ -151,20 +151,30 @@ class MovieId(models.Model):
def links(self): def links(self):
links = [] links = []
if self.imdb_id: if self.imdb_id:
links.append({'source': 'IMDb', links.append({
'url': ox.web.imdb.get_url(self.imdb_id)}) 'source': 'IMDb',
'url': ox.web.imdb.get_url(self.imdb_id)
})
if self.wikipedia_id: if self.wikipedia_id:
links.append({'source': 'Wikipedia', links.append({
'url': ox.web.wikipedia.get_url(self.wikipedia_id)}) 'source': 'Wikipedia',
'url': ox.web.wikipedia.get_url(self.wikipedia_id).replace('http://', 'https://')
})
if self.criterion_id: if self.criterion_id:
links.append({'source': 'Criterion', links.append({
'url': ox.web.criterion.get_url(self.criterion_id)}) 'source': 'Criterion',
'url': ox.web.criterion.get_url(self.criterion_id)
})
if self.archiveorg_id: if self.archiveorg_id:
links.append({'source': 'Internet Archive', links.append({
'url': ox.web.archive.get_url(self.archiveorg_id)}) 'source': 'Internet Archive',
'url': ox.web.archive.get_url(self.archiveorg_id).replace('http://', 'https://')
})
qs = u'"%s (%s)"'%(self.title, self.year) qs = u'"%s (%s)"'%(self.title, self.year)
links.append({'source': 'Google', links.append({
'url': 'http://google.com/search?q=%s' % quote(qs.encode('utf-8'))}) 'source': 'Google',
'url': 'https://google.com/search?q=%s' % quote(qs.encode('utf-8'))
})
return links return links
def info(self, key): def info(self, key):