Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/ruby -rubygems
- url = 'http://en.wikipedia.org/w/index.php?title=Andrew_Marr%27s_The_Making_of_Modern_Britain&action=edit'
- wikitext = `curl -s "#{url}" `
- wikitext.gsub!(/\n/,"")
- puts
- puts wikitext
- puts "\n\n++++\n\n"
- hits = wikitext.scan( /\[\[(.+?)\]\]/ ).flatten
- hits.each do |x|
- next if !(x =~ /\w/)
- next if (x =~ /File:/)
- next if (x =~ /Media:/)
- next if (x =~ /\[\[/)
- next if (x =~ /\]\]/)
- x.gsub!(/(\|.*)/,"")
- puts "TOPIC: #{x}"
- end
- #�notes
- example = """
- TOPIC: Documentary film
- TOPIC: Andrew Marr
- TOPIC: English language
- TOPIC: BBC Two
- TOPIC: PAL
- TOPIC: 576i
- TOPIC: Stereophonic sound
- TOPIC: Andrew Marr's History of Modern Britain
- TOPIC: 2009 in British television
- TOPIC: BBC
- TOPIC: documentary television series
- TOPIC: Andrew Marr
- TOPIC: Queen Victoria
- TOPIC: Second World War
- TOPIC: Herbert_Kitchener,_1st_Earl_Kitchener
- TOPIC: Lord_Kitchener_Wants_You
- TOPIC: Gunboat
- TOPIC: John_Fisher,_1st_Baron_Fisher
- TOPIC: Trench_warfare
- TOPIC: Flanders
- TOPIC: David_Lloyd_George
- TOPIC: BBC Online
- TOPIC: Category:2009 British television programme debuts
- TOPIC: Category:2009 television series endings
- TOPIC: Category:2000s British television series
- TOPIC: Category:BBC television documentaries on history
- TOPIC: Category:Political history of the United Kingdom
- """
Advertisement
Add Comment
Please, Sign In to add comment