Fix minor formatting issues
This commit is contained in:
parent
d7f934b7b2
commit
0f4bf45cde
@ -301,8 +301,8 @@ def extract_item_info(item, additional_info={}):
|
|||||||
info['id'] = multi_deep_get(item,
|
info['id'] = multi_deep_get(item,
|
||||||
['videoId'],
|
['videoId'],
|
||||||
['navigationEndpoint', 'watchEndpoint', 'videoId'],
|
['navigationEndpoint', 'watchEndpoint', 'videoId'],
|
||||||
['navigationEndpoint', 'reelWatchEndpoint', 'videoId'], # shorts
|
['navigationEndpoint', 'reelWatchEndpoint', 'videoId'] # shorts
|
||||||
)
|
)
|
||||||
info['view_count'] = extract_int(item.get('viewCountText'))
|
info['view_count'] = extract_int(item.get('viewCountText'))
|
||||||
|
|
||||||
# dig into accessibility data to get view_count for videos marked as recommended, and to get time_published
|
# dig into accessibility data to get view_count for videos marked as recommended, and to get time_published
|
||||||
@ -322,15 +322,15 @@ def extract_item_info(item, additional_info={}):
|
|||||||
else:
|
else:
|
||||||
info['approx_view_count'] = extract_approx_int(multi_get(item,
|
info['approx_view_count'] = extract_approx_int(multi_get(item,
|
||||||
'shortViewCountText',
|
'shortViewCountText',
|
||||||
'viewCountText') # shorts
|
'viewCountText' # shorts
|
||||||
)
|
))
|
||||||
|
|
||||||
# handle case where it is "No views"
|
# handle case where it is "No views"
|
||||||
if not info['approx_view_count']:
|
if not info['approx_view_count']:
|
||||||
if ('No views' in item.get('shortViewCountText', '')
|
if ('No views' in item.get('shortViewCountText', '')
|
||||||
or 'no views' in accessibility_label.lower()
|
or 'no views' in accessibility_label.lower()
|
||||||
or 'No views' in extract_str(item.get('viewCountText', '')) # shorts
|
or 'No views' in extract_str(item.get('viewCountText', '')) # shorts
|
||||||
):
|
):
|
||||||
info['view_count'] = 0
|
info['view_count'] = 0
|
||||||
info['approx_view_count'] = '0'
|
info['approx_view_count'] = '0'
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user