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

Add valid_url? helper #208

Merged
merged 2 commits into from
Jan 29, 2023
Merged

Add valid_url? helper #208

merged 2 commits into from
Jan 29, 2023

Conversation

markets
Copy link
Collaborator

@markets markets commented Jan 26, 2023

Closes #158

Add new helper valid_url? to check if a url is valid in some of the enabled providers:

> VideoInfo.valid_url?('http://www.youtube.com/watch?v=AT_5xOGh6Ko')
=> true
> VideoInfo.valid_url?('http://vimeo.com/898029')
=> true
> VideoInfo.valid_url?('http://www.example.com/video/12345')
=> false

Copy link

@houndci-bot houndci-bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some files could not be reviewed due to errors:

.rubocop.yml: Style/DotPosition has the wrong namespace - should be Layout
.rubocop.yml: Style/DotPosition has the wrong namespace - should be Layout
.rubocop.yml: Style/FileName has the wrong namespace - should be Naming
.rubocop.yml: Style/PredicateName has the wrong namespace - should be Naming
.rubocop.yml: Style/AccessorMethodName has the wrong namespace - should be Naming
Error: The `Style/TrailingCommaInLiteral` cop no longer exists. Please use `Style/TrailingCommaInArrayLiteral` and/or `Style/TrailingCommaInHashLiteral` instead.
(obsolete configuration found in .rubocop.yml, please update it)
obsolete parameter MaxLineLength (for Style/IfUnlessModifier) found in .rubocop.yml
`Style/IfUnlessModifier: MaxLineLength` has been removed. Use `Metrics/LineLength: Max` instead

lib/video_info.rb Outdated Show resolved Hide resolved
lib/video_info.rb Outdated Show resolved Hide resolved
Copy link

@houndci-bot houndci-bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some files could not be reviewed due to errors:

.rubocop.yml: Style/DotPosition has the wrong namespace - should be Layout
.rubocop.yml: Style/DotPosition has the wrong namespace - should be Layout
.rubocop.yml: Style/FileName has the wrong namespace - should be Naming
.rubocop.yml: Style/PredicateName has the wrong namespace - should be Naming
.rubocop.yml: Style/AccessorMethodName has the wrong namespace - should be Naming
Error: The `Style/TrailingCommaInLiteral` cop no longer exists. Please use `Style/TrailingCommaInArrayLiteral` and/or `Style/TrailingCommaInHashLiteral` instead.
(obsolete configuration found in .rubocop.yml, please update it)
obsolete parameter MaxLineLength (for Style/IfUnlessModifier) found in .rubocop.yml
`Style/IfUnlessModifier: MaxLineLength` has been removed. Use `Metrics/LineLength: Max` instead

@markets
Copy link
Collaborator Author

markets commented Jan 27, 2023

@thibaudgg updated with your suggestions + mention in the README.

NOTE the build seems a bit broken, over 40 specs fail (mostly related to vcr) for me locally (also in CI). But this one passes ✔️ without any problem:

$ bundle exec rspec spec/lib/video_info_spec.rb 
...
Finished in 0.01914 seconds (files took 0.67107 seconds to load)
10 examples, 0 failures

@thibaudgg
Copy link
Owner

@markets thanks for the update. 👍

Yes, some work would be required to fix the build and update it to support the latest Ruby version, but I don't have much time for it now. Please feel free to have a look and submit a PR to improve it.

@thibaudgg thibaudgg merged commit 927d41c into thibaudgg:master Jan 29, 2023
@thibaudgg
Copy link
Owner

3.1.0 released.

@miguelpeniche
Copy link

Hi there @thibaudgg. There is a minor bug: with the Vimeo user page VideoInfo.valid_url? "https://vimeo.com/user123456789" is returning true.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Helper function to check validity of a URL
4 participants