Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
//License from project: Apache License 

import java.io.UnsupportedEncodingException;

import java.net.URLEncoder;

public class Main {
    private static final String URL_HOST = "http://www.nicovideo.jp";

    public static String getQueryUrl(String word, Integer page) throws UnsupportedEncodingException {
        if (word == null) {
            return null;
        }
        String qp = (page == null) ? "" : ("&page=" + page);
        return URL_HOST + "/search/" + URLEncoder.encode(word, "UTF-8") + "?sort=v&order=d" + qp;
    }
}