Guest User

DanBri

a guest
Nov 12th, 2009
49
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 1.31 KB | None | 0 0
  1. #!/usr/bin/ruby -rubygems
  2. url = 'http://en.wikipedia.org/w/index.php?title=Andrew_Marr%27s_The_Making_of_Modern_Britain&action=edit'
  3. wikitext = `curl -s "#{url}" `
  4. wikitext.gsub!(/\n/,"")
  5. puts
  6. puts wikitext
  7. puts "\n\n++++\n\n"
  8. hits = wikitext.scan( /\[\[(.+?)\]\]/ ).flatten
  9. hits.each do |x|
  10.   next if !(x =~ /\w/)
  11.   next if (x =~ /File:/)
  12.   next if (x =~ /Media:/)
  13.   next if (x =~ /\[\[/)
  14.   next if (x =~ /\]\]/)
  15.   x.gsub!(/(\|.*)/,"")
  16.   puts "TOPIC: #{x}"
  17. end
  18.  
  19.  
  20.  
  21. #�notes
  22.  
  23. example = """
  24. TOPIC: Documentary film
  25. TOPIC: Andrew Marr
  26. TOPIC: English language
  27. TOPIC: BBC Two
  28. TOPIC: PAL
  29. TOPIC: 576i
  30. TOPIC: Stereophonic sound
  31. TOPIC: Andrew Marr's History of Modern Britain
  32. TOPIC: 2009 in British television
  33. TOPIC: BBC
  34. TOPIC: documentary television series
  35. TOPIC: Andrew Marr
  36. TOPIC: Queen Victoria
  37. TOPIC: Second World War
  38. TOPIC: Herbert_Kitchener,_1st_Earl_Kitchener
  39. TOPIC: Lord_Kitchener_Wants_You
  40. TOPIC: Gunboat
  41. TOPIC: John_Fisher,_1st_Baron_Fisher
  42. TOPIC: Trench_warfare
  43. TOPIC: Flanders
  44. TOPIC: David_Lloyd_George
  45. TOPIC: BBC Online
  46. TOPIC: Category:2009 British television programme debuts
  47. TOPIC: Category:2009 television series endings
  48. TOPIC: Category:2000s British television series
  49. TOPIC: Category:BBC television documentaries on history
  50. TOPIC: Category:Political history of the United Kingdom
  51. """
  52.  
Advertisement
Add Comment
Please, Sign In to add comment