3

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!!!

3 Answers3

1

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);
Zahid Rasheed
  • 1,536
  • 1
  • 10
  • 28
  • but how to pass id like https://api.dailymotion.com/video/x26ezrb in this link x26ezrb is id, so i can get this id? –  Mar 01 '17 at 09:28
  • but how to get userId? –  Mar 01 '17 at 09:33
  • https://developer.dailymotion.com/api#auth See this. I would suggest first setup retrofit and get list of videos (because you don't need to be auth to get that) https://api.dailymotion.com/channel/music/videos – Zahid Rasheed Mar 01 '17 at 09:39
  • ok thanks but auth response is like this {"id":null,"scope":[],"roles":[],"username":null,"screenname":null} the id is null, is there need to any parameter? –  Mar 01 '17 at 09:45
  • You need to pass the access token to get this information. – Zahid Rasheed Mar 01 '17 at 09:51
  • Let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/136941/discussion-between-komal-and-zahid-rasheed). –  Mar 01 '17 at 09:56
  • Do you have an idea how to show all videos not particular music Chanel, Is it possible? –  Mar 01 '17 at 13:00
  • What do you mean by all videos? – Zahid Rasheed Mar 01 '17 at 13:02
  • i mean not any specific channel, i want to show the all channels videos –  Mar 01 '17 at 13:03
  • and right now it's showing data of page 1 and it's contain only 10 videos –  Mar 01 '17 at 13:07
  • This will get you videos (no channel or playlist): https://api.dailymotion.com/videos – Zahid Rasheed Mar 01 '17 at 13:10
  • And then you need to provide a field page: http://api.dailymotion.com/videos?page=2 – Zahid Rasheed Mar 01 '17 at 13:11
  • Is it possible to get video of localisation wise or country wise? –  Mar 04 '17 at 05:04
1

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.

Ambuj Kathotiya
  • 369
  • 4
  • 18
1

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
Zahid Rasheed
  • 1,536
  • 1
  • 10
  • 28