Fix: Apply twscrape monkey patch to resolve 'Failed to parse scripts' error
Twitter changed their JavaScript response format to include unquoted keys in JSON objects, which breaks twscrape's parser. This fix applies a monkey patch that uses regex to quote the unquoted keys before parsing. This resolves the issue preventing figurine notifications from being sent for the past several days. Reference: https://github.com/vladkens/twscrape/issues/284
This commit is contained in:
@@ -3,6 +3,11 @@
|
||||
import asyncio
|
||||
import json
|
||||
from typing import Dict, Any
|
||||
|
||||
# Apply twscrape fix BEFORE importing twscrape
|
||||
from utils.twscrape_fix import apply_twscrape_fix
|
||||
apply_twscrape_fix()
|
||||
|
||||
from twscrape import API, gather, Account
|
||||
from playwright.async_api import async_playwright
|
||||
from pathlib import Path
|
||||
|
||||
Reference in New Issue
Block a user