forked from 0x2620/oxjs
improved geodata and tools
This commit is contained in:
parent
4d9a8537ef
commit
912f2121a4
47 changed files with 682294 additions and 3535 deletions
18
tools/geo/py/imdb.py
Normal file
18
tools/geo/py/imdb.py
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
import re
|
||||
from geo import read_url
|
||||
|
||||
def get_countries():
|
||||
return get_data('country')
|
||||
|
||||
def get_data(type):
|
||||
html = read_url('http://www.imdb.com/' + type)
|
||||
regexp = '<a href="/' + type + '/(.*?)">(.*?)\n?</a>'
|
||||
results = re.compile(regexp).findall(html)
|
||||
data = sorted(map(lambda x: {
|
||||
'code': x[0],
|
||||
'name': x[1]
|
||||
}, results), key=lambda x: x["code"])
|
||||
return data
|
||||
|
||||
def get_languages():
|
||||
return get_data('language')
|
||||
Loading…
Add table
Add a link
Reference in a new issue