Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bump version to 2.7.0 #908

Open
wants to merge 127 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
127 commits
Select commit Hold shift + click to select a range
247ea5d
UP009
OMEGARAZER Jan 29, 2023
95c8c72
UP008
OMEGARAZER Jan 29, 2023
086f409
UP034
OMEGARAZER Jan 29, 2023
7308569
Update unsaveposts.py
OMEGARAZER Feb 1, 2023
afd2f88
Update test_direct.py
OMEGARAZER Feb 1, 2023
07e38a7
fix #753
bunny-foofoo Feb 2, 2023
a535fee
Black update
OMEGARAZER Feb 2, 2023
708b22d
Merge pull request #765 from OMEGARAZER/unsave
Serene-Arc Feb 3, 2023
7676ff0
Merge pull request #766 from bunny-foofoo/development
Serene-Arc Feb 3, 2023
4a91ff6
Version logged
OMEGARAZER Feb 4, 2023
c8a859a
Merge pull request #768 from OMEGARAZER/logged-version
Serene-Arc Feb 4, 2023
1895d2f
Add warning for --search-existing
Feb 5, 2023
4e15af6
Make option descriptions clearer
Feb 5, 2023
980cf5d
Merge pull request #773 from Serene-Arc/enhancement_771
Serene-Arc Feb 5, 2023
0bf44e5
UP012
OMEGARAZER Jan 29, 2023
0e28c7e
Gfycat API
OMEGARAZER Feb 4, 2023
55384cd
UP032
OMEGARAZER Jan 29, 2023
e5b184e
Merge pull request #762 from OMEGARAZER/pyupgrade-lint
Serene-Arc Feb 12, 2023
0051877
Merge pull request #769 from OMEGARAZER/gfycat-api
Serene-Arc Feb 12, 2023
183f592
Update CONTRIBUTING bug report requirements
Feb 14, 2023
673076e
Add requirement for template
Feb 14, 2023
9eeff73
Update yt-dlp
OMEGARAZER Feb 17, 2023
a3b9e78
Update tests
OMEGARAZER Feb 17, 2023
5cf2c81
Merge pull request #779 from OMEGARAZER/development
Serene-Arc Feb 17, 2023
5c57de7
B907 Cleanup/updates
OMEGARAZER Feb 18, 2023
98aa3d7
Quote cleanup
OMEGARAZER Feb 18, 2023
8f9bed0
Harden requests
OMEGARAZER Feb 18, 2023
3d07ffb
Merge pull request #781 from OMEGARAZER/requests
Serene-Arc Feb 19, 2023
9114106
Merge pull request #780 from OMEGARAZER/Quote-cleanup
Serene-Arc Feb 19, 2023
80c66c8
Erome fixes
Soulsuck24 Feb 19, 2023
60e9e58
Merge pull request #785 from Soulsuck24/development
Serene-Arc Feb 19, 2023
987172c
Update README.md
thomas694 Feb 22, 2023
47fb5d3
Bandit fixes
OMEGARAZER Feb 24, 2023
005454a
Don't create directory if not needed
OMEGARAZER Feb 25, 2023
6df7906
Merge pull request #796 from OMEGARAZER/empty-dir-fix
Serene-Arc Feb 27, 2023
dd28313
Imgur fixes
Soulsuck24 Feb 27, 2023
9fdd418
Merge pull request #802 from Soulsuck24/development
Serene-Arc Feb 28, 2023
a16622e
Merge pull request #804 from thomas694/update-readme
Serene-Arc Feb 28, 2023
74d842e
Scripts testing/fixes
OMEGARAZER Mar 2, 2023
a5b4459
Partial revert of 98aa3d7
OMEGARAZER Feb 24, 2023
38e6c45
Merge pull request #807 from OMEGARAZER/Scripts-tests
Serene-Arc Mar 2, 2023
905f54f
Add ruff
OMEGARAZER Feb 24, 2023
1705884
Use proper user agent string
OMEGARAZER Mar 4, 2023
b6bc94b
Merge pull request #810 from OMEGARAZER/user-agent
Serene-Arc Mar 8, 2023
c09d945
Fix test config
OMEGARAZER Feb 27, 2023
caa4421
ANN204
OMEGARAZER Feb 19, 2023
a5f5df7
ANN201
OMEGARAZER Feb 19, 2023
0c4cfd8
ANN202
OMEGARAZER Feb 19, 2023
c27fcb0
ANN205
OMEGARAZER Feb 19, 2023
3b69d83
ANN001
OMEGARAZER Feb 19, 2023
7fbd001
Fix Youtube test
OMEGARAZER Mar 11, 2023
d8f79d7
Merge pull request #819 from OMEGARAZER/test-fix
Serene-Arc Mar 11, 2023
87fd63d
Test fixes
OMEGARAZER Mar 23, 2023
b90ab1b
Update docs
OMEGARAZER Mar 3, 2023
7e9afc2
Merge pull request #831 from OMEGARAZER/doc-fixes
Serene-Arc Apr 7, 2023
38bef1d
Add Catbox downloader
OMEGARAZER Apr 27, 2023
72d5b1a
Merge pull request #845 from OMEGARAZER/catbox-downloader
Serene-Arc Apr 28, 2023
8d61011
Redgif coverage
Soulsuck24 Apr 29, 2023
17350ba
Merge pull request #847 from Soulsuck24/development
Serene-Arc Apr 30, 2023
a05ece3
Add option for downvoted posts
OMEGARAZER May 5, 2023
13980fb
Remove failing test case
May 17, 2023
f920da5
allow skipping of comment download
artoonie May 23, 2023
ceecb4d
Add imgchest downloader
OMEGARAZER May 16, 2023
b081f5c
Refactor Imgur
OMEGARAZER Apr 30, 2023
db08bc6
Update tests
OMEGARAZER May 25, 2023
85ab259
Merge branch 'development' into imgur
OMEGARAZER May 25, 2023
baa3530
Merge pull request #848 from OMEGARAZER/imgur
Serene-Arc May 29, 2023
9f32492
Merge pull request #861 from OMEGARAZER/imgchest
Serene-Arc May 29, 2023
bb41e4a
Merge pull request #853 from OMEGARAZER/downvoted
Serene-Arc May 29, 2023
1427851
Merge pull request #826 from OMEGARAZER/test-fixes
Serene-Arc May 29, 2023
dd6f123
Merge pull request #818 from OMEGARAZER/Annotations
Serene-Arc May 29, 2023
175a918
Merge pull request #813 from OMEGARAZER/test-config
Serene-Arc May 29, 2023
697de4f
Merge pull request #806 from OMEGARAZER/add-ruff
Serene-Arc May 29, 2023
9ae17b7
Merge pull request #792 from OMEGARAZER/Bandit
Serene-Arc May 29, 2023
9c0017c
Fix Erome test
OMEGARAZER May 25, 2023
3934175
Merge branch 'development' into erome
Soulsuck24 May 31, 2023
54b242f
Merge pull request #868 from Soulsuck24/erome
Serene-Arc May 31, 2023
288c42f
RUF001
OMEGARAZER Jun 4, 2023
4fb4875
RUF005
OMEGARAZER Jun 4, 2023
a8c7570
B607/603 coverage
OMEGARAZER Apr 20, 2023
62fe08d
B311
OMEGARAZER Jun 6, 2023
1d95778
Connector test edge case
OMEGARAZER Jun 5, 2023
0017030
Merge pull request #874 from OMEGARAZER/connector-test
Serene-Arc Jun 7, 2023
84ff854
Merge pull request #875 from OMEGARAZER/RUF-lint
Serene-Arc Jun 7, 2023
56ecc06
Merge pull request #876 from OMEGARAZER/Bandit
Serene-Arc Jun 7, 2023
42264f0
Add Flickr
OMEGARAZER Jun 9, 2023
663b9a9
remove failing test
OMEGARAZER Jun 9, 2023
912311e
Flickr update
OMEGARAZER Jun 13, 2023
a161781
Merge pull request #885 from OMEGARAZER/flickr
Serene-Arc Jun 13, 2023
68b2b96
Update versions
OMEGARAZER Jun 12, 2023
1df6b07
Merge pull request #886 from OMEGARAZER/update-versions
Serene-Arc Jun 14, 2023
192ea38
Oauth2 updates
OMEGARAZER Mar 8, 2023
d474713
Merge pull request #889 from OMEGARAZER/api_keys
Serene-Arc Jun 17, 2023
7f4a84a
Add site nsfw.pics
Soulsuck24 Jun 17, 2023
ce4017d
Merge branch 'development' into master
artoonie Jun 18, 2023
bcce191
add test
artoonie Jun 18, 2023
c1ac8d6
Merge pull request #891 from Soulsuck24/nsfw.pics
Serene-Arc Jun 18, 2023
928aa7e
Fix declaration
Jun 18, 2023
fded771
Fix test
Jun 18, 2023
4eeb423
Reformat file
Jun 18, 2023
f28f74c
Add integration test
Jun 18, 2023
e174443
Merge pull request #863 from artoonie/master
Serene-Arc Jun 18, 2023
fb6ae39
Add instruction for logs to bug reports
Jun 15, 2023
6d0386a
Fix command name to match documentation
Jun 21, 2023
c993e01
Test fixes
OMEGARAZER Jun 24, 2023
ca2408b
RUF013
OMEGARAZER Jun 20, 2023
10d24ed
Merge pull request #898 from OMEGARAZER/test-fixes
Serene-Arc Jun 25, 2023
3bd6047
Merge pull request #899 from OMEGARAZER/RUF013
Serene-Arc Jun 25, 2023
b97dacb
Allow archiver format to be specified multiple times
Jun 25, 2023
0635b16
Merge pull request #900 from Serene-Arc/feature_815
Serene-Arc Jun 25, 2023
3584ff1
Format README according to line length
Jun 25, 2023
86101a2
Format documents according to line length
Jun 25, 2023
0adf326
Chevereto downloader
Soulsuck24 Jun 26, 2023
5925358
Merge pull request #902 from Soulsuck24/development
Serene-Arc Jun 27, 2023
29c7344
Bump version
Jul 8, 2023
c1ed7e8
Add warnings for default and no app id
Jul 16, 2023
610bf23
Add ratelimit to praw object
Jul 29, 2023
b02eefd
fix: f-strings in clone command exception
vladdoster Oct 1, 2023
8e61039
Merge pull request #927 from aliparlakci/vladdoster-patch-1
Serene-Arc Oct 2, 2023
c6c9f2d
fixed ruff instructions
stared Jan 15, 2024
ff27049
fix linted errors
stared Jan 15, 2024
9d2bda7
bumped ruff to 0.1.13
stared Jan 18, 2024
257d444
Merge pull request #938 from stared/ruff-command-fix
Serene-Arc Feb 2, 2024
f198904
Remove gfycat since site is defunct
Serene-Arc Aug 24, 2024
8d71e77
Merge tests
Serene-Arc Nov 14, 2024
89521d9
Remove test case for domain that no longer exists
Serene-Arc Nov 14, 2024
b5b47f9
Remove link to resources that no longer exist
Serene-Arc Nov 14, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,10 @@ assignees: ''

---

- [ ] I have read the [Opening an issue](https://github.com/aliparlakci/bulk-downloader-for-reddit/blob/master/docs/CONTRIBUTING.md#opening-an-issue)
- [ ] I am reporting a bug.
- [ ] I am running the latest version of BDfR
- [ ] I have read the [Opening an issue](https://github.com/aliparlakci/bulk-downloader-for-reddit/blob/master/docs/CONTRIBUTING.md#opening-an-issue)
- [ ] I am not asking a question about the BDFR (please use Discussions for this)

## Description

Expand All @@ -28,6 +29,8 @@ Paste here the command(s) that causes the bug

## Logs

These are my **unaltered** logs:

```text
Paste the log output here.
```
29 changes: 29 additions & 0 deletions .github/workflows/scripts-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Scripts Test

on:
push:
paths:
- "scripts/*.sh"
- "scripts/*.ps1"
pull_request:
paths:
- "scripts/*.sh"
- "scripts/*.ps1"

jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
submodules: 'true'
- name: Bats tests
run: |
cd scripts/tests/
bats/bin/bats *.bats

- name: Pester tests
shell: pwsh
run: |
cd scripts/tests/
Invoke-Pester -CI -PassThru .
14 changes: 10 additions & 4 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,14 @@ on:
- "**.md"
- ".markdown_style.rb"
- ".mdlrc"
- "scripts/"
pull_request:
branches: [ master, development ]
paths-ignore:
- "**.md"
- ".markdown_style.rb"
- ".mdlrc"
- "scripts/"

jobs:
test:
Expand All @@ -35,7 +37,7 @@ jobs:

- name: Install dependencies
run: |
python -m pip install --upgrade pip Flake8-pyproject pytest pytest-cov
python -m pip install --upgrade pip pytest pytest-cov ruff
pip install .

- name: Make configuration for tests
Expand All @@ -44,16 +46,20 @@ jobs:
run: |
./devscripts/configure${{ matrix.ext }}

- name: Lint with flake8
- name: Critical ruff lint
run: |
flake8 . --select=E9,F63,F7,F82
ruff check --select=E9,F63,F7,F82 .

- name: Test with pytest
run: |
pytest -m 'not slow' --verbose --cov=./bdfr/ --cov-report term:skip-covered --cov-report html
pytest -m "not slow" --verbose --cov=./bdfr/ --cov-report term:skip-covered --cov-report html

- name: Upload coverage report
uses: actions/upload-artifact@v3
with:
name: coverage_report
path: htmlcov/

- name: Full ruff lint
run: |
ruff check . --exit-zero
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,9 @@ venv.bak/
.dmypy.json
dmypy.json

# ruff
.ruff_cache/

# Pyre type checker
.pyre/

Expand All @@ -141,4 +144,4 @@ cython_debug/
test_config.cfg

.vscode/
.idea/
.idea/
2 changes: 1 addition & 1 deletion .markdown_style.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
all
exclude_tag :line_length
rule 'MD013', :line_length => 120, :code_blocks => false
rule 'MD007', :indent => 4
rule 'MD029', :style => 'ordered'
32 changes: 21 additions & 11 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,34 @@
# See https://pre-commit.com/hooks.html for more hooks

repos:
- repo: https://github.com/psf/black
rev: 22.12.0
- repo: https://github.com/abravalheri/validate-pyproject
rev: v0.13
hooks:
- id: black
- id: validate-pyproject
name: validate-pyproject

- repo: https://github.com/pycqa/isort
rev: 5.11.4
- repo: https://github.com/psf/black
rev: 23.3.0
hooks:
- id: isort
name: isort (python)
- id: black
name: black

- repo: https://github.com/pycqa/flake8
rev: 6.0.0
- repo: https://github.com/charliermarsh/ruff-pre-commit
rev: v0.1.13
hooks:
- id: flake8
additional_dependencies: [Flake8-pyproject]
- id: ruff
name: ruff
args: ["--fixable=I","--fix"]

- repo: https://github.com/markdownlint/markdownlint
rev: v0.12.0
hooks:
- id: markdownlint
name: markdownlint

- repo: https://github.com/adamchainz/blacken-docs
rev: 1.13.0
hooks:
- id: blacken-docs
name: blacken-docs
additional_dependencies: [black>=23.1.0]
247 changes: 184 additions & 63 deletions README.md

Large diffs are not rendered by default.

3 changes: 1 addition & 2 deletions bdfr/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-

__version__ = "2.6.2"
__version__ = "2.7.0"
55 changes: 30 additions & 25 deletions bdfr/__main__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-

import logging
import sys
Expand All @@ -20,10 +19,11 @@
click.argument("directory", type=str),
click.option("--authenticate", is_flag=True, default=None),
click.option("--config", type=str, default=None),
click.option("--disable-module", multiple=True, default=None, type=str),
click.option("--exclude-id", default=None, multiple=True),
click.option("--exclude-id-file", default=None, multiple=True),
click.option("--file-scheme", default=None, type=str),
click.option("--disable-module", type=str, multiple=True, default=None),
click.option("--downvoted", is_flag=True, default=None),
click.option("--exclude-id", type=str, multiple=True, default=None),
click.option("--exclude-id-file", type=str, multiple=True, default=None),
click.option("--file-scheme", type=str, default=None),
click.option("--filename-restriction-scheme", type=click.Choice(("linux", "windows")), default=None),
click.option("--folder-scheme", default=None, type=str),
click.option("--ignore-user", type=str, multiple=True, default=None),
Expand Down Expand Up @@ -65,25 +65,30 @@
_archiver_options = [
click.option("--all-comments", is_flag=True, default=None),
click.option("--comment-context", is_flag=True, default=None),
click.option("-f", "--format", type=click.Choice(("xml", "json", "yaml")), default=None),
click.option("-f", "--format", type=click.Choice(("xml", "json", "yaml")), default=None, multiple=True),
click.option("--skip-comments", is_flag=True, default=None),
]


def _add_options(opts: list):
def wrap(func):
def _add_options(opts: list): # noqa: ANN202
def wrap(func): # noqa: ANN001,ANN202
for opt in opts:
func = opt(func)
return func

return wrap


def _check_version(context, param, value):
def _check_version(context: click.core.Context, _param, value: bool) -> None:
if not value or context.resilient_parsing:
return
current = __version__
latest = requests.get("https://pypi.org/pypi/bdfr/json").json()["info"]["version"]
print(f"You are currently using v{current} the latest is v{latest}")
try:
latest = requests.get("https://pypi.org/pypi/bdfr/json", timeout=10).json()["info"]["version"]
print(f"You are currently using v{current} the latest is v{latest}")
except TimeoutError:
logger.exception(f"Timeout reached fetching current version from Pypi - BDFR v{current}")
raise
context.exit()


Expand All @@ -97,7 +102,7 @@ def _check_version(context, param, value):
callback=_check_version,
help="Check version and exit.",
)
def cli():
def cli() -> None:
"""BDFR is used to download and archive content from Reddit."""
pass

Expand All @@ -107,7 +112,7 @@ def cli():
@_add_options(_downloader_options)
@click.help_option("-h", "--help")
@click.pass_context
def cli_download(context: click.Context, **_):
def cli_download(context: click.Context, **_) -> None:
"""Used to download content posted to Reddit."""
config = Configuration()
config.process_click_arguments(context)
Expand All @@ -117,18 +122,18 @@ def cli_download(context: click.Context, **_):
reddit_downloader = RedditDownloader(config, [stream])
reddit_downloader.download()
except Exception:
logger.exception("Downloader exited unexpectedly")
logger.exception(f"Downloader exited unexpectedly - BDFR Downloader v{__version__}")
raise
else:
logger.info("Program complete")
logger.info(f"Program complete - BDFR Downloader v{__version__}")


@cli.command("archive")
@_add_options(_common_options)
@_add_options(_archiver_options)
@click.help_option("-h", "--help")
@click.pass_context
def cli_archive(context: click.Context, **_):
def cli_archive(context: click.Context, **_) -> None:
"""Used to archive post data from Reddit."""
config = Configuration()
config.process_click_arguments(context)
Expand All @@ -138,10 +143,10 @@ def cli_archive(context: click.Context, **_):
reddit_archiver = Archiver(config, [stream])
reddit_archiver.download()
except Exception:
logger.exception("Archiver exited unexpectedly")
logger.exception(f"Archiver exited unexpectedly - BDFR Archiver v{__version__}")
raise
else:
logger.info("Program complete")
logger.info(f"Program complete - BDFR Archiver v{__version__}")


@cli.command("clone")
Expand All @@ -150,7 +155,7 @@ def cli_archive(context: click.Context, **_):
@_add_options(_downloader_options)
@click.help_option("-h", "--help")
@click.pass_context
def cli_clone(context: click.Context, **_):
def cli_clone(context: click.Context, **_) -> None:
"""Combines archive and download commands."""
config = Configuration()
config.process_click_arguments(context)
Expand All @@ -160,17 +165,17 @@ def cli_clone(context: click.Context, **_):
reddit_scraper = RedditCloner(config, [stream])
reddit_scraper.download()
except Exception:
logger.exception("Scraper exited unexpectedly")
logger.exception(f"Scraper exited unexpectedly - BDFR Scraper v{__version__}")
raise
else:
logger.info("Program complete")
logger.info(f"Program complete - BDFR Cloner v{__version__}")


@cli.command("completion")
@cli.command("completions")
@click.argument("shell", type=click.Choice(("all", "bash", "fish", "zsh"), case_sensitive=False), default="all")
@click.help_option("-h", "--help")
@click.option("-u", "--uninstall", is_flag=True, default=False, help="Uninstall completion")
def cli_completion(shell: str, uninstall: bool):
def cli_completion(shell: str, uninstall: bool) -> None:
"""\b
Installs shell completions for BDFR.
Options: all, bash, fish, zsh
Expand All @@ -183,7 +188,7 @@ def cli_completion(shell: str, uninstall: bool):
Completion(shell).uninstall()
return
if shell not in ("all", "bash", "fish", "zsh"):
print(f"{shell} is not a valid option.")
print(f"{shell!r} is not a valid option.")
print("Options: all, bash, fish, zsh")
return
if click.confirm(f"Would you like to install {shell} completions for BDFR"):
Expand Down Expand Up @@ -212,7 +217,7 @@ def filter(self, record: logging.LogRecord) -> bool:
return stream


def silence_module_loggers():
def silence_module_loggers() -> None:
logging.getLogger("praw").setLevel(logging.CRITICAL)
logging.getLogger("prawcore").setLevel(logging.CRITICAL)
logging.getLogger("urllib3").setLevel(logging.CRITICAL)
Expand Down
1 change: 0 additions & 1 deletion bdfr/archive_entry/__init__.py
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
3 changes: 1 addition & 2 deletions bdfr/archive_entry/base_archive_entry.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-

from abc import ABC, abstractmethod
from typing import Union
Expand All @@ -8,7 +7,7 @@


class BaseArchiveEntry(ABC):
def __init__(self, source: Union[Comment, Submission]):
def __init__(self, source: Union[Comment, Submission]) -> None:
self.source = source
self.post_details: dict = {}

Expand Down
5 changes: 2 additions & 3 deletions bdfr/archive_entry/comment_archive_entry.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-

import logging

Expand All @@ -11,8 +10,8 @@


class CommentArchiveEntry(BaseArchiveEntry):
def __init__(self, comment: praw.models.Comment):
super(CommentArchiveEntry, self).__init__(comment)
def __init__(self, comment: praw.models.Comment) -> None:
super().__init__(comment)

def compile(self) -> dict:
self.source.refresh()
Expand Down
Loading
Loading