- 浏览: 373542 次
- 性别:
- 来自: 四川
文章分类
- 全部博客 (247)
- 数据库以及sql (11)
- java (48)
- 爬虫学习 (20)
- java编程 (28)
- python编程以及安装和配置 (27)
- oracle数据库 (32)
- mongodb基本操作 (4)
- linux学习 (7)
- easyUI (2)
- nodeJs (8)
- python学习 (16)
- 其他 (13)
- hadoop (1)
- svn (1)
- 汉字 (1)
- windows (2)
- jsp (5)
- fiddler (1)
- ETL (1)
- teamviewer (1)
- maven (4)
- GIT (2)
- datagrip (1)
- ocr (1)
- redis (3)
- mysql (3)
- linux (1)
- 数据服务 (0)
最新评论
package com.teamdev.jxbrowser.chromium.demo_lingshui.baidunuomi.goods;
import java.awt.BorderLayout;
import java.sql.PreparedStatement;
import java.sql.SQLException;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;
import java.util.logging.Level;
import javax.swing.JFrame;
import javax.swing.WindowConstants;
import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
import org.jsoup.nodes.Element;
import org.jsoup.select.Elements;
import com.hyjx.common.CommonUtil;
import com.hyjx.orclJdbcUtil.JDBCUtils;
import com.teamdev.jxbrowser.chromium.Browser;
import com.teamdev.jxbrowser.chromium.BrowserPreferences;
import com.teamdev.jxbrowser.chromium.JSValue;
import com.teamdev.jxbrowser.chromium.LoggerProvider;
import com.teamdev.jxbrowser.chromium.events.FinishLoadingEvent;
import com.teamdev.jxbrowser.chromium.events.LoadAdapter;
import com.teamdev.jxbrowser.chromium.swing.BrowserView;
/**
* 百度糯米(陵水市) plat_code(010) 美食
* @author 1
*
*/
public class ls_baidunuomi_goods_meishi{
public static void main(String[] args) throws Exception {
java.sql.Connection conOrcale = null;
try {
conOrcale = JDBCUtils.getConnection();
} catch (SQLException e1) {
e1.printStackTrace();
}
String sql = null;
PreparedStatement ps = null;
//创建添加sql
try{
sql = "insert into ls_nm_shop_good "+
" (good_id, good_name, good_url) "+
" values " +
"( ? , ? , ? ) ";
ps = conOrcale.prepareStatement(sql);
}catch (Exception e) {
e.printStackTrace();
}
String good_name="";
String good_url="";
Document doc = null;
try{
doc = Jsoup.connect("https://lingshui.nuomi.com/326-page1?#j-sort-bar").userAgent("Mozilla")
.header("method", "GET")
.header("Accept","text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8")
.header("Accept-Encoding:","gzip, deflate, sdch")
.header("Accept-Language","zh-CN,zh;q=0.8")
.header("Cache-Control","max-age=0")
.header("Connection","keep-alive")
.header("Host","lingshui.nuomi.com")
.header("Upgrade-Insecure-Requests","1")
.header("User-Agent","Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/50.0.2661.102 Safari/537.36")
.ignoreContentType(true).timeout(200000).data()
.get();
} catch (Exception e2) {
e2.printStackTrace();
}
String text = doc.html();
Document document = Jsoup.parse(text);
String pag= document.getElementsByAttributeValue("class","page-number").text();
int page_totle =Integer.parseInt(pag.substring(pag.length()-1));
System.out.println(page_totle);
//循环翻页
for(int i=1;i<=page_totle;i++){
//睡眠2秒
try {
Thread.sleep(2000);
} catch (InterruptedException e1) {
e1.printStackTrace();
}
doc = null;
try{
doc = Jsoup.connect("https://lingshui.nuomi.com/326-page"+i+"?#j-sort-bar").userAgent("Mozilla")
.header("method", "GET")
.header("Accept","text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8")
.header("Accept-Encoding:","gzip, deflate, sdch")
.header("Accept-Language","zh-CN,zh;q=0.8")
.header("Cache-Control","max-age=0")
.header("Connection","keep-alive")
.header("Host","lingshui.nuomi.com")
.header("Upgrade-Insecure-Requests","1")
.header("User-Agent","Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/50.0.2661.102 Safari/537.36")
.ignoreContentType(true).timeout(200000).data()
.get();
} catch (Exception e2) {
e2.printStackTrace();
}
text = doc.html();
document = Jsoup.parse(text);
Elements elements= document.getElementsByAttributeValue("class","itemlist clearfix").select("li");
System.out.println("elements.size()"+elements.size());
for(Element e : elements){
Document parse = Jsoup.parse(e.html());
good_name = parse.getElementsByAttributeValue("class","title").select("h4").text();
good_url ="https:"+parse.getElementsByAttributeValue("class","contentbox").select("a").attr("href");
System.out.println("good_name:"+good_name);
System.out.println("good_url:"+good_url);
try {
// (good_id, good_name, good_url)
ps.setString(1,CommonUtil.getUUID32());
ps.setString(2,good_name);
ps.setString(3,good_url);
ps.executeUpdate();
} catch (Exception e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
}
/**
* 第一次加载
* */
if(i==1){
doc = null;
try{
doc = Jsoup.connect("https://lingshui.nuomi.com/326?async_load_page=2&_=1477897343482").userAgent("Mozilla")
.header("method", "GET")
.header("Accept","text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8")
.header("Accept-Encoding:","gzip, deflate, sdch")
.header("Accept-Language","zh-CN,zh;q=0.8")
.header("Cache-Control","max-age=0")
.header("Connection","keep-alive")
.header("Host","lingshui.nuomi.com")
.header("Upgrade-Insecure-Requests","1")
.header("User-Agent","Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/50.0.2661.102 Safari/537.36")
.ignoreContentType(true).timeout(200000).data()
.get();
} catch (Exception e2) {
e2.printStackTrace();
}
text = doc.html();
document = Jsoup.parse(text);
elements= document.select("li");
System.out.println("elements.size()"+elements.size());
for(Element e : elements){
Document parse = Jsoup.parse(e.html());
good_name = parse.getElementsByAttributeValue("class","title").select("h4").text();
good_url ="https:"+parse.getElementsByAttributeValue("class","contentbox").select("a").attr("href");
System.out.println("good_name:"+good_name);
System.out.println("good_url:"+good_url);
try {
// (good_id, good_name, good_url)
ps.setString(1,CommonUtil.getUUID32());
ps.setString(2,good_name);
ps.setString(3,good_url);
ps.executeUpdate();
} catch (Exception e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
}
doc = null;
try{
doc = Jsoup.connect("https://lingshui.nuomi.com/326?async_load_page=3&_=1477897343484").userAgent("Mozilla")
.header("method", "GET")
.header("Accept","text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8")
.header("Accept-Encoding:","gzip, deflate, sdch")
.header("Accept-Language","zh-CN,zh;q=0.8")
.header("Cache-Control","max-age=0")
.header("Connection","keep-alive")
.header("Host","lingshui.nuomi.com")
.header("Upgrade-Insecure-Requests","1")
.header("User-Agent","Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/50.0.2661.102 Safari/537.36")
.ignoreContentType(true).timeout(200000).data()
.get();
} catch (Exception e2) {
e2.printStackTrace();
}
text = doc.html();
document = Jsoup.parse(text);
elements= document.select("li");
System.out.println("elements.size()"+elements.size());
for(Element e : elements){
Document parse = Jsoup.parse(e.html());
good_name = parse.getElementsByAttributeValue("class","title").select("h4").text();
good_url ="https:"+parse.getElementsByAttributeValue("class","contentbox").select("a").attr("href");
System.out.println("good_name:"+good_name);
System.out.println("good_url:"+good_url);
try {
// (good_id, good_name, good_url)
ps.setString(1,CommonUtil.getUUID32());
ps.setString(2,good_name);
ps.setString(3,good_url);
ps.executeUpdate();
} catch (Exception e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
}
}
System.out.println("第"+i+"页");
}
}
}
import java.awt.BorderLayout;
import java.sql.PreparedStatement;
import java.sql.SQLException;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;
import java.util.logging.Level;
import javax.swing.JFrame;
import javax.swing.WindowConstants;
import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
import org.jsoup.nodes.Element;
import org.jsoup.select.Elements;
import com.hyjx.common.CommonUtil;
import com.hyjx.orclJdbcUtil.JDBCUtils;
import com.teamdev.jxbrowser.chromium.Browser;
import com.teamdev.jxbrowser.chromium.BrowserPreferences;
import com.teamdev.jxbrowser.chromium.JSValue;
import com.teamdev.jxbrowser.chromium.LoggerProvider;
import com.teamdev.jxbrowser.chromium.events.FinishLoadingEvent;
import com.teamdev.jxbrowser.chromium.events.LoadAdapter;
import com.teamdev.jxbrowser.chromium.swing.BrowserView;
/**
* 百度糯米(陵水市) plat_code(010) 美食
* @author 1
*
*/
public class ls_baidunuomi_goods_meishi{
public static void main(String[] args) throws Exception {
java.sql.Connection conOrcale = null;
try {
conOrcale = JDBCUtils.getConnection();
} catch (SQLException e1) {
e1.printStackTrace();
}
String sql = null;
PreparedStatement ps = null;
//创建添加sql
try{
sql = "insert into ls_nm_shop_good "+
" (good_id, good_name, good_url) "+
" values " +
"( ? , ? , ? ) ";
ps = conOrcale.prepareStatement(sql);
}catch (Exception e) {
e.printStackTrace();
}
String good_name="";
String good_url="";
Document doc = null;
try{
doc = Jsoup.connect("https://lingshui.nuomi.com/326-page1?#j-sort-bar").userAgent("Mozilla")
.header("method", "GET")
.header("Accept","text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8")
.header("Accept-Encoding:","gzip, deflate, sdch")
.header("Accept-Language","zh-CN,zh;q=0.8")
.header("Cache-Control","max-age=0")
.header("Connection","keep-alive")
.header("Host","lingshui.nuomi.com")
.header("Upgrade-Insecure-Requests","1")
.header("User-Agent","Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/50.0.2661.102 Safari/537.36")
.ignoreContentType(true).timeout(200000).data()
.get();
} catch (Exception e2) {
e2.printStackTrace();
}
String text = doc.html();
Document document = Jsoup.parse(text);
String pag= document.getElementsByAttributeValue("class","page-number").text();
int page_totle =Integer.parseInt(pag.substring(pag.length()-1));
System.out.println(page_totle);
//循环翻页
for(int i=1;i<=page_totle;i++){
//睡眠2秒
try {
Thread.sleep(2000);
} catch (InterruptedException e1) {
e1.printStackTrace();
}
doc = null;
try{
doc = Jsoup.connect("https://lingshui.nuomi.com/326-page"+i+"?#j-sort-bar").userAgent("Mozilla")
.header("method", "GET")
.header("Accept","text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8")
.header("Accept-Encoding:","gzip, deflate, sdch")
.header("Accept-Language","zh-CN,zh;q=0.8")
.header("Cache-Control","max-age=0")
.header("Connection","keep-alive")
.header("Host","lingshui.nuomi.com")
.header("Upgrade-Insecure-Requests","1")
.header("User-Agent","Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/50.0.2661.102 Safari/537.36")
.ignoreContentType(true).timeout(200000).data()
.get();
} catch (Exception e2) {
e2.printStackTrace();
}
text = doc.html();
document = Jsoup.parse(text);
Elements elements= document.getElementsByAttributeValue("class","itemlist clearfix").select("li");
System.out.println("elements.size()"+elements.size());
for(Element e : elements){
Document parse = Jsoup.parse(e.html());
good_name = parse.getElementsByAttributeValue("class","title").select("h4").text();
good_url ="https:"+parse.getElementsByAttributeValue("class","contentbox").select("a").attr("href");
System.out.println("good_name:"+good_name);
System.out.println("good_url:"+good_url);
try {
// (good_id, good_name, good_url)
ps.setString(1,CommonUtil.getUUID32());
ps.setString(2,good_name);
ps.setString(3,good_url);
ps.executeUpdate();
} catch (Exception e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
}
/**
* 第一次加载
* */
if(i==1){
doc = null;
try{
doc = Jsoup.connect("https://lingshui.nuomi.com/326?async_load_page=2&_=1477897343482").userAgent("Mozilla")
.header("method", "GET")
.header("Accept","text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8")
.header("Accept-Encoding:","gzip, deflate, sdch")
.header("Accept-Language","zh-CN,zh;q=0.8")
.header("Cache-Control","max-age=0")
.header("Connection","keep-alive")
.header("Host","lingshui.nuomi.com")
.header("Upgrade-Insecure-Requests","1")
.header("User-Agent","Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/50.0.2661.102 Safari/537.36")
.ignoreContentType(true).timeout(200000).data()
.get();
} catch (Exception e2) {
e2.printStackTrace();
}
text = doc.html();
document = Jsoup.parse(text);
elements= document.select("li");
System.out.println("elements.size()"+elements.size());
for(Element e : elements){
Document parse = Jsoup.parse(e.html());
good_name = parse.getElementsByAttributeValue("class","title").select("h4").text();
good_url ="https:"+parse.getElementsByAttributeValue("class","contentbox").select("a").attr("href");
System.out.println("good_name:"+good_name);
System.out.println("good_url:"+good_url);
try {
// (good_id, good_name, good_url)
ps.setString(1,CommonUtil.getUUID32());
ps.setString(2,good_name);
ps.setString(3,good_url);
ps.executeUpdate();
} catch (Exception e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
}
doc = null;
try{
doc = Jsoup.connect("https://lingshui.nuomi.com/326?async_load_page=3&_=1477897343484").userAgent("Mozilla")
.header("method", "GET")
.header("Accept","text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8")
.header("Accept-Encoding:","gzip, deflate, sdch")
.header("Accept-Language","zh-CN,zh;q=0.8")
.header("Cache-Control","max-age=0")
.header("Connection","keep-alive")
.header("Host","lingshui.nuomi.com")
.header("Upgrade-Insecure-Requests","1")
.header("User-Agent","Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/50.0.2661.102 Safari/537.36")
.ignoreContentType(true).timeout(200000).data()
.get();
} catch (Exception e2) {
e2.printStackTrace();
}
text = doc.html();
document = Jsoup.parse(text);
elements= document.select("li");
System.out.println("elements.size()"+elements.size());
for(Element e : elements){
Document parse = Jsoup.parse(e.html());
good_name = parse.getElementsByAttributeValue("class","title").select("h4").text();
good_url ="https:"+parse.getElementsByAttributeValue("class","contentbox").select("a").attr("href");
System.out.println("good_name:"+good_name);
System.out.println("good_url:"+good_url);
try {
// (good_id, good_name, good_url)
ps.setString(1,CommonUtil.getUUID32());
ps.setString(2,good_name);
ps.setString(3,good_url);
ps.executeUpdate();
} catch (Exception e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
}
}
System.out.println("第"+i+"页");
}
}
}
发表评论
-
采集ymx商品信息
2018-08-29 15:28 524public static void main(String[ ... -
根据百度加密url, 获取真实url
2018-08-06 10:46 0public static void main(String[ ... -
fiddler 抓取 手机https 数据包 完美解决
2018-08-03 12:43 3048转:https://jingyan.baidu.com ... -
无忧代理IP
2018-07-30 16:19 0http://api.ip.data5u.com/dynami ... -
无所不能的四种请求方式(天下武功为怪不破)
2018-07-26 11:50 859package com.teamdev.jxbrowser.c ... -
post请求加json参数方式二
2018-07-24 14:02 2098package com.teamdev.jxbrowser.c ... -
post请求加json参数或xml参数
2018-07-20 18:21 1266import java.io.BufferedReader; ... -
jd编号
2017-11-02 17:59 541京东店铺:https://mall.jd.com/index- ... -
清除google缓存
2017-10-26 11:20 6881.进入 chrome://net-internals/#dn ... -
adb server is out of date. killing... 本地连接夜神模拟器失败、超时
2017-06-19 10:43 1516原因:1.模拟器器设置了代理;2.主要是模拟器和sdk 的ad ... -
fiddler抓取的https请求 数据乱码问题解决方案
2017-06-09 09:44 7287参考地址:http://blog.csdn.net/SomeO ... -
chromium.Browser 禁止加载图片,提升加载速度
2017-05-25 11:29 1205package com.teamdev.jxbrowser.c ... -
chrome 禁止加载网页图片 解决办法
2017-05-25 11:18 23531.在谷歌浏览器中输入:chrome://settings/c ... -
开源爬虫框架的优缺点?
2017-03-22 14:46 823开源爬虫框架各有什么优缺点? 作者:老夏 开发网络爬 ... -
反爬虫
2017-03-17 10:34 6941. 伪装user agent User agen ... -
爬虫被封禁原因
2017-03-17 09:37 1551爬虫被封禁常见原因 1. ... -
App数据抓取
2017-03-17 09:32 1106思路: 通过fiddler抓包 ... -
八爪鱼规则学习
2017-03-08 13:44 8551.八爪鱼采集器是任何一个需要从网页获取信息的人都必备的采集工 ... -
java模拟jquery请求动作(模拟点击、选择下拉)
2016-12-29 14:40 4082package com.teamdev.jxbrowser.c ... -
httpclient
2016-11-01 16:37 773package com.teamdev.jxbrowser.c ...
相关推荐
JSoup 将网页内容解析为一个复杂的 DOM 树结构,使得开发者可以通过 CSS 选择器或者直接的节点遍历来查找、提取和修改数据。 例如,要从一个网页中抓取所有的段落(`<p>` 标签),你可以使用以下 JSoup 代码: ```...
本文主要讲述如何利用Java编程语言中的Jsoup库和HttpClient工具包来获取和解析动态生成的数据,特别是那些通过JavaScript动态加载的数据。 ### Java爬虫基础 Java爬虫是指使用Java语言编写的一类程序,这些程序...
在爬虫项目中,MongoDB可以作为存储爬取数据的理想选择,因为它的JSON格式数据模型非常适合存储非结构化的网页内容。 接下来,我们将一步步构建这个简单的爬虫程序: 1. **环境准备**:确保已安装Java开发环境...
**Jsoup:网页数据抓取与JSON转换** Jsoup是一个非常强大的Java库,它使得解析HTML和抓取网页数据变得简单易行。本教程将深入探讨如何使用Jsoup有效地从网页中提取信息,并最终将其转化为JSON格式,为数据分析或...
以下是关于如何使用Java+Jsoup抓取网页数据的详细讲解。 首先,你需要了解HTML的基础结构,因为Jsoup的工作原理是解析HTML文档并提供类似于DOM的API来操作这些文档。HTML是由标签组成的树形结构,每个标签都有属性...
总结来说,"JsoupDemo"和"sinaweather"这两个例子展示了如何使用Jsoup进行HTML解析以及如何处理JSON数据。Jsoup帮助开发者高效地从HTML文档中提取所需信息,而JSON则是数据交换的通用格式,尤其在Web服务中扮演着...
【BigData】Jsoup+FusionCharts实现根据网页url解析网页数据,并用图表显示 jsoup-1.10.3.jar log4j-1.2.17.jar struts2-json-plugin-2.3.15.3.jar xwork-core-2.2.3.jar
在jsoup示例中,`myspider`可能将数据保存为CSV、JSON或其他结构化的文件格式。 8. **法律法规与道德规范** 在进行网页抓取时,务必遵守网站的robots.txt协议,尊重版权,不滥用服务,避免对目标网站造成过大压力...
5. **结构化输出**:Jsoup允许将提取的数据转化为结构化的数据格式,如JSON或XML。 **结合使用htmlunit2.8与jsoup1.7** 将这两个库结合起来,可以实现更强大的数据抓取能力。首先,HtmlUnit加载整个网页,执行...
1. **网络爬虫基础**:网络爬虫是一种自动遍历网页并抓取信息的程序,通常由URL管理器、下载器、解析器和存储器四个主要部分组成。在这个demo中,JSUOP可能被用来实现这些功能,例如,管理已访问和待访问的URL队列,...
接下来,我们需要创建一个JSON解析器,它能理解用户定义的JSON规则,并使用Jsoup的API来选取相应的HTML元素。例如,如果你有一个JSON规则`{"selector": "h1"}`,解析器会找到所有的`<h1>`标签: ```java String ...
本项目涵盖了Java解析XML的两种主要方法:DOM(Document Object Model)解析和Jsoup库的解析。这两种方法各有优缺点,适用于不同的场景。 DOM解析是将整个XML文档加载到内存中,形成一个树形结构,然后通过这个结构...
**vParser+jsoup**是一种组合使用vParser和jsoup库来解析静态网页并提取其中数据的方法。在IT行业中,这种技术广泛应用于Web抓取、数据挖掘和自动化测试等领域。以下将详细介绍这两个库以及如何结合它们来实现所需...
jsoup爬虫用于从网页中提取结构化数据,而这里特别提到是获取淘宝购物车的数据,这意味着项目可能涉及了模拟登录、网页解析、数据抓取和JSON序列化等多个步骤。 【标签解析】 "爬虫/jsoup" 这个标签进一步确认了...
jsoup能够解析HTML,执行DOM操作,并且支持CSS选择器,这些功能使得它在网页抓取和数据挖掘领域具有很高的实用性。 **网页抓取** 网页抓取,也称为网络爬虫或网页抓取,是一种技术,用于自动化地从互联网上获取...
总结来说,这个项目或教程涉及使用Jsoup解析和抓取网页,用HttpClient下载资源,同时利用Apache Commons库增强功能,提供了一种综合运用Java网络编程技术的实例。在实际开发中,这样的技术可以广泛应用于数据抓取、...
在网页解析后,数据通常会以原始的Java对象形式存在,而Dozer可以帮助我们将这些对象转换成业务逻辑所需的格式,或者与数据库、JSON或其他数据格式进行交互。这在数据处理和集成过程中非常实用,可以减少手动编码的...
JSON(JavaScript Object Notation)是一种轻量级的数据交换格式,易于人阅读和编写,同时也易于机器解析和生成。它基于JavaScript的一个子集,但不是JavaScript的语法,而是独立的。在Java中,处理JSON数据通常需要...
在教务系统中,课表和成绩通常是以网页的形式展示的,Jsoup可以解析这些HTML页面,找到课表和成绩的数据元素,如表格或特定的div标签,然后提取出所需信息。这通常涉及到CSS选择器和DOM树的操作。 关于JSON和XML,...
这个过程可能涉及API调用、JSON解析等步骤。 最后,项目实现了邮件发送功能。JavaMail API是Java中发送邮件的标准库。要发送带有天气信息的邮件,需要设置SMTP服务器,创建Session,然后构建Message对象。以下是一...