youtube to mongo fix
This commit is contained in:
parent
07c10c4bf9
commit
23d3e65bdf
@ -41,7 +41,11 @@ def main(args):
|
||||
video_date = m[1] if m is not None else "brak daty"
|
||||
logging.debug(f'Video Date: {video_date}')
|
||||
to_mongo = {
|
||||
'title': video_title,
|
||||
'title': video_title.replace('\n', ''),
|
||||
'description': {
|
||||
'desc': video_descr,
|
||||
'date': video_date
|
||||
},
|
||||
'url': video_url,
|
||||
'source': input_source,
|
||||
'gcsMp4': {
|
||||
@ -54,12 +58,12 @@ def main(args):
|
||||
}
|
||||
}
|
||||
try:
|
||||
col.insert_one(to_mongo)
|
||||
doc_id = col.insert_one(to_mongo)
|
||||
except:
|
||||
logging.error('mongo update failed')
|
||||
else:
|
||||
logging.info('mongo insert OK')
|
||||
logging.debug(f'inserted: {to_mongo}')
|
||||
logging.debug(f'inserted_id: {doc_id}')
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
Loading…
Reference in New Issue
Block a user