0
# Person Operations
1
2
Person search, retrieval, and biographical information management including comprehensive filmography and career details.
3
4
## Capabilities
5
6
### Person Search
7
8
Search for people by name with configurable result limits.
9
10
```python { .api }
11
def search_person(name, results=None):
12
"""
13
Search for people by name.
14
15
Parameters:
16
- name: str - Person name to search for
17
- results: int, optional - Maximum number of results (default: instance default)
18
19
Returns:
20
list: List of Person objects with basic information
21
"""
22
```
23
24
**Usage Example:**
25
26
```python
27
from imdb import IMDb
28
29
ia = IMDb()
30
31
# Basic person search
32
people = ia.search_person('Tom Hanks')
33
print(f"Found {len(people)} people")
34
for person in people[:3]:
35
print(f"- {person['name']} (ID: {person.personID})")
36
37
# Limited results
38
people = ia.search_person('Smith', results=10)
39
```
40
41
### Person Retrieval
42
43
Retrieve detailed person information by IMDb ID with configurable information sets.
44
45
```python { .api }
46
def get_person(personID, info=('main', 'filmography', 'biography'), modFunct=None):
47
"""
48
Get person by ID with specified information sets.
49
50
Parameters:
51
- personID: str - Person ID (internal or IMDb format)
52
- info: tuple/list - Information sets to retrieve ('main', 'filmography', 'biography', etc.)
53
- modFunct: function, optional - String modification function
54
55
Returns:
56
Person: Person object with requested information
57
"""
58
```
59
60
**Available Information Sets:**
61
- `'main'` - Basic person information (name, birth date, etc.)
62
- `'filmography'` - Complete filmography with all roles
63
- `'biography'` - Biography and personal information
64
- `'awards'` - Awards and nominations
65
- `'other_works'` - Other works beyond film/TV
66
- `'publicity'` - Publicity information and media appearances
67
68
**Usage Example:**
69
70
```python
71
from imdb import IMDb
72
73
ia = IMDb()
74
75
# Get person with basic info
76
person = ia.get_person('0000158') # Tom Hanks
77
print(f"Name: {person['name']}")
78
print(f"Birth date: {person.get('birth date', 'N/A')}")
79
80
# Get person with multiple info sets
81
person = ia.get_person('0000158', info=['main', 'filmography', 'biography'])
82
print(f"Biography: {person.get('mini biography', ['N/A'])[0][:100]}...")
83
84
# Access filmography
85
if 'filmography' in person:
86
for role_type, movies in person['filmography'].items():
87
print(f"{role_type}: {len(movies)} entries")
88
if movies:
89
print(f" - {movies[0]['title']} ({movies[0].get('year', 'N/A')})")
90
```
91
92
### Person Information Sets
93
94
Get available information sets for person objects.
95
96
```python { .api }
97
def get_person_infoset():
98
"""
99
Get list of available information sets for persons.
100
101
Returns:
102
list: Available information set names
103
"""
104
```
105
106
**Usage Example:**
107
108
```python
109
from imdb import IMDb
110
111
ia = IMDb()
112
113
# Get available info sets
114
info_sets = ia.get_person_infoset()
115
print(f"Available person info sets: {info_sets}")
116
# Output: ['main', 'filmography', 'biography', 'awards', 'other_works', 'publicity']
117
```
118
119
### Person Object Creation
120
121
Create new Person objects with specified parameters.
122
123
```python { .api }
124
def new_person(*arguments, **keywords):
125
"""
126
Create a new Person object.
127
128
Parameters:
129
- *arguments: Variable arguments for Person constructor
130
- **keywords: Keyword arguments for Person constructor
131
132
Returns:
133
Person: New Person object instance
134
"""
135
```
136
137
## Person Data Structure
138
139
Person objects provide dictionary-like access to biographical and career information:
140
141
### Basic Information
142
- `'name'` - Person's name
143
- `'birth date'` - Birth date
144
- `'birth name'` - Birth name if different
145
- `'height'` - Height information
146
- `'nick names'` - Nicknames and aliases
147
- `'akas'` - Also known as names
148
149
### Biographical Information
150
- `'mini biography'` - Biography text
151
- `'birth info'` - Detailed birth information
152
- `'death date'` - Death date (if applicable)
153
- `'death info'` - Death information and cause
154
- `'spouse'` - Spouse information
155
- `'trivia'` - Personal trivia
156
157
### Career Information
158
- `'filmography'` - Complete filmography organized by role type:
159
- `'actor'` - Acting roles
160
- `'actress'` - Acting roles (female)
161
- `'director'` - Directing credits
162
- `'producer'` - Producer credits
163
- `'writer'` - Writing credits
164
- `'composer'` - Music composition
165
- `'cinematographer'` - Cinematography work
166
- `'editor'` - Film editing
167
- And many other role types
168
169
### Awards and Recognition
170
- `'awards'` - Awards and nominations
171
- `'news'` - Recent news articles
172
- `'publicity'` - Publicity information
173
174
**Usage Example:**
175
176
```python
177
from imdb import IMDb
178
179
ia = IMDb()
180
181
# Get comprehensive person information
182
person = ia.get_person('0000158', info='all') # Get all available info
183
184
# Access different types of information
185
print(f"Name: {person['name']}")
186
print(f"Born: {person.get('birth date', 'Unknown')}")
187
188
# Biography
189
if 'mini biography' in person:
190
bio = person['mini biography'][0]
191
print(f"Biography: {bio[:200]}...")
192
193
# Filmography by role
194
if 'filmography' in person:
195
filmography = person['filmography']
196
197
# Acting roles
198
if 'actor' in filmography:
199
print(f"Acting credits: {len(filmography['actor'])}")
200
for movie in filmography['actor'][:5]:
201
year = movie.get('year', 'N/A')
202
print(f" - {movie['title']} ({year})")
203
204
# Directing roles
205
if 'director' in filmography:
206
print(f"Directing credits: {len(filmography['director'])}")
207
for movie in filmography['director'][:3]:
208
year = movie.get('year', 'N/A')
209
print(f" - {movie['title']} ({year})")
210
211
# Awards
212
if 'awards' in person:
213
awards = person['awards']
214
print(f"Awards and nominations: {len(awards)}")
215
```
216
217
## Person Search and Filtering
218
219
Advanced person search techniques and result filtering:
220
221
```python
222
from imdb import IMDb
223
224
ia = IMDb()
225
226
# Search with specific criteria
227
people = ia.search_person('Robert De Niro')
228
229
# Filter by exact name match
230
exact_matches = [p for p in people if p['name'].lower() == 'robert de niro']
231
232
# Search for people in specific roles
233
directors = ia.search_person('Scorsese')
234
for person in directors:
235
# Get filmography to check if they're a director
236
ia.update(person, info=['filmography'])
237
if 'filmography' in person and 'director' in person['filmography']:
238
print(f"Director: {person['name']}")
239
director_films = person['filmography']['director']
240
print(f" Directed {len(director_films)} films")
241
```
242
243
## Person Updates and Information Management
244
245
Managing person information and updates:
246
247
```python
248
from imdb import IMDb
249
250
ia = IMDb()
251
252
# Get person with basic info first
253
person = ia.search_person('Meryl Streep')[0]
254
255
# Incrementally add more information
256
ia.update(person, info=['filmography'])
257
ia.update(person, info=['awards'], override=1) # Force update
258
259
# Check what information is currently loaded
260
print(f"Current info: {person.current_info}")
261
262
# Get all possible information
263
ia.update(person, info='all')
264
```