Httpclient爬取优酷网

Posted Michael2397

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Httpclient爬取优酷网相关的知识,希望对你有一定的参考价值。

 参考:http://www.cnblogs.com/lchzls/p/6277210.html

/httpClient/src/main/java/com/louis/youku/Page.java

/**
 * Project Name:httpClient
 * File Name:Page.java
 * Package Name:com.louis.youku
 * Date:2017年11月9日上午9:11:28
 * Copyright (c) 2017, 2692613726@qq.com All Rights Reserved.
 *
*/

package com.louis.youku;
/**
 * ClassName:Page 
 * Function: TODO ADD FUNCTION. 
 * Reason:     TODO ADD REASON. 
 * Date:     2017年11月9日 上午9:11:28 
 * @author   michael
 * @version  
 * @since    JDK 1.7
 * @see      
 */
public class Page {
    //页面内容
    private String content;
    
    //总播放量
    private String allnumber;
    
    //每日播放增量
    private String daynumber;
    
    //评论数
    private String commentnumber;

    //收藏数
    private String collectnumber;

    //
    private String supportnumber;

    //
    private String againstnumber;

    //电视剧名称
    private String tvname;

    //页面url
    private String url;

    //子集数据
    private String episodenumber;

    public String getContent() {
        return content;
    }

    public void setContent(String content) {
        this.content = content;
    }

    public String getAllnumber() {
        return allnumber;
    }

    public void setAllnumber(String allnumber) {
        this.allnumber = allnumber;
    }

    public String getDaynumber() {
        return daynumber;
    }

    public void setDaynumber(String daynumber) {
        this.daynumber = daynumber;
    }

    public String getCommentnumber() {
        return commentnumber;
    }

    public void setCommentnumber(String commentnumber) {
        this.commentnumber = commentnumber;
    }

    public String getCollectnumber() {
        return collectnumber;
    }

    public void setCollectnumber(String collectnumber) {
        this.collectnumber = collectnumber;
    }

    public String getSupportnumber() {
        return supportnumber;
    }

    public void setSupportnumber(String supportnumber) {
        this.supportnumber = supportnumber;
    }

    public String getAgainstnumber() {
        return againstnumber;
    }

    public void setAgainstnumber(String againstnumber) {
        this.againstnumber = againstnumber;
    }

    public String getTvname() {
        return tvname;
    }

    public void setTvname(String tvname) {
        this.tvname = tvname;
    }

    public String getUrl() {
        return url;
    }

    public void setUrl(String url) {
        this.url = url;
    }

    public String getEpisodenumber() {
        return episodenumber;
    }

    public void setEpisodenumber(String episodenumber) {
        this.episodenumber = episodenumber;
    }
    
}

/httpClient/src/main/java/com/louis/youku/DownLoadService.java

/**
 * Project Name:httpClient
 * File Name:DownLoadService.java
 * Package Name:com.louis.youku
 * Date:2017年11月9日上午9:14:16
 * Copyright (c) 2017, 2692613726@qq.com All Rights Reserved.
 *
*/

package com.louis.youku;
/**
 * ClassName:DownLoadService 
 * Function: TODO ADD FUNCTION. 
 * Reason:     TODO ADD REASON. 
 * Date:     2017年11月9日 上午9:14:16 
 * @author   michael
 * @version  
 * @since    JDK 1.7
 * @see      
 */
public interface DownLoadService {
    public Page downLoad(String url);
}

/httpClient/src/main/java/com/louis/youku/DownLoadServiceImpl.java

/**
 * Project Name:httpClient
 * File Name:DownLoadService.java
 * Package Name:com.louis.youku
 * Date:2017年11月9日上午9:14:16
 * Copyright (c) 2017, 2692613726@qq.com All Rights Reserved.
 *
*/

package com.louis.youku;
/**
 * ClassName:DownLoadService 
 * Function: TODO ADD FUNCTION. 
 * Reason:     TODO ADD REASON. 
 * Date:     2017年11月9日 上午9:14:16 
 * @author   michael
 * @version  
 * @since    JDK 1.7
 * @see      
 */
public interface DownLoadService {
    public Page downLoad(String url);
}

/httpClient/src/main/java/com/louis/youku/PageDownLoadUtil.java

/**
 * Project Name:httpClient
 * File Name:Page.java
 * Package Name:com.louis.youku
 * Date:2017年11月9日上午9:11:28
 * Copyright (c) 2017, 2692613726@qq.com All Rights Reserved.
 *
*/

package com.louis.youku;
/**
 * ClassName:Page 
 * Function: TODO ADD FUNCTION. 
 * Reason:     TODO ADD REASON. 
 * Date:     2017年11月9日 上午9:11:28 
 * @author   michael
 * @version  
 * @since    JDK 1.7
 * @see      
 */
public class Page {
    //页面内容
    private String content;
    
    //总播放量
    private String allnumber;
    
    //每日播放增量
    private String daynumber;
    
    //评论数
    private String commentnumber;

    //收藏数
    private String collectnumber;

    //
    private String supportnumber;

    //
    private String againstnumber;

    //电视剧名称
    private String tvname;

    //页面url
    private String url;

    //子集数据
    private String episodenumber;

    public String getContent() {
        return content;
    }

    public void setContent(String content) {
        this.content = content;
    }

    public String getAllnumber() {
        return allnumber;
    }

    public void setAllnumber(String allnumber) {
        this.allnumber = allnumber;
    }

    public String getDaynumber() {
        return daynumber;
    }

    public void setDaynumber(String daynumber) {
        this.daynumber = daynumber;
    }

    public String getCommentnumber() {
        return commentnumber;
    }

    public void setCommentnumber(String commentnumber) {
        this.commentnumber = commentnumber;
    }

    public String getCollectnumber() {
        return collectnumber;
    }

    public void setCollectnumber(String collectnumber) {
        this.collectnumber = collectnumber;
    }

    public String getSupportnumber() {
        return supportnumber;
    }

    public void setSupportnumber(String supportnumber) {
        this.supportnumber = supportnumber;
    }

    public String getAgainstnumber() {
        return againstnumber;
    }

    public void setAgainstnumber(String againstnumber) {
        this.againstnumber = againstnumber;
    }

    public String getTvname() {
        return tvname;
    }

    public void setTvname(String tvname) {
        this.tvname = tvname;
    }

    public String getUrl() {
        return url;
    }

    public void setUrl(String url) {
        this.url = url;
    }

    public String getEpisodenumber() {
        return episodenumber;
    }

    public void setEpisodenumber(String episodenumber) {
        this.episodenumber = episodenumber;
    }
    
}

 

以上是关于Httpclient爬取优酷网的主要内容,如果未能解决你的问题,请参考以下文章

C# 手把手教你爬取优酷电影信息-进阶

手把手教你爬取优酷电影信息 -1

爬虫概念与编程学习之如何爬取视频网站页面(用HttpClient)

使用HttpClient+Json解析器爬取数据并存入数据库

HttpClient爬取导致内存泄漏

Java爬虫系列之实战:爬取酷狗音乐网 TOP500 的歌曲