-
Notifications
You must be signed in to change notification settings - Fork 26
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
feature/downloading-youtube-videos #169
feature/downloading-youtube-videos #169
Conversation
…placing the large video file
Codecov Report
@@ Coverage Diff @@
## main #169 +/- ##
==========================================
- Coverage 94.56% 94.54% -0.02%
==========================================
Files 50 50
Lines 2558 2587 +29
==========================================
+ Hits 2419 2446 +27
- Misses 139 141 +2
Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good overall! Just had a few comments about naming the file and accepting more url formats
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One minor nitpick but everything else looks perfect. Thanks for making the changes!
cdp_backend/utils/file_utils.py
Outdated
dst: str | ||
The location of the downloaded file. | ||
""" | ||
dst = Path(str(dst) + ".mp4") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Was about to merge but one last look I think catches this.
This will always overwrite the supplied dst
correct?
I think there simply needs to be an if dst is not None
before this statement.
Additionally the docstring / parameter typing should be updated to dst: Optional[Path] = None
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, I assumed that dst
is not empty since if dst
is None
, it would be a assigned a value, as seen here. I can throw an exception if dst
is None
though. WDYT?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ohhhh i see what you are doing. Yes. My mistake. Okay so then only nitpick would be instead of doing this str(dst) + ".mp4"
string addition. Path
has a function called with_suffix
that is "safer" imo.
Path(str(dst)).with_suffix(".mp4")
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But yes, you are correct. My mistake on on the overwrite vs simply adding the mp4
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just pushed a new change based on your feedback.
Link to Relevant Issue
This pull request resolves #161
Description of Changes
Make it possible for the program to download a YouTube video embedded onto a website. This is needed for the Portland scraper.