Examples of YouTubeSearchService


Examples of com.googlecode.mashups.services.youtube.api.YouTubeSearchService

                writer.writeAttribute(ComponentConstants.ID_ATTRIBUTE, youTubeVideoList.getClientId(context),
                                      ComponentConstants.ID_ATTRIBUTE);           
               
                // get the component attributes.
                List<ServiceParameter> parameters           = new ArrayList<ServiceParameter>();    
                YouTubeSearchService   youTubeSearchService = YouTubeServicesFactory.getYouTubeSearchService();
              
                parameters.add(new ServiceParameter(YouTubeSearchServiceParameters.VERSION, "2"));     
                parameters.add(new ServiceParameter(YouTubeSearchServiceParameters.MAX_RESULTS, youTubeVideoList.getMaxResults().toString()));
                parameters.add(new ServiceParameter(YouTubeSearchServiceParameters.QUERY, youTubeVideoList.getSearchQuery()));
               
                if (youTubeVideoList.getCategory() != null) {
                    parameters.add(new ServiceParameter(YouTubeSearchServiceParameters.CATEGORY, youTubeVideoList.getCategory()));
                }
               
                if (youTubeVideoList.getLocation() != null) {
                    parameters.add(new ServiceParameter(YouTubeSearchServiceParameters.LOCATION, youTubeVideoList.getLocation()));
                }
               
                if (youTubeVideoList.getLocationRadius() != null) {
                    parameters.add(new ServiceParameter(YouTubeSearchServiceParameters.LOCATION_RADIUS, youTubeVideoList.getLocationRadius()));
                }
               
                // perform the actual video search on youTube.
                List<YouTubeSearchResultItem> videoResults = youTubeSearchService.getVideoList(parameters);           
   
                // encode results .
                UIComponent itemFacet = youTubeVideoList.getFacet(YOUTUBE_RESULT_ITEM);
               
                if (itemFacet == null) {
View Full Code Here

Examples of com.googlecode.mashups.services.youtube.api.YouTubeSearchService

import com.googlecode.mashups.services.youtube.api.YouTubeSearchServiceParameters;

public class YouTubeSearchServiceTest extends TestCase {
    public void testgGetVideoList() {
        List<ServiceParameter> parameters           = new ArrayList<ServiceParameter>();    
        YouTubeSearchService   youTubeSearchService = YouTubeServicesFactory.getYouTubeSearchService();
      
        parameters.add(new ServiceParameter(YouTubeSearchServiceParameters.VERSION, "2"));     
        parameters.add(new ServiceParameter(YouTubeSearchServiceParameters.MAX_RESULTS, "25"));
        parameters.add(new ServiceParameter(YouTubeSearchServiceParameters.CATEGORY, "sports"));
        parameters.add(new ServiceParameter(YouTubeSearchServiceParameters.QUERY, "brazil"));         
        
        try {
            List<YouTubeSearchResultItem> videoResults = youTubeSearchService.getVideoList(parameters);
           
            for (YouTubeSearchResultItem searchItem : videoResults) {
                System.out.println("Video: " + searchItem);
            }
           
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.