Updated Ai to pull from facebook, added a loading SVG to make user wait for server too boot up, and added commands that can be used to start off the AI exstraction
This commit is contained in:
@@ -0,0 +1,21 @@
|
||||
import asyncio, sys, logging
|
||||
logging.basicConfig(level=logging.DEBUG, format='%(asctime)s [%(levelname)s] %(message)s')
|
||||
sys.path.insert(0, '.')
|
||||
from main import get_fb_cookies, scrape_facebook
|
||||
|
||||
async def test():
|
||||
print('Step 1: get cookies')
|
||||
cookies = await get_fb_cookies()
|
||||
print(f'Got {len(cookies)} cookies')
|
||||
if not cookies:
|
||||
print('No cookies - will still try scrape')
|
||||
print('Step 2: run scrape_facebook')
|
||||
result = await scrape_facebook(force=True)
|
||||
print(f'Result success={result["success"]} leads={len(result["leads"])} error={result.get("error")}')
|
||||
if result.get('leads'):
|
||||
for l in result['leads'][:3]:
|
||||
print(f' - {l["title"][:100]}')
|
||||
if result.get('error'):
|
||||
print(f' Error: {result["error"]}')
|
||||
|
||||
asyncio.run(test())
|
||||
Reference in New Issue
Block a user