@@ -32,7 +32,7 @@ of this software and associated documentation files (the "Software"), to deal
3232import org .jsoup .nodes .*;
3333import org .jsoup .select .*;
3434
35- // VERSÃO 1.0
35+ // VERSÃO 1.1
3636
3737public class EDownloaderInfo {
3838 // Propriedades privadas
@@ -50,13 +50,21 @@ public class EDownloaderInfo {
5050
5151 private List <String > imagePages = new ArrayList <String >();
5252 private List <String > albumPages = new ArrayList <String >();
53- private List <String > imageLinks = new ArrayList <String >();
53+
54+ // As propriedades abaixo poderão retornar
55+ // ---------------------------------------
56+ private ArrayList <String > imageLinks = new ArrayList <String >();
5457
5558 private String albumName = "" ;
59+ private String albumLanguage = "" ;
60+ private String uploadDate = "" ;
61+ private String uploader = "" ;
62+ private String fileSize = "" ;
5663 private String error = "" ;
5764
5865 private int pages = 0 ;
5966
67+ private boolean isTranslated = false ;
6068 private boolean isOk = false ;
6169
6270 // Construtor da Classe
@@ -81,6 +89,10 @@ private boolean pGetInfo() {
8189 doc = Jsoup .connect (albumURL ).cookie ("nw" , "1" ).get ();
8290 albumName = String .format ("%s" , doc .title ()).replace (" - E-Hentai Galleries" , "" );
8391
92+ pGetAlbumLanguage ();
93+ pGetUploader ();
94+ pGetUploadDate ();
95+ pGetFileSize ();
8496 pGetAlbumPages ();
8597 pGetImagePages ();
8698 pGetImageLinks ();
@@ -97,13 +109,13 @@ private boolean pGetInfo() {
97109 }
98110
99111 // Verificando se a URL pertence ao site
100- // =====================================
112+ // -------------------------------------
101113 private boolean checkURLDomain () {
102114 try {
103115 URL u = new URL (albumURL );
104116 if (u .getAuthority ().equals ("e-hentai.org" )) {
105- // Caso o usuário insira algo além da primeira página
106- // --------------------------------------------------
117+ // Caso o usuário insira além da primeira página
118+ // ---------------------------------------------
107119 albumURL = albumURL .replaceAll ("\\ ?p=.*" , "" );
108120 return true ;
109121 }
@@ -116,6 +128,104 @@ private boolean checkURLDomain() {
116128 }
117129 }
118130
131+ // Resgatando idioma do álbum
132+ // --------------------------
133+ private void pGetAlbumLanguage () {
134+ links = doc .select ("div[id=gdd]" );
135+
136+ for (Element e : links ) {
137+ Elements table = e .getElementsByTag ("table" );
138+
139+ for (Element t : table ) {
140+ Elements row = t .getElementsByTag ("tr" );
141+
142+ for (Element l : row ) {
143+ Elements lang = l .getElementsByClass ("gdt2" );
144+ Elements langDescr = l .getElementsByClass ("gdt1" );
145+
146+ int i = 0 ;
147+ for (Element ll : langDescr ) {
148+ if (ll .text ().toString ().contains ("Language" )) {
149+ if (lang .get (i ).text ().toString ().contains ("TR" )) {
150+ isTranslated = true ;
151+ }
152+
153+ albumLanguage = lang .get (i )
154+ .text ()
155+ .toString ()
156+ .replace (" " , "" )
157+ .replace ("TR" , "" );
158+ return ;
159+ }
160+
161+ i += 1 ;
162+ }
163+ }
164+ }
165+ }
166+ }
167+
168+ // Resgatando nome do uploader
169+ // ---------------------------
170+ private void pGetUploader () {
171+ links = doc .select ("div[id=gdn]" );
172+
173+ for (Element e : links ) {
174+ Elements uplName = e .getElementsByTag ("a" );
175+ uploader = uplName .text ().toString ();
176+ }
177+ }
178+
179+ // Resgatando data do upload
180+ // -------------------------
181+ private void pGetUploadDate () {
182+ links = doc .select ("div[id=gdd]" );
183+
184+ for (Element e : links ) {
185+ Elements table = e .getElementsByTag ("table" );
186+
187+ for (Element t : table ) {
188+ Elements row = t .getElementsByTag ("tr" );
189+
190+ for (Element d : row ) {
191+ Elements date = d .getElementsByClass ("gdt2" );
192+
193+ for (Element dd : date ) {
194+ uploadDate = dd .text ().toString ()
195+ .replace ("-" , "/" )
196+ .replace (" " , " - " );
197+ return ;
198+ }
199+ }
200+ }
201+ }
202+ }
203+
204+ // Resgatando tamanho do álbum
205+ // ---------------------------
206+ private void pGetFileSize () {
207+ links = doc .select ("div[id=gdd]" );
208+ String bytes [] = {"B" , "KB" , "MB" , "GB" , "TB" };
209+
210+ for (Element e : links ) {
211+ Elements table = e .getElementsByTag ("table" );
212+
213+ for (Element t : table ) {
214+ Elements row = t .getElementsByTag ("tr" );
215+
216+ for (Element f : row ) {
217+ Elements fs = f .getElementsByClass ("gdt2" );
218+
219+ for (String b : bytes ) {
220+ if (fs .text ().toString ().endsWith (b )) {
221+ fileSize = fs .text ().toString ();
222+ }
223+ }
224+ }
225+ }
226+ }
227+ }
228+
119229 // Resgatando páginas do álbum, da forma como é mostrado no site
120230 // -------------------------------------------------------------
121231 private void pGetAlbumPages () {
@@ -194,7 +304,7 @@ public boolean isSuccessful() {
194304
195305 // Resgatando link absoluto das imagens
196306 // ------------------------------------
197- public List <String > getImages () {
307+ public ArrayList <String > getImages () {
198308 return imageLinks ;
199309 }
200310
@@ -210,6 +320,36 @@ public String getAlbumName() {
210320 return albumName ;
211321 }
212322
323+ // Resgatando idioma do álbum
324+ // --------------------------
325+ public String getAlbumLanguage () {
326+ return albumLanguage ;
327+ }
328+
329+ // Verificando se o álbum é uma tradução
330+ // -------------------------------------
331+ public boolean isTranslated () {
332+ return isTranslated ;
333+ }
334+
335+ // Resgatando nome do uploader
336+ // ---------------------------
337+ public String getUploader () {
338+ return uploader ;
339+ }
340+
341+ // Resgatando data do upload
342+ // -------------------------
343+ public String getUploadDate () {
344+ return uploadDate ;
345+ }
346+
347+ // Resgatando tamanho do álbum
348+ // ---------------------------
349+ public String getFileSize () {
350+ return fileSize ;
351+ }
352+
213353 // Resgatando mensagem de erro
214354 // ---------------------------
215355 public String getError () {
0 commit comments