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

reddit: add comment handling #1720

Merged
merged 1 commit into from
Nov 19, 2019
Merged

reddit: add comment handling #1720

merged 1 commit into from
Nov 19, 2019

Conversation

dgw
Copy link
Member

@dgw dgw commented Oct 25, 2019

Got annoyed after pasting yet another Reddit comment link and seeing Sopel spit out the submission (link) info instead. This was something like a 15 minute project. Pretty easy. 😁

@dgw dgw added the Feature label Oct 25, 2019
@dgw dgw added this to the 7.0.0 milestone Oct 25, 2019
@dgw dgw requested a review from a team October 25, 2019 01:48
@dgw dgw merged commit eb68d85 into master Nov 19, 2019
@dgw dgw deleted the reddit-comment-preview branch November 19, 2019 22:14
dgw added a commit that referenced this pull request Nov 23, 2019
This is a regular laundry list, honestly.

* `post_url` was end-anchored to prevent matching the same links as
  `comment_url`, but didn't allow for the `/post_title_slug/` usually
  included after the submission ID.
* `comment_url` & `post_url` used `.*` where they should have had `\S+`
  (whitespace is never present in reddit URLs, nor will any compenent of
  the link ever contain zero characters).
* `user_url` unnecessarily captured "ser" (or "") as group 1.
* So many unescaped `.`s everywhere!

Fixes post links failing to match and falling back to `url.py` title
fetching, and possibly some other silly bugs. I take full responsibility
for breaking `post_url` in #1720. Whoops.
dgw added a commit that referenced this pull request Nov 23, 2019
This is a regular laundry list, honestly.

* `post_url` was end-anchored to prevent matching the same links as
  `comment_url`, but didn't allow for the `/post_title_slug/` usually
  included after the submission ID.
* `comment_url` & `post_url` used `.*` where they should have had `\S+`
  (whitespace is never present in reddit URLs, nor will any compenent of
  the link ever contain zero characters).
* `user_url` unnecessarily captured "ser" (or "") as group 1.
* So many unescaped `.`s everywhere!

Fixes post links failing to match and falling back to `url.py` title
fetching, and possibly some other silly bugs. I take full responsibility
for breaking `post_url` in #1720. Whoops.
dgw added a commit that referenced this pull request Nov 23, 2019
This is a regular laundry list, honestly.

* `post_url` was end-anchored to prevent matching the same links as
  `comment_url`, but didn't allow for the `/post_title_slug/` usually
  included after the submission ID.
* `comment_url` & `post_url` used `.*` where they should have had `\S+`
  (whitespace is never present in reddit URLs, nor will any compenent of
  the link ever contain zero characters).
* `user_url` unnecessarily captured "ser" (or "") as group 1.
* So many unescaped `.`s everywhere!

Fixes post links failing to match and falling back to `url.py` title
fetching, and possibly some other silly bugs. I take full responsibility
for breaking `post_url` in #1720. Whoops.

Also adds error handling in `video_info()`, in case the hacky hack it
uses to get the post URL fails. The errors I saw in testing that led to
this whole patch were probably just because the `post_url` pattern was
broken (see above), but... why not handle the error case anyway?
dgw added a commit that referenced this pull request Nov 23, 2019
This is a regular laundry list, honestly.

* `post_url` was end-anchored to prevent matching the same links as
  `comment_url`, but didn't allow for the `/post_title_slug/` usually
  included after the submission ID.
* `comment_url` & `post_url` used `.*` where they should have had `\S+`
  (whitespace is never present in reddit URLs, nor will any compenent of
  the link ever contain zero characters).
* `user_url` unnecessarily captured "ser" (or "") as group 1.
* So many unescaped `.`s everywhere!

Fixes post links failing to match and falling back to `url.py` title
fetching, and possibly some other silly bugs. I take full responsibility
for breaking `post_url` in #1720. Whoops.

Also adds error handling in `video_info()`, in case the hacky hack it
uses to get the post URL fails. The errors I saw in testing that led to
this whole patch were probably just because the `post_url` pattern was
broken (see above), but... why not handle the error case anyway?
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants