use of delta.games.lotro.utils.DownloadService in project lotro-tools by dmorcellet.
the class RecipePageParser method findIdentifiers.
private void findIdentifiers(List<Recipe> recipes) {
String url = "http://lorebook.lotro.com/index.php?title=Recipe:" + _key + "&action=edit";
DownloadService downloader = DownloadService.getInstance();
try {
String page = downloader.getPage(url);
Source s = new Source(page);
// <textarea id="wpTextbox1"
Element pageSource = JerichoHtmlUtils.findElementByTagNameAndAttributeValue(s, HTMLElementName.TEXTAREA, "id", "wpTextbox1");
if (pageSource != null) {
String text = JerichoHtmlUtils.getTextFromTag(pageSource);
parsePageSource(text, recipes);
} else {
_logger.warn("Cannot find identifiers!");
}
} catch (Exception e) {
_logger.error("Parsing error", e);
}
}
use of delta.games.lotro.utils.DownloadService in project lotro-tools by dmorcellet.
the class QuestPageParser method findIdentifiers.
private void findIdentifiers(List<QuestDescription> quests) {
String url = "http://lorebook.lotro.com/index.php?title=Quest:" + _key + "&action=edit";
DownloadService downloader = DownloadService.getInstance();
try {
String page = downloader.getPage(url);
Source s = new Source(page);
// <textarea id="wpTextbox1"
Element pageSource = JerichoHtmlUtils.findElementByTagNameAndAttributeValue(s, HTMLElementName.TEXTAREA, "id", "wpTextbox1");
String text = JerichoHtmlUtils.getTextFromTag(pageSource);
parsePageSource(text, quests);
} catch (Exception e) {
_logger.error("Parsing error", e);
}
}
use of delta.games.lotro.utils.DownloadService in project lotro-tools by dmorcellet.
the class ItemIconsDownloader method doIt.
private void doIt() {
DownloadService downloader = DownloadService.getInstance();
File toFile = new File("items.xml").getAbsoluteFile();
_toDir.mkdirs();
HashMap<Integer, Item> items = loadItemsFile(toFile);
System.out.println(items.size());
for (Integer id : items.keySet()) {
System.out.println(id);
String url = "http://lotro.fr/img/bdd/items/" + id + ".png";
File to = new File(_toDir, id + ".png");
try {
downloader.downloadToFile(url, to);
} catch (DownloadException de) {
_logger.error("Cannot fetch icon [" + url + "]!", de);
}
}
}
Aggregations