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

⚙️ Refactor requires #217

Merged
merged 2 commits into from
Mar 5, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ video = VideoInfo.new('http://www.youtube.com/watch?v=mZqGqE0D0n4', referer: 'ht

User-Agent when empty defaults to "VideoInfo/VERSION" - where version is current VideoInfo version, e.g. **"VideoInfo/0.2.7"**.

It supports all openURI header fields (options), for more information see: [openURI DOCS](http://www.ruby-doc.org/stdlib-1.9.3/libdoc/open-uri/rdoc/OpenURI.html)
It supports all `OpenURI` header fields (options), for more information see: [OpenURI docs](https://ruby-doc.org/3.2.0/stdlibs/open-uri/OpenURI.html).

You can also include an `iframe_attributes` or `url_attributes` hash to the `embed_code` method to include arbitrary attributes in the iframe embed code or as additional URL params:

Expand All @@ -175,8 +175,8 @@ VideoInfo.disable_providers = %w[YouTube] # disable YouTube
VideoInfo.disable_providers = %w[Vimeo YouTube] # disable Vimeo and Youtube
VideoInfo.disable_providers = [] # enable all providers
```
Note: `disable_providers` is case-insensitive. Attempting to use a disabled provider will raise a UrlError, just like attempting to use a
non-video URL.

**NOTE:** `disable_providers` is case-insensitive. Attempting to use a disabled provider will raise a UrlError, just like attempting to use a non-video URL.

## Contributing

Expand Down
8 changes: 5 additions & 3 deletions lib/video_info.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
require "video_info/version"
require "video_info/provider"
require "forwardable"
require "net/http"
require "logger"

class VideoInfo
Expand Down Expand Up @@ -39,8 +38,11 @@ def logger
extend Forwardable

PROVIDERS = %w[
Dailymotion Wistia
Vimeo Youtube YoutubePlaylist
Dailymotion
Wistia
Vimeo
Youtube
YoutubePlaylist
].freeze
PROVIDERS.each { |p| require "video_info/providers/#{p.downcase}" }

Expand Down
2 changes: 2 additions & 0 deletions lib/video_info/provider.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
require "open-uri"
require "json"
require "uri"
require "net/http"
require "openssl"

class VideoInfo
class Provider
Expand Down
3 changes: 0 additions & 3 deletions lib/video_info/providers/vimeo_scraper.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
require "oga"
require "open-uri"
require "json"
require "openssl"
require "cgi"

class VideoInfo
Expand Down
1 change: 0 additions & 1 deletion lib/video_info/providers/youtube_scraper.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
require "oga"
require "open-uri"
require "net_http_timeout_errors"

class VideoInfo
Expand Down
2 changes: 0 additions & 2 deletions lib/video_info/providers/youtubeplaylist_scraper.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
require "oga"

class VideoInfo
module Providers
module YoutubePlaylistScraper
Expand Down