{"id":17077073,"url":"https://github.com/fterh/sneakpeek","last_synced_at":"2025-07-08T05:17:24.336Z","repository":{"id":33937834,"uuid":"163577974","full_name":"fterh/sneakpeek","owner":"fterh","description":"Reddit bot to preview and post hyperlinks as comments","archived":false,"fork":false,"pushed_at":"2022-12-08T04:51:57.000Z","size":175,"stargazers_count":102,"open_issues_count":10,"forks_count":17,"subscribers_count":11,"default_branch":"master","last_synced_at":"2025-03-26T14:39:21.975Z","etag":null,"topics":["article-extractor","news-articles","preview","reddit","reddit-bot"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/fterh.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-12-30T10:08:17.000Z","updated_at":"2024-03-16T04:35:56.000Z","dependencies_parsed_at":"2023-01-15T03:28:32.263Z","dependency_job_id":null,"html_url":"https://github.com/fterh/sneakpeek","commit_stats":null,"previous_names":[],"tags_count":13,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fterh%2Fsneakpeek","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fterh%2Fsneakpeek/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fterh%2Fsneakpeek/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fterh%2Fsneakpeek/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/fterh","download_url":"https://codeload.github.com/fterh/sneakpeek/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248626385,"owners_count":21135654,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["article-extractor","news-articles","preview","reddit","reddit-bot"],"created_at":"2024-10-14T12:12:17.603Z","updated_at":"2025-04-12T20:22:13.125Z","avatar_url":"https://github.com/fterh.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# sneakpeek\n\n[![Build Status](https://travis-ci.com/fterh/sneakpeek.svg?branch=master)](https://travis-ci.com/fterh/sneakpeek)\n[![Codacy Badge](https://api.codacy.com/project/badge/Grade/a196dd3251ec4600b126c9a7712ddbf2)](https://app.codacy.com/app/fterh/sneakpeek?utm_source=github.com\u0026utm_medium=referral\u0026utm_content=fterh/sneakpeek\u0026utm_campaign=Badge_Grade_Dashboard)\n\nA Reddit bot that previews hyperlinks and posts their contents as a comment.\nIt should **never spam or double-post**, and will skip a comment if it is\ntoo long.\n\n## Site support\n* businesstimes.com.sg\n* channelnewsasia.com\n* channelnewsasia.com (CNAlifestyle)\n* mothership.sg  \n* ricemedia.co\n* straitstimes.com\n* tnp.sg\n* todayonline.com\n* yahoo.com\n* zula.sg\n\n## Contributing\nPRs are always welcome.\n\n1. Write Handlers to support more websites\n2. Improve test coverage\n3. Improve documentation\n\n### New version release checklist\n1. Create a release branch (e.g. `release-v1.2.3`) from the `develop` branch\n2. Bump version numbers in `config.py` to the release branch\n3. Update README\n4. Possibly commit minor bug fixes to the release branch\n5. Merge the release branch into `master` and `develop` \n\nThis project follows this [Git branching workflow](https://nvie.com/posts/a-successful-git-branching-model/).\n\n## Operation\n### Before running\nThe program requires an environmental variable `SUBREDDIT` to be set.\nThis specifies the subreddit that the bot will monitor.\nIf it's not set, the default subreddit `/r/all` will be monitored.\nAt the moment, only 1 subreddit may be specified.\n\n### Running/Testing\nAll the commands below assume that the virtual environment has been activated\n(`pipenv shell`).\n\n* Running: `SUBREDDIT=name python main.py` (or `SUBREDDIT=name nohup python main.py \u0026`)\n* Testing: `invoke test`\n\n#### Docker\nThis application can be built and run as a Docker image.\n\n### General\n`main.py` starts the bot and calls `scan(subreddit)` (in `scan.py`), \nwhich monitors for new submissions in the provided subreddit.\n\nFor each new submission, `scan` checks if they qualify for preview \nby calling `qualify` (in `qualify.py`). \n\nA submission qualifies for preview if it:\n1. Is a link\n2. Has a Handler for the website\n\nIf a submission qualifies, `scan` calls the `handle` method of the Handler \nto generate the raw comment, then `format_comment(comment)` in the \ncomments module to generate the final comment in Markdown.\n\nIf the final comment in Markdown does not exceed a pre-configured comment length\n(`config.COMMENT_LENGTH_LIMIT`), the comment is posted, and the action written \nto the database (through `DatabaseManager`) to prevent double-posting.\n\nLogging is written to standard output, and logging level can be configured in\n`config.py`.\n\n### Handlers\n`handler.py` contains a HandlerManager that checks if a website has a Handler. \n\nA Handler is a class with a `@classmethod handle(cls, url)` that accepts a URL \nand returns a Comment. All Handlers must inherit from `AbstractBaseHandler`. \n\nThe Handler can be part of a module or package, and have as many supporting \nsub-modules or sub-packages as necessary.\n\n### Comments\nThe comments module (in `comment.py`) exports the Comment class, \nwhich all Handlers must return. A Comment class requires a `title` and `body`, \nand accepts a `byline` and `attribution` (which are optional). \n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffterh%2Fsneakpeek","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffterh%2Fsneakpeek","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffterh%2Fsneakpeek/lists"}