[reddit] fix documentation inconsistencies (closes #429)

- Require 'reddit.comments' to be a number and convert it to an
  integer to be extra sure
- Link to the README's OAuth section were appropriate
This commit is contained in:
Mike Fährmann
2019-09-27 17:34:10 +02:00
parent 20eb6c401f
commit 46ba173ded
2 changed files with 10 additions and 9 deletions

View File

@@ -603,8 +603,8 @@ extractor.deviantart.refresh-token
=========== ===== =========== =====
Type ``string`` Type ``string``
Default ``null`` Default ``null``
Description The ``refresh_token`` value you get from linking your Description The ``refresh_token`` value you get from
DeviantArt account to *gallery-dl*. `linking your DeviantArt account to gallery-dl <OAuth_>`__.
Using a ``refresh_token`` allows you to access private or otherwise Using a ``refresh_token`` allows you to access private or otherwise
not publicly available deviations. not publicly available deviations.
@@ -662,7 +662,7 @@ extractor.flickr.access-token & .access-token-secret
Type ``string`` Type ``string``
Default ``null`` Default ``null``
Description The ``access_token`` and ``access_token_secret`` values you get Description The ``access_token`` and ``access_token_secret`` values you get
from linking your Flickr account to *gallery-dl*. from `linking your Flickr account to gallery-dl <OAuth_>`__.
=========== ===== =========== =====
@@ -830,7 +830,7 @@ Description A list of extractor categories which should be ignored when using
extractor.reddit.comments extractor.reddit.comments
------------------------- -------------------------
=========== ===== =========== =====
Type ``integer`` or ``string`` Type ``integer``
Default ``500`` Default ``500``
Description The value of the ``limit`` parameter when loading Description The value of the ``limit`` parameter when loading
a submission and its comments. a submission and its comments.
@@ -840,7 +840,7 @@ Description The value of the ``limit`` parameter when loading
Reddit's internal default and maximum values for this parameter Reddit's internal default and maximum values for this parameter
appear to be 200 and 500 respectively. appear to be 200 and 500 respectively.
The value `0` ignores all comments and significantly reduces the The value ``0`` ignores all comments and significantly reduces the
time required when scanning a subreddit. time required when scanning a subreddit.
=========== ===== =========== =====
@@ -897,8 +897,8 @@ extractor.reddit.refresh-token
=========== ===== =========== =====
Type ``string`` Type ``string``
Default ``null`` Default ``null``
Description The ``refresh_token`` value you get from linking your Description The ``refresh_token`` value you get from
Reddit account to *gallery-dl*. `linking your Reddit account to gallery-dl <OAuth_>`__.
Using a ``refresh_token`` allows you to access private or otherwise Using a ``refresh_token`` allows you to access private or otherwise
not publicly available subreddits, given that your account is not publicly available subreddits, given that your account is
@@ -1863,4 +1863,5 @@ Description An object with the ``name`` of a post-processor and its options.
.. _datetime: https://docs.python.org/3/library/datetime.html#datetime-objects .. _datetime: https://docs.python.org/3/library/datetime.html#datetime-objects
.. _datetime.max: https://docs.python.org/3/library/datetime.html#datetime.datetime.max .. _datetime.max: https://docs.python.org/3/library/datetime.html#datetime.datetime.max
.. _Authentication: https://github.com/mikf/gallery-dl#authentication .. _Authentication: https://github.com/mikf/gallery-dl#authentication
.. _OAuth: https://github.com/mikf/gallery-dl#oauth
.. _youtube-dl: https://github.com/ytdl-org/youtube-dl .. _youtube-dl: https://github.com/ytdl-org/youtube-dl

View File

@@ -179,7 +179,7 @@ class RedditAPI():
def __init__(self, extractor): def __init__(self, extractor):
self.extractor = extractor self.extractor = extractor
self.comments = extractor.config("comments", 500) self.comments = text.parse_int(extractor.config("comments", 500))
self.morecomments = extractor.config("morecomments", False) self.morecomments = extractor.config("morecomments", False)
self.refresh_token = extractor.config("refresh-token") self.refresh_token = extractor.config("refresh-token")
self.log = extractor.log self.log = extractor.log
@@ -191,7 +191,7 @@ class RedditAPI():
self.client_id = None self.client_id = None
self.log.warning( self.log.warning(
"Conflicting values for 'client-id' and 'user-agent': " "Conflicting values for 'client-id' and 'user-agent': "
"override either both or none of them.") "overwrite either both or none of them.")
else: else:
self.client_id = client_id self.client_id = client_id
extractor.session.headers["User-Agent"] = user_agent extractor.session.headers["User-Agent"] = user_agent