23 lines
611 B
Python
23 lines
611 B
Python
# -*- Mode: Python; -*-
|
|
# -*- coding: utf-8 -*-
|
|
# vi:si:et:sw=2:sts=2:ts=2
|
|
import re
|
|
|
|
from BeautifulSoup import BeautifulSoup
|
|
|
|
from utils import read_url
|
|
from imdb import IMDb
|
|
from google import google
|
|
|
|
|
|
def searchByImdb(imdb_id):
|
|
if len(imdb_id) != 7: return ''
|
|
url = "http://en.wikipedia.org/w/index.php?title=Special%3ASearch&search=imdb_id%20" + imdb_id + "&fulltext=Search"
|
|
data = read_url(url)
|
|
soup = BeautifulSoup(data)
|
|
result = soup('li', {"style":"padding-bottom: 1em;"})
|
|
if result:
|
|
url = result[0]('a')[0]['href']
|
|
url = "http://en.wikipedia.org%s" % url
|
|
return url
|
|
return ''
|