1.<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">

  <modelVersion>4.0.0</modelVersion>

 

  <groupId>com.yeetrack</groupId>

  <artifactId>yinyueyun-download</artifactId>

  <version>0.0.1-SNAPSHOT</version>

  <packaging>jar</packaging>

 

  <name>yinyueyun-download</name>

  <url>http://maven.apache.org</url>

 

  <properties>

    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>

  </properties>

 

  <dependencies>

    <dependency>

        <groupId>org.apache.httpcomponents</groupId>

        <artifactId>httpclient</artifactId>

        <version>4.3.1</version>

    </dependency>

    <dependency>

        <groupId>com.alibaba</groupId>

        <artifactId>fastjson</artifactId>

        <version>1.1.37</version>

    </dependency>

  </dependencies>

</project>

2.package com.yeetrack.yinyueyun;

import java.util.List;

 * Created with IntelliJ IDEA.

 * User: victor

 * Date: 13-10-23

 * Time: 下午7:30

 * To change this template use File | Settings | File Templates.

public class DataEntity

    private List<SongEntity> songList;

    public List<SongEntity> getSongList()

        return songList;

    public void setSongList(List<SongEntity> songList)

        this.songList = songList;

3.package com.yeetrack.yinyueyun;

import org.apache.http.HttpRequest;

import org.apache.http.HttpResponse;

import org.apache.http.ProtocolException;

import org.apache.http.client.CookieStore;

import org.apache.http.client.RedirectStrategy;

import org.apache.http.client.methods.HttpUriRequest;

import org.apache.http.impl.client.BasicCookieStore;

import org.apache.http.impl.client.CloseableHttpClient;

import org.apache.http.impl.client.HttpClients;

import org.apache.http.impl.cookie.BasicClientCookie;

import org.apache.http.protocol.HttpContext;

 * @author victor

public class HttpTool

    private static CloseableHttpClient httpClient;

    private static String cookieName = "BDUSS";

    private static String cookieValue = "

    public static CloseableHttpClient getHttpClient()

            CookieStore cookieStore = new BasicCookieStore();

            BasicClientCookie baiduCookie = new BasicClientCookie(cookieName, cookieValue);http://www.huiyi8.com/yinxiao/音效网

            baiduCookie.setDomain(".baidu.com");

            baiduCookie.setPath("/");

            cookieStore.addCookie(baiduCookie);       

            httpClient = HttpClients.custom()

                    .setDefaultCookieStore(cookieStore)

                    .setRedirectStrategy(new RedirectStrategy()

                        @Override

                        public boolean isRedirected(HttpRequest request, HttpResponse response, HttpContext context) throws ProtocolException

                            return false;  //To change body of implemented methods use File | Settings | File Templates.

                     @Override

                        public HttpUriRequest getRedirect(HttpRequest request, HttpResponse response, HttpContext context) throws ProtocolException

                        {                            return null;  //To change body of implemented methods use File | Settings | File Templates.

                    .build();

        return httpClient;