I am collecting data from a website and trying to save it to a database (or something similar that is very accessible) rather than having a heap of files on my desktop or in a folder.
我正在从网站收集数据并尝试将其保存到数据库(或类似的非常容易访问的东西),而不是在我的桌面或文件夹中有一堆文件。
There are many pages that I need to look at (1900 to be exact). I want to save time in getting this data, and decided to make a Java program to do this.
我需要查看许多页面(准确地说是1900)。我想节省获取这些数据的时间,并决定制作一个Java程序来完成这项工作。
This is basically what I am trying to do.
这基本上就是我想要做的。
- Visit the webpage: www.TestWebsite.com/items/0
- Save the (Name, Description, Image(png)) into one array/class to a Database.
- Repeat until I get up to: www.TestWebsite.com/items/1899
访问网页:www.TestWebsite.com/items/0
将(名称,描述,图像(png))保存到数据库的一个数组/类中。
重复,直到我起床:www.TestWebsite.com/items/1899
I want to be able to access this data offline without having to need to go online to view it.
我希望能够离线访问此数据,而无需在线查看。
Any ideas on how I should start. I have made a basic webpage viewer, I am just missing the step in between saving the strings and images to a database.
关于我应该如何开始的任何想法。我已经制作了一个基本的网页查看器,我只是错过了将字符串和图像保存到数据库之间的步骤。
I appreciate any help!
我感谢任何帮助!
2 个解决方案
#1
0
Actually just did this the other day. I used jsoup to scrap the webpages I needed and wrote to my local database. awesomely easy framework for webpage parsing.
实际上前几天就这样做了。我使用jsoup来删除我需要的网页并写入我的本地数据库。非常简单的网页解析框架。
#2
0
It's fairly straightforward, but you'll need to learn a little SQL if you haven't already.
这是相当简单的,但如果你还没有,你需要学习一点SQL。
You'll also have to pick a database platform - I'd suggest SQLite for such a purpose, since the data is for personal use and it's lightweight and easy to set up.
你还必须选择一个数据库平台 - 我建议SQLite用于这个目的,因为这些数据仅供个人使用,而且重量轻且易于设置。
Here's a tutorial on using JDBC (Java Database Connectivity) to talk with a SQLite database: http://en.wikibooks.org/wiki/Java_JDBC_using_SQLite. It goes from setup to inserting data, so once you've completed that it should be straightforward to modify your webpage viewing code to grab the data you need and shove it into the DB.
这是一个使用JDBC(Java数据库连接)与SQLite数据库通信的教程:http://en.wikibooks.org/wiki/Java_JDBC_using_SQLite。它从设置到插入数据,所以一旦你完成了它,就应该直接修改你的网页查看代码来获取你需要的数据并将其推送到数据库中。
Good luck!
#1
0
Actually just did this the other day. I used jsoup to scrap the webpages I needed and wrote to my local database. awesomely easy framework for webpage parsing.
实际上前几天就这样做了。我使用jsoup来删除我需要的网页并写入我的本地数据库。非常简单的网页解析框架。
#2
0
It's fairly straightforward, but you'll need to learn a little SQL if you haven't already.
这是相当简单的,但如果你还没有,你需要学习一点SQL。
You'll also have to pick a database platform - I'd suggest SQLite for such a purpose, since the data is for personal use and it's lightweight and easy to set up.
你还必须选择一个数据库平台 - 我建议SQLite用于这个目的,因为这些数据仅供个人使用,而且重量轻且易于设置。
Here's a tutorial on using JDBC (Java Database Connectivity) to talk with a SQLite database: http://en.wikibooks.org/wiki/Java_JDBC_using_SQLite. It goes from setup to inserting data, so once you've completed that it should be straightforward to modify your webpage viewing code to grab the data you need and shove it into the DB.
这是一个使用JDBC(Java数据库连接)与SQLite数据库通信的教程:http://en.wikibooks.org/wiki/Java_JDBC_using_SQLite。它从设置到插入数据,所以一旦你完成了它,就应该直接修改你的网页查看代码来获取你需要的数据并将其推送到数据库中。
Good luck!