Skip to content

Commit

Permalink
Merge pull request #21 from RyanLua/docs-site
Browse files Browse the repository at this point in the history
Add early documentation website
  • Loading branch information
RyanLua authored Dec 19, 2024
2 parents 7d83fbe + 71c0293 commit 1f03460
Show file tree
Hide file tree
Showing 13 changed files with 632 additions and 73 deletions.
10 changes: 8 additions & 2 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,15 @@
},

// Use 'forwardPorts' to make a list of ports inside the container available locally.
// "forwardPorts": [],
"forwardPorts": [8000],
"portsAttributes": {
"8000": {
"label": "Sphinx",
"onAutoForward": "openPreview"
}
},

"postCreateCommand": "pip3 install --user -r requirements.txt && pip install --editable .",
"postCreateCommand": "pip3 install --user -r requirements.txt -r docs/requirements.txt && pip install --editable .",

"customizations": {
"vscode": {
Expand Down
35 changes: 35 additions & 0 deletions .readthedocs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# Read the Docs configuration file for Sphinx projects
# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details

# Required
version: 2

# Set the OS, Python version and other tools you might need
build:
os: ubuntu-22.04
tools:
python: "3.12"
# You can also specify other tool versions:
# nodejs: "20"
# rust: "1.70"
# golang: "1.20"

# Build documentation in the "docs/" directory with Sphinx
sphinx:
configuration: docs/conf.py
# You can configure Sphinx to use a different builder, for instance use the dirhtml builder for simpler URLs
# builder: "dirhtml"
# Fail on all warnings to avoid broken references
# fail_on_warning: true

# Optionally build your docs in additional formats such as PDF and ePub
# formats:
# - pdf
# - epub

# Optional but recommended, declare the Python requirements required
# to build your documentation
# See https://docs.readthedocs.io/en/stable/guides/reproducible-builds.html
# python:
# install:
# - requirements: docs/requirements.txt
29 changes: 27 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# How to contribute
# How to Contribute

Thank you for considering contributing to our project! Here are some guidelines to help you get started.

Expand Down Expand Up @@ -27,4 +27,29 @@ This project uses [Black](https://github.com/psf/black) for code styling and [Py

For installing this project, see "[Installation](https://github.com/RyanLua/InstaWebhooks/wiki/Installation)."

This project supports and recommends [installing as a development container](https://github.com/RyanLua/InstaWebhooks/wiki/Installation#from-development-container) for contributing.
This project supports and recommends [installing as a development container](https://github.com/RyanLua/InstaWebhooks/wiki/Installation#from-development-container) for contributing.

## Building Documentation

Our documentation is built using [Sphinx](https://pypi.org/project/Sphinx/). The documentation is written in reStructuredText.

To install the documentation dependencies, run:

```console
$ pip install -r docs/requirements.txt
```

To build the documentation with autobuild (recommended), run:

```console
$ sphinx-autobuild docs/source docs/_build/html
```

To build the documentation without autobuild, run:

```console
$ cd docs
$ make html
```

The built documentation will be in `docs/_build/html`.
68 changes: 0 additions & 68 deletions README.md

This file was deleted.

108 changes: 108 additions & 0 deletions README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
.. image:: https://raw.githubusercontent.com/RyanLua/InstaWebhooks/main/assets/Logo.png
:alt: InstaWebhooks
:width: 64px

InstaWebhooks - Discord webhooks for Instagram
==============================================

.. |ci-badge| image:: https://github.com/RyanLua/InstaWebhooks/actions/workflows/ci.yml/badge.svg
:target: https://github.com/RyanLua/InstaWebhooks/actions/workflows/ci.yml
:alt: Continuous Integration

.. |pypi-version| image:: https://img.shields.io/pypi/v/instawebhooks
:target: https://pypi.org/project/instawebhooks/
:alt: PyPI

.. |python-versions| image:: https://img.shields.io/pypi/pyversions/instawebhooks
:target: https://pypi.org/project/instawebhooks
:alt: PyPI - Python Version

.. |license-badge| image:: https://img.shields.io/pypi/l/instawebhooks
:target: https://pypi.org/project/instawebhooks/
:alt: PyPI - License

.. |code-style-badge| image:: https://img.shields.io/badge/code%20style-black-000000.svg
:target: https://github.com/psf/black
:alt: Code style: black

.. |lint-badge| image:: https://img.shields.io/badge/linting-pylint-yellowgreen
:target: https://github.com/pylint-dev/pylint
:alt: Linting: pylint

.. |discord-badge| image:: https://img.shields.io/discord/1162303282002272359?label=discord
:target: https://discord.gg/wmM64GcZwe
:alt: Discord

|ci-badge| |pypi-version| |python-versions| |license-badge| |code-style-badge| |lint-badge| |discord-badge|

Monitor Instagram accounts for new posts and send them to a Discord webhook.

* Works with **any Instagram account**, including private accounts if you are a follower
* Customizable **Discord embeds** for new posts and message contents including **mentions/pings**
* **User-definable refresh interval** for checking for new posts the second they are posted

.. code:: console
instawebhooks [-h] [-q | -v] [-i REFRESH_INTERVAL] [-c MESSAGE_CONTENT] [-e] [--version]
instagram_username discord_webhook_url
.. image:: https://raw.githubusercontent.com/RyanLua/InstaWebhooks/main/assets/ScreenshotEmbedExample.png
:alt: Example of a new post notification
:width: 512px

What is InstaWebhooks?
-----------------------

InstaWebhooks is a Python package CLI that allows you to monitor Instagram accounts for new posts and send them to a Discord webhook. It is designed to be simple to use and easy to set up, with a focus on customizability and ease of use.

Internally, InstaWebhooks uses `Instaloader <https://instaloader.github.io/>`_ to fetch Instagram posts and `Discord Webhooks <https://discord.com/developers/docs/resources/webhook>`_ to send messages to Discord via `requests <https://requests.readthedocs.io/en/latest/>`_ which happens to be the same dependency Instaloader uses. It uses `argparse <https://docs.python.org/3/library/argparse.html>`_ for the CLI and `logging <https://docs.python.org/3/library/logging.html>`_ for logging.

Example
-------

Below, InstaWebhooks is monitoring the Instagram account `raenlua <https://www.instagram.com/raenlua/>`_ for new posts and sending them to a Discord webhook every 30 minutes and sends a message to Discord with the post URL and the owner's name.

.. code:: console
# Install InstaWebhooks
pip install instawebhooks
# Run InstaWebhooks with custom message contents
instawebhooks -c "New post from {owner_name}: {post_url}" raenlua https://discord.com/api/webhooks/0123456789/abcdefghijklmnopqrstuvwxyz
What it looks like:

.. image:: https://github.com/user-attachments/assets/15ce14a6-01ba-4675-a62e-d9c24128490b
:alt: Example of a customized message
:width: 512px

Installation
------------

InstaWebhooks is available on `PyPI <https://pypi.org/project/instawebhooks/>`_, and can be installed using `pip`:

.. code:: console
pip install instawebhooks
For more ways to install, see `Installation <https://github.com/RyanLua/InstaWebhooks/wiki/Installation>`_.

Usage
-----

You can run ``instawebhooks --help`` to see the full list of options and arguments available.

The most basic usage of InstaWebhooks is to provide an Instagram account and a Discord webhook URL (replace ``<INSTAGRAM_USERNAME>`` and ``<DISCORD_WEBHOOK_URL>``):

.. code:: console
instawebhooks <INSTAGRAM_USERNAME> <DISCORD_WEBHOOK_URL>
For more about each option and argument, including example templates, see `Usage <https://github.com/RyanLua/InstaWebhooks/wiki/Usage>`_.

Contributing
------------

For contributions, see the `contributing guidelines <CONTRIBUTING.md>`_.

This project supports `development containers <https://containers.dev/>`_, allowing you to instantly setup your development environment. For more, read about `installing from dev container <https://github.com/RyanLua/InstaWebhooks/wiki/Installation#from-development-container>`_.
26 changes: 25 additions & 1 deletion assets/Logo.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
20 changes: 20 additions & 0 deletions docs/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Minimal makefile for Sphinx documentation
#

# You can set these variables from the command line, and also
# from the environment for the first two.
SPHINXOPTS ?=
SPHINXBUILD ?= sphinx-build
SOURCEDIR = source
BUILDDIR = build

# Put it first so that "make" without argument is like "make help".
help:
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)

.PHONY: help Makefile

# Catch-all target: route all unknown targets to Sphinx using the new
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
%: Makefile
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
35 changes: 35 additions & 0 deletions docs/make.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
@ECHO OFF

pushd %~dp0

REM Command file for Sphinx documentation

if "%SPHINXBUILD%" == "" (
set SPHINXBUILD=sphinx-build
)
set SOURCEDIR=source
set BUILDDIR=build

%SPHINXBUILD% >NUL 2>NUL
if errorlevel 9009 (
echo.
echo.The 'sphinx-build' command was not found. Make sure you have Sphinx
echo.installed, then set the SPHINXBUILD environment variable to point
echo.to the full path of the 'sphinx-build' executable. Alternatively you
echo.may add the Sphinx directory to PATH.
echo.
echo.If you don't have Sphinx installed, grab it from
echo.https://www.sphinx-doc.org/
exit /b 1
)

if "%1" == "" goto help

%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
goto end

:help
%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%

:end
popd
38 changes: 38 additions & 0 deletions docs/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
alabaster==1.0.0
anyio==4.7.0
babel==2.16.0
beautifulsoup4==4.12.3
certifi==2024.8.30
charset-normalizer==3.4.0
click==8.1.7
colorama==0.4.6
docutils==0.21.2
furo==2024.8.6
h11==0.14.0
idna==3.10
imagesize==1.4.1
Jinja2==3.1.4
MarkupSafe==3.0.2
packaging==24.2
Pygments==2.18.0
requests==2.32.3
sniffio==1.3.1
snowballstemmer==2.2.0
soupsieve==2.6
Sphinx==8.1.3
sphinx-argparse==0.5.2
sphinx-autobuild==2024.10.3
sphinx-basic-ng==1.0.0b2
sphinx-copybutton==0.5.2
sphinxcontrib-applehelp==2.0.0
sphinxcontrib-devhelp==2.0.0
sphinxcontrib-htmlhelp==2.1.0
sphinxcontrib-jsmath==1.0.1
sphinxcontrib-qthelp==2.0.0
sphinxcontrib-serializinghtml==2.0.0
starlette==0.41.3
typing_extensions==4.12.2
urllib3==2.2.3
uvicorn==0.32.1
watchfiles==1.0.0
websockets==14.1
Loading

0 comments on commit 1f03460

Please sign in to comment.