Changeset 28987 in osm for applications
- Timestamp:
- 2012-11-25T20:57:21+01:00 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/wikipedia/src/org/wikipedia/WikipediaApp.java
r28983 r28987 67 67 static List<WikipediaEntry> getEntriesFromCategory(String wikipediaLang, String category, int depth) { 68 68 try { 69 final String url = "http://toolserver.org/~magnus/catscan_rewrite.php" 70 + "?project=wikipedia" 71 + "&ext_image_data=" 72 + "&file_usage_data=" 73 + "&show_redirects=no" 74 + "&format=tsv" 75 + "&doit=doit" 69 final String url = "http://toolserver.org/~simon04/cats.php" 70 + "?lang=" + wikipediaLang 76 71 + "&depth=" + depth 77 + "&language=" + wikipediaLang 78 + "&categories=" + encodeURL(category); 72 + "&cat=" + encodeURL(category); 79 73 System.out.println("Wikipedia: GET " + url); 80 74 final Scanner scanner = new Scanner(new URL(url).openStream(), "UTF-8").useDelimiter("\n"); 81 75 final List<WikipediaEntry> entries = new ArrayList<WikipediaEntry>(); 82 {83 // skip first two rows84 final String header = scanner.next(); // |subset85 if (!"|subset".equals(header.trim())) {86 throw new RuntimeException("Wikipedia: Invalid header: " + header);87 }88 final String colspec = scanner.next(); //title id namespace len touched seen nstext89 if (!colspec.startsWith("title")) {90 throw new RuntimeException("Wikipedia: Invalid colspec: " + colspec);91 }92 }93 76 while (scanner.hasNext()) { 94 final String article = scanner.next(). split("\t")[0].trim().replace("_", " ");77 final String article = scanner.next().trim().replace("_", " "); 95 78 entries.add(new WikipediaEntry(article, wikipediaLang, article)); 96 79 }
Note:
See TracChangeset
for help on using the changeset viewer.