Spaces:
Running
Running
Update alisto_project/backend/ingest_reddit.py
Browse files
alisto_project/backend/ingest_reddit.py
CHANGED
|
@@ -387,23 +387,14 @@ async def scrape_reddit():
|
|
| 387 |
if not client_id or not client_secret:
|
| 388 |
print("❌ Error: Client ID or Secret missing in .env")
|
| 389 |
return
|
| 390 |
-
|
| 391 |
-
# DEBUG BLOCK
|
| 392 |
-
u = os.getenv("REDDIT_USERNAME")
|
| 393 |
-
p = os.getenv("REDDIT_PASSWORD")
|
| 394 |
-
print(f"DEBUG: Username found? {u is not None}")
|
| 395 |
-
if u: print(f"DEBUG: Username length: {len(u)}")
|
| 396 |
-
print(f"DEBUG: Password found? {p is not None}")
|
| 397 |
-
# END DEBUG BLOCK
|
| 398 |
|
| 399 |
-
|
| 400 |
reddit = asyncpraw.Reddit(
|
| 401 |
client_id=client_id,
|
| 402 |
client_secret=client_secret,
|
| 403 |
-
#
|
| 404 |
-
|
| 405 |
-
|
| 406 |
-
user_agent=os.getenv("REDDIT_USER_AGENT", "script:alisto-project:v3.0 (by /u/TetCat87)")
|
| 407 |
)
|
| 408 |
|
| 409 |
try:
|
|
|
|
| 387 |
if not client_id or not client_secret:
|
| 388 |
print("❌ Error: Client ID or Secret missing in .env")
|
| 389 |
return
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 390 |
|
| 391 |
+
# NEW: Authenticated Login (REQUIRED for Hugging Face)
|
| 392 |
reddit = asyncpraw.Reddit(
|
| 393 |
client_id=client_id,
|
| 394 |
client_secret=client_secret,
|
| 395 |
+
username=os.getenv("REDDIT_USERNAME"), # <--- MUST BE HERE
|
| 396 |
+
password=os.getenv("REDDIT_PASSWORD"), # <--- MUST BE HERE
|
| 397 |
+
user_agent=os.getenv("REDDIT_USER_AGENT")
|
|
|
|
| 398 |
)
|
| 399 |
|
| 400 |
try:
|