Skip to content

Commit

Permalink
Fix user_posts
Browse files Browse the repository at this point in the history
  • Loading branch information
jpontoire committed Dec 20, 2024
1 parent e40d672 commit f53c451
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 9 deletions.
10 changes: 2 additions & 8 deletions minet/cli/reddit/user_posts.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,9 @@ def action(cli_args, enricher, loading_bar):
with loading_bar.step(url):
try:
if cli_args.number:
if cli_args.text:
posts = scraper.get_user_posts(url, cli_args.number)
else:
posts = scraper.get_user_posts(url, cli_args.number)
posts = scraper.get_user_posts(url, cli_args.number)
else:
if cli_args.text:
posts = scraper.get_user_posts(url)
else:
posts = scraper.get_user_posts(url)
posts = scraper.get_user_posts(url)
except RedditInvalidTargetError:
loading_bar.print(
"the script could not complete normally on line %i" % (i)
Expand Down
4 changes: 3 additions & 1 deletion minet/reddit/scraper.py
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,9 @@ def get_user_posts(self, url: str, nb = 25):
nb_comments = int(match.group(1))
else:
nb_comments = 0
link = post.scrape_one("a[class^='title']", "href")
link = resolve_relative_url(post.scrape_one("a[class^='title']", "href"))
if link == post_url:
link = ""
published_date = post.scrape("time", "datetime")

data = RedditUserPost(
Expand Down

0 comments on commit f53c451

Please sign in to comment.