use of org.apache.http.client.utils.URIBuilder in project jabref by JabRef.
the class GoogleScholar method performSearch.
@Override
public List<BibEntry> performSearch(String query) throws FetcherException {
try {
obtainAndModifyCookie();
List<BibEntry> foundEntries = new ArrayList<>(10);
URIBuilder uriBuilder = new URIBuilder(BASIC_SEARCH_URL);
uriBuilder.addParameter("hl", "en");
uriBuilder.addParameter("btnG", "Search");
uriBuilder.addParameter("q", query);
addHitsFromQuery(foundEntries, uriBuilder.toString());
if (foundEntries.size() == 10) {
uriBuilder.addParameter("start", "10");
addHitsFromQuery(foundEntries, uriBuilder.toString());
}
return foundEntries;
} catch (URISyntaxException e) {
throw new FetcherException("Error while fetching from " + getName(), e);
} catch (IOException e) {
// java.io.IOException: Server returned HTTP response code: 503 for URL: https://ipv4.google.com/sorry/index?continue=https://scholar.google.com/scholar%3Fhl%3Den%26btnG%3DSearch%26q%3Dbpmn&hl=en&q=CGMSBI0NBDkYuqy9wAUiGQDxp4NLQCWbIEY1HjpH5zFJhv4ANPGdWj0
if (e.getMessage().contains("Server returned HTTP response code: 503 for URL")) {
throw new FetcherException("Fetching from Google Scholar failed.", Localization.lang("This might be caused by reaching the traffic limitation of Google Scholar (see 'Help' for details)."), e);
} else {
throw new FetcherException("Error while fetching from " + getName(), e);
}
}
}
use of org.apache.http.client.utils.URIBuilder in project jabref by JabRef.
the class GvkFetcher method getURLForQuery.
@Override
public URL getURLForQuery(String query) throws URISyntaxException, MalformedURLException, FetcherException {
String gvkQuery = getSearchQueryString(query);
URIBuilder uriBuilder = new URIBuilder(URL_PATTERN);
uriBuilder.addParameter("version", "1.1");
uriBuilder.addParameter("operation", "searchRetrieve");
uriBuilder.addParameter("query", gvkQuery);
uriBuilder.addParameter("maximumRecords", "50");
uriBuilder.addParameter("recordSchema", "picaxml");
uriBuilder.addParameter("sortKeys", "Year,,1");
return uriBuilder.build().toURL();
}
use of org.apache.http.client.utils.URIBuilder in project jabref by JabRef.
the class MedlineFetcher method createSearchUrl.
private URL createSearchUrl(String term) throws URISyntaxException, MalformedURLException {
term = replaceCommaWithAND(term);
URIBuilder uriBuilder = new URIBuilder(SEARCH_URL);
uriBuilder.addParameter("db", "pubmed");
uriBuilder.addParameter("sort", "relevance");
uriBuilder.addParameter("retmax", String.valueOf(NUMBER_TO_FETCH));
uriBuilder.addParameter("term", term);
return uriBuilder.build().toURL();
}
use of org.apache.http.client.utils.URIBuilder in project jabref by JabRef.
the class IsbnViaEbookDeFetcher method getURLForID.
@Override
public URL getURLForID(String identifier) throws URISyntaxException, MalformedURLException, FetcherException {
this.ensureThatIsbnIsValid(identifier);
URIBuilder uriBuilder = new URIBuilder("http://www.ebook.de/de/tools/isbn2bibtex");
uriBuilder.addParameter("isbn", identifier);
return uriBuilder.build().toURL();
}
use of org.apache.http.client.utils.URIBuilder in project jabref by JabRef.
the class MathSciNet method getURLForID.
@Override
public URL getURLForID(String identifier) throws URISyntaxException, MalformedURLException, FetcherException {
URIBuilder uriBuilder = new URIBuilder("http://www.ams.org/mathscinet/search/publications.html");
// search MR number
uriBuilder.addParameter("pg1", "MR");
// identifier
uriBuilder.addParameter("s1", identifier);
// BibTeX format
uriBuilder.addParameter("fmt", "bibtex");
return uriBuilder.build().toURL();
}
Aggregations