pokemans/scraper/main.py
2024-03-03 23:01:01 -05:00

47 lines
1.5 KiB
Python

from reddit_monitor import RedditMonitor
from webhook import WebhookNotifier
from app import Application
from config import Config
import logging
if __name__ == "__main__":
client_id = Config.PRAW_CLIENT_ID
client_secret = Config.PRAW_CLIENT_SECRET
user_agent = Config.USER_AGENT
username = Config.PRAW_USERNAME
password = Config.PRAW_PASSWORD
subreddit_name = Config.SUBREDDIT_NAME
discord_webhook_url = Config.POKEMANS_WEBHOOK_URL
disable_webhook = Config.DISABLE_WEBHOOK
pkmn_env = Config.PKMN_ENV
api_url = Config.API_URL
# logging
logging.basicConfig(filename='scraper.log', level=logging.DEBUG)
logging.info('Starting scraper')
reddit_monitor = RedditMonitor(client_id, client_secret, user_agent, username, password, subreddit_name)
webhook_notifier = WebhookNotifier(discord_webhook_url, disable_webhook)
app = Application(reddit_monitor, webhook_notifier, api_url)
app.run()
"""
TODO:
- django rest framework
- api for managing database
- remove scraper models
- connect scraper to django rest framework api
- pull upvote ration into analytics?
- sqlite vs postgres figure out
- basic front end (react)
- tests
- logging
- Filter out canadian/uk deals
- track score and number of comments over time in db
- try to identify product, number of cards, price per card, etc
- track price over time for each product
- try to identify platform ie. costco for gift card, tiktok for coupons, etc.
- support for craigslist, ebay, etc.
- front end - vizualization, classification, lookup, etc.
"""