def fetch_info(id, type):
"""
Returns a dictionary with information about the media(id, type).
Currently only fetches 'members'(popularity count).
"""
validate_media(type)
url = media_url(id, type)
try:
response = requests.get(url)
html = response.content
return extract_info(html)
except requests.ConnectionError:
print(f"Timed out on fetching {type}:{id} info")
return None
except Exception as err:
print(id, type, '-', response.status_code, '-', err)
if response.status_code == 404:
return []
return None
评论列表
文章目录