Add search/mentions commands and fix cookie decryption

- Added `search <query>` command to search tweets
- Added `mentions` command to find @clawdbot mentions
- Fixed Chrome cookie decryption to extract hex values correctly
- Added SearchTimeline query ID (may need updating as Twitter rotates these)

Note: Search endpoints may return 404 if query IDs are outdated
This commit is contained in:
Peter Steinberger
2025-12-02 12:14:22 +00:00
parent 3a7c85b789
commit df66ef0706
3 changed files with 268 additions and 1 deletions
+9 -1
View File
@@ -79,7 +79,15 @@ function decryptCookieValue(encryptedHex: string): string | null {
let decrypted = decipher.update(encryptedData);
decrypted = Buffer.concat([decrypted, decipher.final()]);
return decrypted.toString('utf8');
// Chrome v10 cookies have key material prepended before the actual value
// Twitter cookies are hex strings, so extract the longest hex sequence
const decryptedStr = decrypted.toString('utf8');
const hexMatch = decryptedStr.match(/[a-f0-9]{32,}/i);
if (hexMatch) {
return hexMatch[0];
}
// Fallback: keep only printable ASCII characters
return decryptedStr.replace(/[^\x20-\x7E]/g, '');
} catch {
return null;
}