com.akdeniz.googleplaycrawler.GooglePlay.ResponseWrapper Java Examples

The following examples show how to use com.akdeniz.googleplaycrawler.GooglePlay.ResponseWrapper. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: GooglePlayAPI.java    From raccoon4 with Apache License 2.0 6 votes vote down vote up
/**
 * Fetches a search results for given query. Offset and numberOfResult
 * parameters are optional and <code>null</code> can be passed!
 */
public SearchResponse search(String query, Integer offset,
		Integer numberOfResult) throws IOException {

	ResponseWrapper responseWrapper = executeGETRequest(
			SEARCH_URL,
			new String[][] {
					{ "c", "3" },
					{ "q", query },
					{ "o", (offset == null) ? null : String.valueOf(offset) },
					{
							"n",
							(numberOfResult == null) ? null : String
									.valueOf(numberOfResult) }, });

	return responseWrapper.getPayload().getSearchResponse();
}
 
Example #2
Source File: GooglePlayAPI.java    From raccoon4 with Apache License 2.0 6 votes vote down vote up
/**
 * Fetches applications within supplied category and sub-category. If
 * <code>null</code> is given for sub-category, it fetches sub-categories of
 * passed category.
 * 
 * Default values for offset and numberOfResult are "0" and "20" respectively.
 * These values are determined by Google Play Store.
 */
public ListResponse list(String categoryId, String subCategoryId,
		Integer offset, Integer numberOfResult) throws IOException {
	ResponseWrapper responseWrapper = executeGETRequest(
			LIST_URL,
			new String[][] {
					{ "c", "3" },
					{ "cat", categoryId },
					{ "ctr", subCategoryId },
					{ "o", (offset == null) ? null : String.valueOf(offset) },
					{
							"n",
							(numberOfResult == null) ? null : String
									.valueOf(numberOfResult) }, });

	return responseWrapper.getPayload().getListResponse();
}
 
Example #3
Source File: GooglePlayAPI.java    From raccoon4 with Apache License 2.0 6 votes vote down vote up
/**
 * Fetches the reviews of given package name by sorting passed choice.
 * 
 * Default values for offset and numberOfResult are "0" and "20" respectively.
 * These values are determined by Google Play Store.
 */
public ReviewResponse reviews(String packageName, REVIEW_SORT sort,
		Integer offset, Integer numberOfResult) throws IOException {
	ResponseWrapper responseWrapper = executeGETRequest(
			REVIEWS_URL,
			new String[][] {
					{ "doc", packageName },
					{ "sort", (sort == null) ? null : String.valueOf(sort.value) },
					{ "o", (offset == null) ? null : String.valueOf(offset) },
					{
							"n",
							(numberOfResult == null) ? null : String
									.valueOf(numberOfResult) } });

	return responseWrapper.getPayload().getReviewResponse();
}
 
Example #4
Source File: GooglePlayAPI.java    From raccoon4 with Apache License 2.0 6 votes vote down vote up
/**
 * Fetches the recommendations of given package name.
 * 
 * Default values for offset and numberOfResult are "0" and "20" respectively.
 * These values are determined by Google Play Store.
 */
public ListResponse recommendations(String packageName,
		RECOMMENDATION_TYPE type, Integer offset, Integer numberOfResult)
		throws IOException {
	ResponseWrapper responseWrapper = executeGETRequest(
			RECOMMENDATIONS_URL,
			new String[][] {
					{ "c", "3" },
					{ "doc", packageName },
					{ "rt", (type == null) ? null : String.valueOf(type.value) },
					{ "o", (offset == null) ? null : String.valueOf(offset) },
					{
							"n",
							(numberOfResult == null) ? null : String
									.valueOf(numberOfResult) } });

	return responseWrapper.getPayload().getListResponse();
}
 
Example #5
Source File: SearchEngineResultPage.java    From raccoon4 with Apache License 2.0 6 votes vote down vote up
/**
 * Try to make sense of a {@link ResponseWrapper}, containing a search result.
 * 
 * @param rw
 *          a wrapper containing either a {@link SearchResponse},
 *          {@link ListResponse} or a {@link PreFetch}
 */
public void append(ResponseWrapper rw) {
	// The SearchResponse format changed considerably over time. The message
	// type seems to have gotten deprecated for Android 5 and later in favor of
	// ListResponse. Apparently, SearchResponse got too too unwieldy.
	append(Unwrap.searchResponse(rw).getDocList());
	append(Unwrap.listResponse(rw).getDocList());
	for (PreFetch pf : rw.getPreFetchList()) {
		try {
			append(ResponseWrapper.parseFrom(pf.getResponse()));
		}
		catch (InvalidProtocolBufferException e) {
			// We tried, we failed.
		}
	}
}
 
Example #6
Source File: GooglePlayAPI.java    From raccoon4 with Apache License 2.0 5 votes vote down vote up
/**
 * Executes POST request and returns result as {@link ResponseWrapper}.
 * Content type can be specified for given byte array.
 */
private ResponseWrapper executePOSTRequest(String url, byte[] datapost,
		String contentType) throws IOException {

	HttpEntity httpEntity = executePost(url, new ByteArrayEntity(datapost),
			getHeaderParameters(this.getToken(), contentType));
	return GooglePlay.ResponseWrapper.parseFrom(httpEntity.getContent());

}
 
Example #7
Source File: GooglePlayAPI.java    From dummydroid with Apache License 2.0 5 votes vote down vote up
/**
 * Fetches a search results for given query. Offset and numberOfResult
 * parameters are optional and <code>null</code> can be passed!
 */
public SearchResponse search(String query, Integer offset, Integer numberOfResult)
		throws IOException {

	ResponseWrapper responseWrapper = executeGETRequest(SEARCH_URL, new String[][] {
			{ "c", "3" },
			{ "q", query },
			{ "o", (offset == null) ? null : String.valueOf(offset) },
			{ "n", (numberOfResult == null) ? null : String.valueOf(numberOfResult) }, });

	return responseWrapper.getPayload().getSearchResponse();
}
 
Example #8
Source File: GooglePlayAPI.java    From raccoon4 with Apache License 2.0 5 votes vote down vote up
/** Equivalent of details but bulky one! */
public BulkDetailsResponse bulkDetails(List<String> packageNames)
		throws IOException {

	Builder bulkDetailsRequestBuilder = BulkDetailsRequest.newBuilder();
	bulkDetailsRequestBuilder.addAllDocid(packageNames).setIncludeDetails(true);

	ResponseWrapper responseWrapper = executePOSTRequest(BULKDETAILS_URL,
			bulkDetailsRequestBuilder.build().toByteArray(),
			"application/x-protobuf");

	return responseWrapper.getPayload().getBulkDetailsResponse();
}
 
Example #9
Source File: GooglePlayAPI.java    From raccoon4 with Apache License 2.0 5 votes vote down vote up
public DownloadData delivery(String packageName, int versionCode,
		int offerType) throws IOException {
	ResponseWrapper responseWrapper = executeGETRequest(DELIVERY_URL,
			new String[][] { { "ot", String.valueOf(offerType) },
					{ "doc", packageName }, { "vc", String.valueOf(versionCode) }, });

	AndroidAppDeliveryData appDeliveryData = responseWrapper.getPayload()
			.getDeliveryResponse().getAppDeliveryData();
	return new DownloadData(this, appDeliveryData);
}
 
Example #10
Source File: GooglePlayAPI.java    From raccoon4 with Apache License 2.0 5 votes vote down vote up
/**
 * This function is used for fetching download url and donwload cookie, rather
 * than actual purchasing.
 */
private BuyResponse purchase(String packageName, int versionCode,
		int offerType) throws IOException {

	ResponseWrapper responseWrapper = executePOSTRequest(PURCHASE_URL,
			new String[][] { { "ot", String.valueOf(offerType) },
					{ "doc", packageName }, { "vc", String.valueOf(versionCode) }, });

	return responseWrapper.getPayload().getBuyResponse();
}
 
Example #11
Source File: GooglePlayAPI.java    From raccoon4 with Apache License 2.0 5 votes vote down vote up
/**
 * Uploads device configuration to google server so that can be seen from web
 * as a registered device!!
 * 
 * @see https://play.google.com/store/account
 */
public UploadDeviceConfigResponse uploadDeviceConfig() throws Exception {

	UploadDeviceConfigRequest request = UploadDeviceConfigRequest.newBuilder()
			.setDeviceConfiguration(Utils.getDeviceConfigurationProto())
			.setManufacturer("Samsung").build();
	ResponseWrapper responseWrapper = executePOSTRequest(
			UPLOADDEVICECONFIG_URL, request.toByteArray(), "application/x-protobuf");
	return responseWrapper.getPayload().getUploadDeviceConfigResponse();
}
 
Example #12
Source File: GooglePlayAPI.java    From raccoon4 with Apache License 2.0 5 votes vote down vote up
/**
 * Executes GET request and returns result as {@link ResponseWrapper}.
 * Standard header parameters will be used for request.
 * 
 * @see getHeaderParameters
 * */
private ResponseWrapper executeGETRequest(String path, String[][] datapost)
		throws IOException {

	HttpEntity httpEntity = executeGet(path, datapost,
			getHeaderParameters(this.getToken(), null));
	return GooglePlay.ResponseWrapper.parseFrom(httpEntity.getContent());

}
 
Example #13
Source File: GooglePlayAPI.java    From raccoon4 with Apache License 2.0 5 votes vote down vote up
/**
 * Executes POST request and returns result as {@link ResponseWrapper}.
 * Standard header parameters will be used for request.
 * 
 * @see getHeaderParameters
 * */
private ResponseWrapper executePOSTRequest(String path, String[][] datapost)
		throws IOException {

	HttpEntity httpEntity = executePost(path, datapost,
			getHeaderParameters(this.getToken(), null));
	return GooglePlay.ResponseWrapper.parseFrom(httpEntity.getContent());

}
 
Example #14
Source File: GooglePlayAPI.java    From raccoon4 with Apache License 2.0 5 votes vote down vote up
/**
 * Fetches detailed information about passed package name. If it is needed to
 * fetch information about more than one application, consider to use
 * <code>bulkDetails</code>.
 */
public DetailsResponse details(String packageName) throws IOException {
	ResponseWrapper responseWrapper = executeGETRequest(DETAILS_URL,
			new String[][] { { "doc", packageName }, });

	return responseWrapper.getPayload().getDetailsResponse();
}
 
Example #15
Source File: GooglePlayAPI.java    From Raccoon with Apache License 2.0 5 votes vote down vote up
/**
 * Fetches a search results for given query. Offset and numberOfResult
 * parameters are optional and <code>null</code> can be passed!
 */
public SearchResponse search(String query, Integer offset, Integer numberOfResult)
		throws IOException {

	ResponseWrapper responseWrapper = executeGETRequest(SEARCH_URL, new String[][] {
			{ "c", "3" },
			{ "q", query },
			{ "o", (offset == null) ? null : String.valueOf(offset) },
			{ "n", (numberOfResult == null) ? null : String.valueOf(numberOfResult) }, });

	return responseWrapper.getPayload().getSearchResponse();
}
 
Example #16
Source File: GooglePlayAPI.java    From Raccoon with Apache License 2.0 5 votes vote down vote up
/**
 * Fetches detailed information about passed package name. If it is needed to
 * fetch information about more than one application, consider to use
 * <code>bulkDetails</code>.
 */
public DetailsResponse details(String packageName) throws IOException {
	ResponseWrapper responseWrapper = executeGETRequest(DETAILS_URL, new String[][] { {
			"doc",
			packageName }, });

	return responseWrapper.getPayload().getDetailsResponse();
}
 
Example #17
Source File: GooglePlayAPI.java    From Raccoon with Apache License 2.0 5 votes vote down vote up
/** Equivalent of details but bulky one! */
public BulkDetailsResponse bulkDetails(List<String> packageNames) throws IOException {

	Builder bulkDetailsRequestBuilder = BulkDetailsRequest.newBuilder();
	bulkDetailsRequestBuilder.addAllDocid(packageNames);

	ResponseWrapper responseWrapper = executePOSTRequest(BULKDETAILS_URL, bulkDetailsRequestBuilder
			.build().toByteArray(), "application/x-protobuf");

	return responseWrapper.getPayload().getBulkDetailsResponse();
}
 
Example #18
Source File: GooglePlayAPI.java    From Raccoon with Apache License 2.0 5 votes vote down vote up
public BrowseResponse browse(String categoryId, String subCategoryId) throws IOException {

		ResponseWrapper responseWrapper = executeGETRequest(BROWSE_URL, new String[][] {
				{ "c", "3" },
				{ "cat", categoryId },
				{ "ctr", subCategoryId } });

		return responseWrapper.getPayload().getBrowseResponse();
	}
 
Example #19
Source File: GooglePlayAPI.java    From Raccoon with Apache License 2.0 5 votes vote down vote up
/**
 * Fetches applications within supplied category and sub-category. If
 * <code>null</code> is given for sub-category, it fetches sub-categories of
 * passed category.
 * 
 * Default values for offset and numberOfResult are "0" and "20" respectively.
 * These values are determined by Google Play Store.
 */
public ListResponse list(String categoryId, String subCategoryId, Integer offset,
		Integer numberOfResult) throws IOException {
	ResponseWrapper responseWrapper = executeGETRequest(LIST_URL, new String[][] {
			{ "c", "3" },
			{ "cat", categoryId },
			{ "ctr", subCategoryId },
			{ "o", (offset == null) ? null : String.valueOf(offset) },
			{ "n", (numberOfResult == null) ? null : String.valueOf(numberOfResult) }, });

	return responseWrapper.getPayload().getListResponse();
}
 
Example #20
Source File: GooglePlayAPI.java    From Raccoon with Apache License 2.0 5 votes vote down vote up
public DownloadData delivery(String packageName, int versionCode, int offerType)
		throws IOException {
	ResponseWrapper responseWrapper = executeGETRequest(DELIVERY_URL, new String[][] {
			{ "ot", String.valueOf(offerType) },
			{ "doc", packageName },
			{ "vc", String.valueOf(versionCode) }, });

	AndroidAppDeliveryData appDeliveryData = responseWrapper.getPayload().getDeliveryResponse()
			.getAppDeliveryData();
	return new DownloadData(this, appDeliveryData);
}
 
Example #21
Source File: GooglePlayAPI.java    From Raccoon with Apache License 2.0 5 votes vote down vote up
/**
 * This function is used for fetching download url and donwload cookie, rather
 * than actual purchasing.
 */
private BuyResponse purchase(String packageName, int versionCode, int offerType)
		throws IOException {

	ResponseWrapper responseWrapper = executePOSTRequest(PURCHASE_URL, new String[][] {
			{ "ot", String.valueOf(offerType) },
			{ "doc", packageName },
			{ "vc", String.valueOf(versionCode) }, });

	return responseWrapper.getPayload().getBuyResponse();
}
 
Example #22
Source File: GooglePlayAPI.java    From Raccoon with Apache License 2.0 5 votes vote down vote up
/**
 * Fetches the reviews of given package name by sorting passed choice.
 * 
 * Default values for offset and numberOfResult are "0" and "20" respectively.
 * These values are determined by Google Play Store.
 */
public ReviewResponse reviews(String packageName, REVIEW_SORT sort, Integer offset,
		Integer numberOfResult) throws IOException {
	ResponseWrapper responseWrapper = executeGETRequest(REVIEWS_URL, new String[][] {
			{ "doc", packageName },
			{ "sort", (sort == null) ? null : String.valueOf(sort.value) },
			{ "o", (offset == null) ? null : String.valueOf(offset) },
			{ "n", (numberOfResult == null) ? null : String.valueOf(numberOfResult) } });

	return responseWrapper.getPayload().getReviewResponse();
}
 
Example #23
Source File: GooglePlayAPI.java    From Raccoon with Apache License 2.0 5 votes vote down vote up
/**
 * Uploads device configuration to google server so that can be seen from web
 * as a registered device!!
 * 
 * @see https://play.google.com/store/account
 */
public UploadDeviceConfigResponse uploadDeviceConfig() throws Exception {

	UploadDeviceConfigRequest request = UploadDeviceConfigRequest.newBuilder()
			.setDeviceConfiguration(Utils.getDeviceConfigurationProto()).build();
	ResponseWrapper responseWrapper = executePOSTRequest(UPLOADDEVICECONFIG_URL,
			request.toByteArray(), "application/x-protobuf");
	return responseWrapper.getPayload().getUploadDeviceConfigResponse();
}
 
Example #24
Source File: GooglePlayAPI.java    From Raccoon with Apache License 2.0 5 votes vote down vote up
/**
 * Fetches the recommendations of given package name.
 * 
 * Default values for offset and numberOfResult are "0" and "20" respectively.
 * These values are determined by Google Play Store.
 */
public ListResponse recommendations(String packageName, RECOMMENDATION_TYPE type, Integer offset,
		Integer numberOfResult) throws IOException {
	ResponseWrapper responseWrapper = executeGETRequest(RECOMMENDATIONS_URL, new String[][] {
			{ "c", "3" },
			{ "doc", packageName },
			{ "rt", (type == null) ? null : String.valueOf(type.value) },
			{ "o", (offset == null) ? null : String.valueOf(offset) },
			{ "n", (numberOfResult == null) ? null : String.valueOf(numberOfResult) } });

	return responseWrapper.getPayload().getListResponse();
}
 
Example #25
Source File: GooglePlayAPI.java    From Raccoon with Apache License 2.0 5 votes vote down vote up
/**
 * Executes POST request and returns result as {@link ResponseWrapper}.
 * Content type can be specified for given byte array.
 */
private ResponseWrapper executePOSTRequest(String url, byte[] datapost, String contentType)
		throws IOException {

	HttpEntity httpEntity = executePost(url, new ByteArrayEntity(datapost),
			getHeaderParameters(this.getToken(), contentType));
	return GooglePlay.ResponseWrapper.parseFrom(httpEntity.getContent());

}
 
Example #26
Source File: GooglePlayAPI.java    From raccoon4 with Apache License 2.0 5 votes vote down vote up
public ResponseWrapper searchApp(String query) throws IOException {
	ResponseWrapper responseWrapper = executeGETRequest(SEARCH_URL,
			new String[][] { { "c", "3" }, { "q", query },

			});

	return responseWrapper;
}
 
Example #27
Source File: GooglePlayAPI.java    From dummydroid with Apache License 2.0 5 votes vote down vote up
/**
 * Fetches detailed information about passed package name. If it is needed to
 * fetch information about more than one application, consider to use
 * <code>bulkDetails</code>.
 */
public DetailsResponse details(String packageName) throws IOException {
	ResponseWrapper responseWrapper = executeGETRequest(DETAILS_URL, new String[][] { {
			"doc",
			packageName }, });

	return responseWrapper.getPayload().getDetailsResponse();
}
 
Example #28
Source File: GooglePlayAPI.java    From dummydroid with Apache License 2.0 5 votes vote down vote up
/** Equivalent of details but bulky one! */
public BulkDetailsResponse bulkDetails(List<String> packageNames) throws IOException {

	Builder bulkDetailsRequestBuilder = BulkDetailsRequest.newBuilder();
	bulkDetailsRequestBuilder.addAllDocid(packageNames);

	ResponseWrapper responseWrapper = executePOSTRequest(BULKDETAILS_URL, bulkDetailsRequestBuilder
			.build().toByteArray(), "application/x-protobuf");

	return responseWrapper.getPayload().getBulkDetailsResponse();
}
 
Example #29
Source File: GooglePlayAPI.java    From dummydroid with Apache License 2.0 5 votes vote down vote up
public BrowseResponse browse(String categoryId, String subCategoryId) throws IOException {

		ResponseWrapper responseWrapper = executeGETRequest(BROWSE_URL, new String[][] {
				{ "c", "3" },
				{ "cat", categoryId },
				{ "ctr", subCategoryId } });

		return responseWrapper.getPayload().getBrowseResponse();
	}
 
Example #30
Source File: GooglePlayAPI.java    From dummydroid with Apache License 2.0 5 votes vote down vote up
/**
 * Fetches applications within supplied category and sub-category. If
 * <code>null</code> is given for sub-category, it fetches sub-categories of
 * passed category.
 *
 * Default values for offset and numberOfResult are "0" and "20" respectively.
 * These values are determined by Google Play Store.
 */
public ListResponse list(String categoryId, String subCategoryId, Integer offset,
		Integer numberOfResult) throws IOException {
	ResponseWrapper responseWrapper = executeGETRequest(LIST_URL, new String[][] {
			{ "c", "3" },
			{ "cat", categoryId },
			{ "ctr", subCategoryId },
			{ "o", (offset == null) ? null : String.valueOf(offset) },
			{ "n", (numberOfResult == null) ? null : String.valueOf(numberOfResult) }, });

	return responseWrapper.getPayload().getListResponse();
}