r/javahelp • • Jul 02 '14

A Java Manga App

I want to make a java program. It has a search box to search mangas from different site. Then it will download the pages from the site.

It is an app like mangasearch you can find on android but use on a computer. The question is I don't know how to use java to search on manga websites and how to download the pages.

Thanks!

1 Upvotes

15 comments sorted by

9

u/[deleted] Jul 02 '14

"Hey guys, I want to make this thing. How do I do all of it?"

-3

u/[deleted] Jul 02 '14

I am just trying to know what method or library going to be need for this project. All I asking are two things, one is the way to implement the search engine on my manga app and two is to download all the images from the website. There are many different similar apps out there so it is something many people may already understand.

6

u/nret Jul 02 '14

I preemptively apologize for the snarkyness of this comment.

what method...

A lot of them.

what library...

A lot of them. I would suggest Jsoup for the web scraping. Probably Swing for your UI

implement the search engine

That's a big 'one thing'. Start with a text box to receive the text, does the mango site have a search bar--use that if you can, otherwise have it search your database of mangos (no clue where you'd get that database)

download all the images from the website

Now THIS is a good question, I would suggest using the ImageIO class, it has some really nice helper methods.

I would also suggest using a UI builder to help you with the UI, WindowsBuilderPro from Google is the one I've used the most (I think that's the name, ill edit this post when I check), I think NetBeans also has a built in UI builder.

1

u/[deleted] Jul 02 '14

Thanks for your answer.

I was trying to have a basic understanding on the things I going to need before dive deeper into the project. You really gave me a perfect answer I am looking for. Thanks a lot.

5

u/nret Jul 03 '14 edited Jul 03 '14

Start with something simple.

Make a webscraper that scrapes their "newest douji--I mean mangos", and display (in the console (System.out.println();) the first 5.

You'll get acquainted with Jsoup, you won't need to have a UI, and you'll get the first steps you need to continue your larger project.

(Bonus: to get acquainted with ImageIO, download the images from the most recent doujin--I mean mango.)

This type of project is similar to some of my first projects when I started coding. So I guess I'm saying, I think it's a good project to start with.

Good luck!

1

u/[deleted] Jul 04 '14

I just look up Jsoup. It is very convieniet to use. I think I am going to use Jsoup for this project. Thanks for you suggestion!

4

u/Blackduck606 Extreme Brewer Jul 03 '14

If you want HTML parsing, I've had a good experience with Jsoup. You can easily crawl webpages with it for content.

You should probably look into if the websites you want to access have APIs for them. If they don't, your best bet is probably to just search www.somerandomsite.com/?search=some+query and then use Jsoup to parse the results and then the Java standard lib can read content from websites. The problem you'll face constantly is that since you're hardcoding how navigate the website, the program will stop working correctly every time a website changes its layout.

1

u/[deleted] Jul 03 '14

Do you think there is any ways for me to get into their database and collects the contents from there?

1

u/nret Jul 03 '14 edited Jul 03 '14

From an API you wouldn't get direct access to their DB, it would allow you to programmatically make calls to through the API to browse the site with out having to do web scraping.

So, no, it most likely wouldn't let you do that.

1

u/[deleted] Jul 03 '14

Can I go into their database and collect the data from there even I don't have their API?

1

u/nret Jul 03 '14

Yes, if you can successfully scrap their website you can essentially rebuild their DB, but it would probably take your program longer than instant to get the job done (might even take days depending on how much is has to scrap)... Which will also need to be reran when they update mangos... Their webdevs would probably also notice the spike in traffic from your ip cause by your crawler, might be bad.

You'd be best off prompting the user for what they want, and using the sites search feature.

1

u/Blackduck606 Extreme Brewer Jul 03 '14

Not unless they publicly exposed their database. You can try going on pages and doing View Source to see if they have any calls in there that you could duplicate. Most websites have preprocessing (often through PHP but not exclusively) that make it so that you never see the database calls.

1

u/nret Jul 03 '14

If they did make API calls in the source HTML, wouldn't it have to be in JS?

0

u/[deleted] Jul 03 '14

[deleted]

1

u/[deleted] Jul 03 '14

Thanks! I can't believe one of the most famous manga reader actually share its source code to public.

This is extremely helpful. Do you think I can open apk to read into the source code.

2

u/nret Jul 03 '14

Short answer. It wouldn't be useful to you.

Semi-ish long amswer. You can open it, but decompiling it to understandable java is an additional step.

And to be honest you probably wouldn't understand their code if you don't already firmly understand classes, inheritance, polymorphism, and all that awesome OOP jazz.