How to get dailymotion videos list - android

I want to get list of videos from daily motion, i have registered in daily motion. it's retrieved API key and secret key but i have no idea what is the next step, i want to show the list of videos and show the detail.
I have referred https://developer.dailymotion.com/api but i could not find any way how to integrate in my application.
Please guys help to solve this!!!

In case you want to get videos only (no channel or playlist) You can simply do:
https://api.dailymotion.com/videos?page=2
Response will be paginated so you need to add page numbers
https://api.dailymotion.com/videos?page=2
You can also get more >10 results
https://api.dailymotion.com/videos?limit=100

I would recommend you to make a GET request using https://github.com/amitshekhariitbhu/Fast-Android-Networking this library and sending the API key in your request header. This is one of the best networking libraries and very easy to implement. Use .addHeaders("token", "1234") to add API key in your request.

Set up Retrofit and Moshi/Gson (Best Guide: https://guides.codepath.com/android/Consuming-APIs-with-Retrofit) and then it would be just calling an endpoint.
#GET("https://api.dailymotion.com/channel/music/videos")
Call<List<Video>> getVideos();
or
#GET("https://api.dailymotion.com/user/{userId}")
Call<List<Video>> getVideos(#Path("userId") String userId);
And to use the Access Token:
#GET("https://api.dailymotion.com/videos?")
Call<List<Video>> getVideos(#Path("userId") String userId, #Query("sort") String sort);

Related

Get users by objectId Retrofit/Parse

I have a list of users in parse.com
I need to retrieve some of these users, I had all of the necessary ids.
For example I had 50 users stored in parse, but I only need 10.
With these 10 Ids I need to get the users.
I postman I do the next:
https://parseapi.back4app.com/users?where={"objectId":{"$in":["id01","id02","id03".."id10"]}}
And I get the data correctly.
How can I translate into a retrofit call? How I can do a "where" sentence in Retrofit?
Thanks for all.
Try defining where as a URL parameter and setting {"objectId":{"$in":["id01","id02","id03".."id10"]}} as the value textInCurlyBrackets when using the retrofit call:
public interface FooService {
#GET("https://parseapi.back4app.com/users")
void getUsersByIDs(#Query("where") String textInCurlyBrackets, Callback<String> callback);
}
If you need further information this post may help you: Retrofit and GET using parameters

Android REST API - Parse Server

What is the way to send queries to Parse Server with Retrofit, rest api.
I found something like that:
trying to retrieve one object based on conditions values using Android REST API
But i don't understand how can I configure it for my kind queries in android:
#GET("classes/Mentor")
Call<OneMentorResponse> getMentor(#Query("where")
String where, #Header("X-Parse-Session-Token") String token);
pass a HashMap to query.
HashMap<String,String> sendKey=new HashMap<>;
sendKey.put("yourKey","yourValue");
yourApiInterface.getMentor(new JSONObject(sendKeyValue).toString()).new CallBack<OneMentorResponse response>{}
and implement the response and failure methods.
and also pass your header the way you are doing it.

Youtube Channel List Api - not returning data in order

I am trying to do a simple Youtube Subcriber app.
When i try to send the user id , the returned result doesn't match the order i sent .
This is the api i am using
https://www.googleapis.com/youtube/v3/channels?part=statistics,brandingSettings,snippet&key=XXXXXXXXXXXXXXX&id=UCqIqRzEge-Qvt4Iglx-uKdQ,UC6bA7BuUmGKPIS3wW2voNxg,UC9JgYaC76Q_eSgYM01S5J_w,UCgefQJC5UgbWJHDxBqB4qVg,UCddiUEpeqJcYeBxX1IVBKvQ,UCOmcA3f_RrH6b9NmcNa4tdg
For example , i sent the data in this order
The Verge
Cnet
BfvsGf
The data returns :
BfvsGf
TheVerge
Cnet
It's not in order at all. Please advice.
Use Search:list, it returns a collection of search results that match the query parameters specified in the API request. By default, a search result set identifies matching video, [channel](https://developers.google.com/youtube/v3/docs/channels) and playlist resources but you ca also configure queries to only retrieve a specific type of resource.
HTTP request
GET https://www.googleapis.com/youtube/v3/search
include the order parameter, the parameter specifies the method that will be used to order resources in the API response.
You can sort list by descending order, sort from highest to lowest rating or sorted by alphabetically. The acceptable values are: date, rating, relevance, title, videoCount, viewCount. The 'order' parameter will sort results based on when the resources were created.

How to get the particular value from the response message and assign it to another variable in the next request in Jmeter?

I am trying to make a performance testing process by using the Jmeter for the mobile chat application. The scenario i am trying is,need to analyze the output during the N number of new user registration process.I am feeding the N user data through "CSV Data Set Config".In that mentioned the variable names as "phone,ime".
For each new user registration process,the application will generate the one time password when calling the API1.The question is,I need to get that generated one time password from the API1 response message for each phone user and need to assign the value to the variable ${code} when calling the API2.
The below are the API & parameters details:
API1:/api/users/registration-sms.html?
1) Name:phone, Value: ${phone}
2) Name:ime, Value: ${ime}
Example :
Request - POST data: phone=917010370002 & ime=e78b56418b55b32c
Response:{"response":{"httpCode":200,"Message":"True","Code":"5858"}}
API2: /api/users/registration-sms-verfy.html?
1) Name:phone, Value:${phone}
2) Name:code, Value:${code}
Note : For this variable ${code},We need to get the data from the API1("Code":"5858") response message for the respective phone(917010370002).
Please provide me the feasible solution to sort out of my requirement.
Thanks in advance.
You can use Regular extractor post processor like,
Assuming your response is like
{"response":{"httpCode":200,"Message":"True","Code":"5858"}}
your regular expression will be like to extract code value but for specifiic phone no you need to modify it a little bit,
"Code"\:"(\d+)"
for occurance detail you can provide which match no. you want.
Refer Regular Expression Exctrator Post Processor

How to fetch more than 4 results google json feed load api?

Currently when I call google rss/atom feed loader, I always get only 4 results in the response.
How can I get all the items in the response?
I need the results for my android app.
'https://ajax.googleapis.com/ajax/services/feed/load?v=1.0&q=http://www.digg.com/rss/index.xml'
I got the answer. I just need to add a "num" parameter to my query
https://ajax.googleapis.com/ajax/services/feed/load?v=1.0&q=http://www.digg.com/rss/index.xml&num=30
The 'num' parameter does not work for 'find' method it only works for 'load' method. So I don't think there is any solution to this problem.
Use feed.setNumEntries(7); for retrieving more than 4 entries or number of items you want to retrieve.
var feed = new google.feeds.Feed("http://www.wsj.com/xml/rss/3_7085.xml");
feed.setNumEntries(7);
Read more: Google Feed API Developer's Guide

Categories

Resources