1
0
Fork 0
mirror of synced 2024-06-27 02:20:45 +12:00

Re-implement --link option

This commit is contained in:
Serene-Arc 2021-02-15 18:05:04 +10:00 committed by Ali Parlakci
parent bb85fb8934
commit ae5ed75226
2 changed files with 8 additions and 0 deletions

View file

@ -31,6 +31,7 @@ def _add_options():
default=False)
parser.add_argument("--link", "-l",
help="Get posts from link",
action='append',
metavar="link")
parser.add_argument("--saved",
action="store_true",

View file

@ -75,6 +75,7 @@ class RedditDownloader:
master_list.extend(self._get_subreddits())
master_list.extend(self._get_multireddits())
master_list.extend(self._get_user_data())
master_list.extend(self._get_submissions_from_link())
return master_list
def _determine_directories(self):
@ -112,6 +113,12 @@ class RedditDownloader:
else:
return []
def _get_submissions_from_link(self) -> list[list[praw.models.Submission]]:
supplied_submissions = []
for url in self.args.link:
supplied_submissions.append(self.reddit_instance.submission(url=url))
return [supplied_submissions]
def _determine_sort_function(self):
if self.sort_filter is RedditTypes.SortType.NEW:
sort_function = praw.models.Subreddit.new