22550
data/plugins_full.txt
Normal file
22550
data/plugins_full.txt
Normal file
File diff suppressed because it is too large
Load Diff
@@ -36,7 +36,7 @@ class Generate_Plugin_List
|
|||||||
# Send a HTTP request to the WordPress most popular plugins webpage
|
# Send a HTTP request to the WordPress most popular plugins webpage
|
||||||
# parse the response for the plugin names.
|
# parse the response for the plugin names.
|
||||||
|
|
||||||
def parse_plugins
|
def parse_popular_plugins
|
||||||
|
|
||||||
found_plugins = []
|
found_plugins = []
|
||||||
page_count = 1
|
page_count = 1
|
||||||
@@ -69,6 +69,15 @@ class Generate_Plugin_List
|
|||||||
|
|
||||||
found_plugins.uniq
|
found_plugins.uniq
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def parse_full_plugins
|
||||||
|
found_plugins = []
|
||||||
|
index = @browser.get('http://plugins.svn.wordpress.org/').body
|
||||||
|
index.scan(%r{<li><a href=".*">(.*)/</a></li>}i).each do |plugin|
|
||||||
|
found_plugins << plugin[0]
|
||||||
|
end
|
||||||
|
found_plugins.uniq
|
||||||
|
end
|
||||||
|
|
||||||
# Use the WordPress plugin SVN repo to find a
|
# Use the WordPress plugin SVN repo to find a
|
||||||
# valid plugin file. This will cut down on
|
# valid plugin file. This will cut down on
|
||||||
@@ -88,10 +97,10 @@ class Generate_Plugin_List
|
|||||||
puts "[+] Parsing plugin " + plugin + " [" + response.code.to_s + "]" if @verbose
|
puts "[+] Parsing plugin " + plugin + " [" + response.code.to_s + "]" if @verbose
|
||||||
file = response.body[%r{<li><a href="(\d*?[a-zA-Z].*\..*)">.+</a></li>}i, 1]
|
file = response.body[%r{<li><a href="(\d*?[a-zA-Z].*\..*)">.+</a></li>}i, 1]
|
||||||
if file
|
if file
|
||||||
|
# Only count Plugins with contents
|
||||||
plugin += "/" + file
|
plugin += "/" + file
|
||||||
|
plugins_with_paths << plugin + "\n"
|
||||||
end
|
end
|
||||||
|
|
||||||
plugins_with_paths << plugin + "\n"
|
|
||||||
end
|
end
|
||||||
|
|
||||||
queue_count += 1
|
queue_count += 1
|
||||||
@@ -113,9 +122,13 @@ class Generate_Plugin_List
|
|||||||
|
|
||||||
# Save the file
|
# Save the file
|
||||||
|
|
||||||
def save_file
|
def save_file(full=false)
|
||||||
begin
|
begin
|
||||||
plugins = parse_plugins
|
if (full)
|
||||||
|
plugins = parse_full_plugins
|
||||||
|
else
|
||||||
|
plugins = parse_popular_plugins
|
||||||
|
end
|
||||||
puts "[*] We have parsed " + plugins.size.to_s
|
puts "[*] We have parsed " + plugins.size.to_s
|
||||||
plugins_with_paths = parse_plugin_files(plugins)
|
plugins_with_paths = parse_plugin_files(plugins)
|
||||||
File.open(DATA_DIR + '/plugins.txt', 'w') { |f| f.write(plugins_with_paths) }
|
File.open(DATA_DIR + '/plugins.txt', 'w') { |f| f.write(plugins_with_paths) }
|
||||||
|
|||||||
@@ -12,6 +12,9 @@ def usage()
|
|||||||
puts "- Generate a new 'most popular' plugin list, up to 150 pages ..."
|
puts "- Generate a new 'most popular' plugin list, up to 150 pages ..."
|
||||||
puts "ruby " + script_name + " --generate_plugin_list 150"
|
puts "ruby " + script_name + " --generate_plugin_list 150"
|
||||||
puts
|
puts
|
||||||
|
puts "- Generate a new full plugin list"
|
||||||
|
puts "ruby " + script_name + " --generate_full_plugin_list"
|
||||||
|
puts
|
||||||
puts "See README for further information."
|
puts "See README for further information."
|
||||||
puts
|
puts
|
||||||
end
|
end
|
||||||
@@ -24,5 +27,7 @@ def help()
|
|||||||
puts "--update | -u Update to the latest revision."
|
puts "--update | -u Update to the latest revision."
|
||||||
puts "--generate_plugin_list [number of pages] Generate a new data/plugins.txt file. (supply number of *pages* to parse, default : 150)"
|
puts "--generate_plugin_list [number of pages] Generate a new data/plugins.txt file. (supply number of *pages* to parse, default : 150)"
|
||||||
puts "--gpl Alias for --generate_plugin_list"
|
puts "--gpl Alias for --generate_plugin_list"
|
||||||
|
puts "--generate_full_plugin_list Generate a new full data/plugins.txt file"
|
||||||
|
puts "--gfpl Alias for --generate_full_plugin_list"
|
||||||
puts
|
puts
|
||||||
end
|
end
|
||||||
|
|||||||
12
wpstools.rb
12
wpstools.rb
@@ -37,7 +37,9 @@ begin
|
|||||||
["--help", "-h", GetoptLong::NO_ARGUMENT],
|
["--help", "-h", GetoptLong::NO_ARGUMENT],
|
||||||
["--verbose", "-v", GetoptLong::NO_ARGUMENT],
|
["--verbose", "-v", GetoptLong::NO_ARGUMENT],
|
||||||
["--generate_plugin_list", GetoptLong::OPTIONAL_ARGUMENT],
|
["--generate_plugin_list", GetoptLong::OPTIONAL_ARGUMENT],
|
||||||
|
["--generate_full_plugin_list", GetoptLong::NO_ARGUMENT],
|
||||||
["--gpl", GetoptLong::OPTIONAL_ARGUMENT],
|
["--gpl", GetoptLong::OPTIONAL_ARGUMENT],
|
||||||
|
["--gfpl", GetoptLong::OPTIONAL_ARGUMENT],
|
||||||
["--update", "-u", GetoptLong::NO_ARGUMENT]
|
["--update", "-u", GetoptLong::NO_ARGUMENT]
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -59,13 +61,21 @@ begin
|
|||||||
@generate_plugin_list = true
|
@generate_plugin_list = true
|
||||||
when "--update"
|
when "--update"
|
||||||
@update = true
|
@update = true
|
||||||
|
when "--generate_full_plugin_list", "--gfpl"
|
||||||
|
@generate_full_plugin_list = true
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
if @generate_plugin_list
|
if @generate_plugin_list
|
||||||
puts "[+] Generating new most popular plugin list"
|
puts "[+] Generating new most popular plugin list"
|
||||||
puts
|
puts
|
||||||
Generate_Plugin_List.new(@number_of_pages, @verbose).save_file
|
Generate_Plugin_List.new(@number_of_pages, @verbose).save_file(false)
|
||||||
|
end
|
||||||
|
|
||||||
|
if @generate_full_plugin_list
|
||||||
|
puts "[+] Generating new full plugin list"
|
||||||
|
puts
|
||||||
|
Generate_Plugin_List.new(-1, @verbose).save_file(true)
|
||||||
end
|
end
|
||||||
|
|
||||||
if @update
|
if @update
|
||||||
|
|||||||
Reference in New Issue
Block a user