Update source code and remove runtime data from tracking
Add gitignore rules for browser session data, SQLite databases, media downloads, and build artifacts. Remove previously tracked runtime files from the repository. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
1 parent
e90213d1ff
commit
dfa0580859
23 files changed
+5324
-347
No files matched your search
@@ -180,6 +180,53 @@ export class RedditApiClient {
|
||||
return url.replace(/&/g, '&');
|
||||
}
|
||||
|
||||
async isSellerProfile(username: string, sellerKeywords: string[]): Promise<boolean> {
|
||||
if (sellerKeywords.length === 0) return false;
|
||||
|
||||
try {
|
||||
const cookieHeader = await this.getCookieHeader();
|
||||
const headers: Record<string, string> = {};
|
||||
if (cookieHeader) {
|
||||
headers['Cookie'] = cookieHeader;
|
||||
}
|
||||
|
||||
const response = await this.client.get(`/user/${username}/about.json`, {
|
||||
params: { raw_json: 1 },
|
||||
headers,
|
||||
});
|
||||
|
||||
const userData = response.data?.data;
|
||||
if (!userData) return false;
|
||||
|
||||
// Combine all text fields to scan
|
||||
const textToCheck = [
|
||||
userData.subreddit?.public_description || '',
|
||||
userData.subreddit?.title || '',
|
||||
userData.subreddit?.display_name_prefixed || '',
|
||||
]
|
||||
.join(' ')
|
||||
.toLowerCase();
|
||||
|
||||
for (const keyword of sellerKeywords) {
|
||||
if (textToCheck.includes(keyword.toLowerCase())) {
|
||||
this.logger.info(
|
||||
`u/${username} flagged as seller profile (matched: "${keyword}")`
|
||||
);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
} catch (error) {
|
||||
if (axios.isAxiosError(error) && error.response?.status === 404) {
|
||||
this.logger.warn(`User u/${username} profile not found`);
|
||||
return false;
|
||||
}
|
||||
this.logger.warn(`Failed to check profile for u/${username}:`, error);
|
||||
return false; // Don't block on errors - let it through
|
||||
}
|
||||
}
|
||||
|
||||
getPostUrl(post: RedditPost): string {
|
||||
return `https://www.reddit.com${post.permalink}`;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user