Spaces:
Running
Running
Upload auto_scheduler.py
Browse files- auto_scheduler.py +4 -2
auto_scheduler.py
CHANGED
|
@@ -1,7 +1,7 @@
|
|
| 1 |
"""VNEWS Auto Scheduler - tự động đăng 3 bài rewrite AI + shorts từ 3 chủ đề HOT
|
| 2 |
Vào các khung giờ: 7:00, 13:00, 19:00 (giờ Việt Nam)
|
| 3 |
Mỗi bài: Rewrite AI từ nguồn báo + short video tự động
|
| 4 |
-
FIX
|
| 5 |
"""
|
| 6 |
import os, re, json, time, threading, asyncio, logging, random, hashlib
|
| 7 |
from datetime import datetime, timezone, timedelta, date
|
|
@@ -9,6 +9,9 @@ from urllib.parse import quote
|
|
| 9 |
import requests
|
| 10 |
from bs4 import BeautifulSoup
|
| 11 |
|
|
|
|
|
|
|
|
|
|
| 12 |
VN_TZ = timezone(timedelta(hours=7))
|
| 13 |
LOG = logging.getLogger("auto_scheduler")
|
| 14 |
LOG.setLevel(logging.INFO)
|
|
@@ -20,7 +23,6 @@ if not LOG.handlers:
|
|
| 20 |
SCHEDULE_TIMES = [(7, 0), (13, 0), (19, 0)]
|
| 21 |
SCHEDULE_LABELS = {t: f"{t[0]:02d}:{t[1]:02d}" for t in SCHEDULE_TIMES}
|
| 22 |
|
| 23 |
-
DATA_DIR = '/data' if os.path.isdir('/data') else os.path.join(os.path.dirname(os.path.abspath(__file__)), 'data')
|
| 24 |
os.makedirs(DATA_DIR, exist_ok=True)
|
| 25 |
SCHEDULE_STATE_FILE = os.path.join(DATA_DIR, 'scheduler_state.json')
|
| 26 |
|
|
|
|
| 1 |
"""VNEWS Auto Scheduler - tự động đăng 3 bài rewrite AI + shorts từ 3 chủ đề HOT
|
| 2 |
Vào các khung giờ: 7:00, 13:00, 19:00 (giờ Việt Nam)
|
| 3 |
Mỗi bài: Rewrite AI từ nguồn báo + short video tự động
|
| 4 |
+
FIX v5: Use storage.py for persistent HF Dataset backend
|
| 5 |
"""
|
| 6 |
import os, re, json, time, threading, asyncio, logging, random, hashlib
|
| 7 |
from datetime import datetime, timezone, timedelta, date
|
|
|
|
| 9 |
import requests
|
| 10 |
from bs4 import BeautifulSoup
|
| 11 |
|
| 12 |
+
# Import storage for persistent data
|
| 13 |
+
from storage import load_wall_posts, save_wall_posts, DATA_DIR
|
| 14 |
+
|
| 15 |
VN_TZ = timezone(timedelta(hours=7))
|
| 16 |
LOG = logging.getLogger("auto_scheduler")
|
| 17 |
LOG.setLevel(logging.INFO)
|
|
|
|
| 23 |
SCHEDULE_TIMES = [(7, 0), (13, 0), (19, 0)]
|
| 24 |
SCHEDULE_LABELS = {t: f"{t[0]:02d}:{t[1]:02d}" for t in SCHEDULE_TIMES}
|
| 25 |
|
|
|
|
| 26 |
os.makedirs(DATA_DIR, exist_ok=True)
|
| 27 |
SCHEDULE_STATE_FILE = os.path.join(DATA_DIR, 'scheduler_state.json')
|
| 28 |
|