diff --git a/pom.xml b/pom.xml
index 30d9606..ce6b2f7 100644
--- a/pom.xml
+++ b/pom.xml
@@ -3,7 +3,7 @@
4.0.0
com.github.adriens.imgflip
imgflip4j
- 1.3
+ 1.4
jar
A Java SDK to interact with Imgflip API.
diff --git a/src/main/java/com/github/adriens/imgflip/sdk/imgflip/sdk/PublishedMemesCrawler.java b/src/main/java/com/github/adriens/imgflip/sdk/imgflip/sdk/PublishedMemesCrawler.java
index 24fb999..26c86a4 100644
--- a/src/main/java/com/github/adriens/imgflip/sdk/imgflip/sdk/PublishedMemesCrawler.java
+++ b/src/main/java/com/github/adriens/imgflip/sdk/imgflip/sdk/PublishedMemesCrawler.java
@@ -47,11 +47,15 @@ public static List getPublishedMemes()
public static List getPublishedMemes(int page)
throws IOException {
- return getPublishedMemes(null, page);
+ return getPublishedMemes("fun", page);
}
public static List getPublishedMemes(String stream, int page)
throws IOException {
+ String lStream;
+ if(stream == null || stream.isEmpty()){
+ lStream = "fun";
+ }
String imgFlipUrl = ImgFlipURLHelper.getPagePath(stream, page);
return getPublishedMemes(imgFlipUrl);
}
@@ -71,10 +75,10 @@ public static List getPublishedMemes(String targetUrl)
Iterator memeDivsIterator = divMemesList.iterator();
int i = 1;
DomElement lDivision;
- String imgPath;
+ //String imgPath;
String imgTitle;
String imgTitleAlt;
- HtmlElement lHref;
+ //HtmlElement lHref;
String rawXml;
String lMemeTitle;
HtmlElement lTitleElement;
@@ -97,12 +101,12 @@ public static List getPublishedMemes(String targetUrl)
logger.info("Meme title : <" + lMemeTitle + ">");
lMeme.setTitle(lMemeTitle);
- lHref = lDivision.getFirstByXPath(".//div[@class='base-img-wrap-wrap']/div[@class='base-img-wrap']/a");
+ //lHref = lDivision.getFirstByXPath(".//div[@class='base-img-wrap-wrap']/div[@class='base-img-wrap']/a");
//lHref = lDivision.getFirstByXPath(".//h2[1]/a");
//HtmlElement lHref = lDivision.getFirstByXPath("//h2[@class='base-unit-title']/a");
//HtmlElement lHref = lDivision.getFirstByXPath("/html/body/div[2]/div[3]/div[6]/h2/a");
//logger.info("href : <" + lHref + ">");
- imgPath = lHref.getAttribute("href");
+ //imgPath = lHref.getAttribute("href");
//imgTitleAlt = lHref.getAttribute("alt");
//logger.info(lHref.asXml());
//logger.info("Found href : <" + imgPath + ">");
@@ -219,11 +223,13 @@ public static String getNextPageUrl(String anyImgflipUrl) throws IOException {
}
public static void main(String[] args) throws Exception {
- //List memes = PublishedMemesCrawler.getPublishedMemes();
+ List memes = PublishedMemesCrawler.getPublishedMemes();
//PublishedmemesCrawler.getNextPageUrl("https://imgflip.com/";//m/fun?sort=latest&after=53z8gv");
- List memes = PublishedMemesCrawler.getPublishedMemes("fun", 1);
+ //List memes = PublishedMemesCrawler.getPublishedMemes("fun", 1);
+ int i = 1;
for (PublishedMeme aMeme : memes) {
- System.out.println(aMeme);
+ System.out.println(i + ". " + aMeme);
+ i++;
}
System.exit(0);
}