Module: PWN::WWW::Youtube

Defined in:
lib/pwn/www/youtube.rb

Overview

This plugin supports Youtube actions.

Class Method Summary collapse

Class Method Details

.authorsObject

Author(s)

0day Inc. [email protected]



59
60
61
62
63
# File 'lib/pwn/www/youtube.rb', line 59

public_class_method def self.authors
  "AUTHOR(S):
    0day Inc. <[email protected]>
  "
end

.close(opts = {}) ⇒ Object

Supported Method Parameters

browser_obj = PWN::WWW::Youtube.close( browser_obj: 'required - browser_obj returned from #open method' )



48
49
50
51
52
53
54
55
# File 'lib/pwn/www/youtube.rb', line 48

public_class_method def self.close(opts = {})
  browser_obj = opts[:browser_obj]
  PWN::Plugins::TransparentBrowser.close(
    browser_obj: browser_obj
  )
rescue StandardError => e
  raise e
end

.helpObject

Display Usage for this Module



67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
# File 'lib/pwn/www/youtube.rb', line 67

public_class_method def self.help
  puts "USAGE:
    # Open a session or connection and return a handle.
    #{self}.open(
      browser_type: 'optional - :firefox|:chrome|:ie|:headless (Defaults to :firefox)',
      proxy: 'optional - scheme://proxy_host:port || tor'
    )

    # Run a search using the open session.
    #{self}.search(
      browser_obj: 'required - browser_obj returned from #open method',
      q: 'required - search string'
    )

    # Close a session previously returned by #open.
    #{self}.close(
      browser_obj: 'required - browser_obj returned from #open method'
    )

    # Print the AUTHOR(S) string for this module.
    #{self}.authors
  "
  constants.sort
end

.open(opts = {}) ⇒ Object

Supported Method Parameters

browser_obj = PWN::WWW::Youtube.open( browser_type: 'optional - :firefox|:chrome|:ie|:headless (Defaults to :firefox)', proxy: 'optional - scheme://proxy_host:port || tor' )



13
14
15
16
17
18
19
20
21
22
# File 'lib/pwn/www/youtube.rb', line 13

public_class_method def self.open(opts = {})
  browser_obj = PWN::Plugins::TransparentBrowser.open(opts)

  browser = browser_obj[:browser]
  browser.goto('https://www.youtube.com')

  browser_obj
rescue StandardError => e
  raise e
end

.search(opts = {}) ⇒ Object

Supported Method Parameters

browser_obj = PWN::WWW::Youtube.search( browser_obj: 'required - browser_obj returned from #open method', q: 'required - search string' )



30
31
32
33
34
35
36
37
38
39
40
41
# File 'lib/pwn/www/youtube.rb', line 30

public_class_method def self.search(opts = {})
  browser_obj = opts[:browser_obj]
  q = opts[:q].to_s

  browser = browser_obj[:browser]
  browser.text_field(name: 'search_query').wait_until(&:present?).set(q)
  browser.button(id: 'search-btn').click!

  browser_obj
rescue StandardError => e
  raise e
end