Download and update datasets script

This commit is contained in:
localhost_frssoft 2022-09-01 16:17:36 +03:00
parent b8a47f8db4
commit 4d9a30c5f5
2 changed files with 20 additions and 3 deletions

View File

@ -5,11 +5,9 @@ import logging
def main():
# imdb_datasets_worker.convert_datasets_to_db()
logging.basicConfig(level=logger_default_level)
#listener_mention.run_scan_notif() # Слушаем упоминания в фоне
listener_mention.run_scan_notif() # Слушаем упоминания в фоне
listener_context.scan_context_thread() # Слушаем тред на новые предложения фильмов

19
update_imdb_database.py Normal file
View File

@ -0,0 +1,19 @@
from src import imdb_datasets_worker
import requests
def download_imdb_datasets():
print('Downloading title.basics.tsv.gz ...')
r = requests.get('https://datasets.imdbws.com/title.basics.tsv.gz')
with open('title.basics.tsv.gz', 'wb') as basics:
basics.write(r.content)
del r
print('Downloading title.akas.tsv.gz ...')
r = requests.get('https://datasets.imdbws.com/title.akas.tsv.gz')
with open('title.akas.tsv.gz', 'wb') as akas:
akas.write(r.content)
del r
download_imdb_datasets()
imdb_datasets_worker.convert_datasets_to_db()