eckendoerffer commited on
Commit
5783560
·
1 Parent(s): f6b0777

Update extract_news/3_extract_news_txt.py

Browse files
Files changed (1) hide show
  1. extract_news/3_extract_news_txt.py +0 -7
extract_news/3_extract_news_txt.py CHANGED
@@ -111,8 +111,6 @@ while True:
111
  title = html.unescape(doc('h1:first').text())
112
  if title.strip() =='':
113
  index_id = next_id
114
- cursor = connection.cursor()
115
- cursor.execute("UPDATE `base_media` SET `deleted`=`deleted`+1 WHERE `id`=%s LIMIT 1", (id_media,))
116
  continue
117
 
118
  extract_method = 0
@@ -310,13 +308,8 @@ while True:
310
  if len(content) > 200 and not nb_base:
311
  cursor = connection.cursor()
312
  cursor.execute("UPDATE `base_news` SET `key_title`=%s WHERE `id`=%s LIMIT 1", (key, id_source))
313
- cursor = connection.cursor()
314
- cursor.execute("UPDATE `base_media` SET `add`=`add`+1 WHERE `id`=%s LIMIT 1", (id_media,))
315
  formatted_keys = f'{formatted_keys}{key}|'
316
  save_to_file(f"{path}/sources/txt_news/{id_source}.txt", add)
317
- elif not nb_base:
318
- cursor = connection.cursor()
319
- cursor.execute("UPDATE `base_media` SET `deleted`=`deleted`+1 WHERE `id`=%s LIMIT 1", (id_media,))
320
 
321
  elapsed_time = time.time() - time_start
322
  print(color + f"{id_source:8}) ({extract_method:1}) [{elapsed_time:.3f}] [{len_source:7}{len_text:7}{len(content):7}{len(title):4} ] {url} {test}")
 
111
  title = html.unescape(doc('h1:first').text())
112
  if title.strip() =='':
113
  index_id = next_id
 
 
114
  continue
115
 
116
  extract_method = 0
 
308
  if len(content) > 200 and not nb_base:
309
  cursor = connection.cursor()
310
  cursor.execute("UPDATE `base_news` SET `key_title`=%s WHERE `id`=%s LIMIT 1", (key, id_source))
 
 
311
  formatted_keys = f'{formatted_keys}{key}|'
312
  save_to_file(f"{path}/sources/txt_news/{id_source}.txt", add)
 
 
 
313
 
314
  elapsed_time = time.time() - time_start
315
  print(color + f"{id_source:8}) ({extract_method:1}) [{elapsed_time:.3f}] [{len_source:7}{len_text:7}{len(content):7}{len(title):4} ] {url} {test}")