NewPipeExtractor/extractor/src/main/java/org/schabi/newpipe/extractor/services/xh/linkHandler/XhSearchQueryHandlerFactory...

42 lines
1.4 KiB
Java
Raw Normal View History

2023-02-16 07:55:03 +00:00
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package org.schabi.newpipe.extractor.services.xh.linkHandler;
import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;
import java.util.List;
2023-03-10 09:21:13 +00:00
import java.util.logging.Logger;
2023-02-16 07:55:03 +00:00
import org.schabi.newpipe.extractor.exceptions.ParsingException;
import org.schabi.newpipe.extractor.linkhandler.SearchQueryHandlerFactory;
import static org.schabi.newpipe.extractor.services.xh.XhService.BASE_URL;
/**
*
* @author Rakesh
*/
public class XhSearchQueryHandlerFactory extends SearchQueryHandlerFactory {
2023-03-10 09:21:13 +00:00
public static XhSearchQueryHandlerFactory getInstance() {
return new XhSearchQueryHandlerFactory();
}
2023-02-16 07:55:03 +00:00
@Override
public String getUrl(final String query,
final List<String> contentFilter,
final String sortFilter) throws ParsingException {
try {
2023-03-10 09:21:13 +00:00
// log
System.out.println(BASE_URL + "/search/" + URLEncoder.encode(query, "UTF-8") + "/1");
2023-02-16 07:55:03 +00:00
return BASE_URL + "/search/" + URLEncoder.encode(query, "UTF-8") + "/1";
} catch (final UnsupportedEncodingException e) {
throw new ParsingException("query \"" + query + "\" could not be encoded", e);
}
}
}