{"id":18839762,"url":"https://github.com/maximbilan/ios-youtube-browser","last_synced_at":"2025-04-14T07:06:11.654Z","repository":{"id":27078224,"uuid":"30544801","full_name":"maximbilan/iOS-YouTube-Browser","owner":"maximbilan","description":"iOS YouTube Browser Sample","archived":false,"fork":false,"pushed_at":"2018-09-22T07:32:35.000Z","size":1241,"stargazers_count":8,"open_issues_count":0,"forks_count":3,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-14T07:05:03.353Z","etag":null,"topics":["ios","ios-app","objective-c","tutorial","youtube","youtube-api"],"latest_commit_sha":null,"homepage":"","language":"Objective-C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/maximbilan.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-02-09T16:15:15.000Z","updated_at":"2018-09-22T07:32:37.000Z","dependencies_parsed_at":"2022-08-31T19:30:19.048Z","dependency_job_id":null,"html_url":"https://github.com/maximbilan/iOS-YouTube-Browser","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/maximbilan%2FiOS-YouTube-Browser","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/maximbilan%2FiOS-YouTube-Browser/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/maximbilan%2FiOS-YouTube-Browser/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/maximbilan%2FiOS-YouTube-Browser/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/maximbilan","download_url":"https://codeload.github.com/maximbilan/iOS-YouTube-Browser/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248837280,"owners_count":21169374,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ios","ios-app","objective-c","tutorial","youtube","youtube-api"],"created_at":"2024-11-08T02:44:00.403Z","updated_at":"2025-04-14T07:06:11.616Z","avatar_url":"https://github.com/maximbilan.png","language":"Objective-C","funding_links":[],"categories":[],"sub_categories":[],"readme":"# iOS YouTube Browser Sample\n\nThis tutorial explains how to create a simple \u003ci\u003eiOS\u003c/i\u003e application which working with \u003ci\u003eYouTube API\u003c/i\u003e.\n\nFirst of all, you should create \u003ci\u003eGoogle\u003c/i\u003e account, if you haven’t. Go to \u003ca href=\"https://console.developers.google.com/project\"\u003eGoogle Developers Console\u003c/a\u003e and create the project.\n\n![alt tag](https://raw.github.com/maximbilan/ios_youtube_browser/master/img/img1.png)\n\nIn created project, you will have lots of settings, statistics, something else. For your application we need to enable \u003ci\u003eYouTube API\u003c/i\u003e.\n\n![alt tag](https://raw.github.com/maximbilan/ios_youtube_browser/master/img/img2.png)\n\nAlso you need to create an \u003ci\u003eiOS\u003c/i\u003e key by this \u003ca href=\"https://code.google.com/apis/console/?noredirect\"\u003elink\u003c/a\u003e on the \u003ci\u003eAPI\u003c/i\u003e access tab and \u003ci\u003eCreate new iOS key\u003c/i\u003e button.\n\n![alt tag](https://raw.github.com/maximbilan/ios_youtube_browser/master/img/img3.png)\n\n![alt tag](https://raw.github.com/maximbilan/ios_youtube_browser/master/img/img4.png)\n\nNow all settings were set up.\n\nWe have two question for our simple application. How to receive data from \u003ci\u003eYouTube\u003c/i\u003e? And how to play \u003ci\u003eYouTube\u003c/i\u003e videos in \u003ci\u003eUIKit\u003c/i\u003e?\n\nFor receiving the data we will use the next \u003ca href=\"https://developers.google.com/apis-explorer/#p/youtube/v3/youtube.search.list\"\u003erequest\u003c/a\u003e. Google provides lots of information about API, you can found \u003ca href=\"https://developers.google.com/youtube/v3/\"\u003ehere\u003c/a\u003e. Full information about API, \u003ca href=\"https://developers.google.com/youtube/v3/sample_requests\"\u003esamples\u003c/a\u003e, etc.\n\nThe sample code for a request using \u003ci\u003eAFNetworking\u003c/i\u003e:\n\n\u003cpre\u003e\nstatic NSString * const YouTubeBaseUrl = @\"https://www.googleapis.com/youtube/v3/search?part=snippet\u0026q=%@\u0026type=video\u0026videoCaption=closedCaption\u0026key=%@\u0026maxResults=%@\";\nstatic NSString * const YouTubeAppKey = @\"AIzaSyCs0lcHGW2oW88FO8FeR8j_hXMc9oCG6p0\";\nstatic const NSInteger YouTubeMaxResults = 50;\n\n...\n\nNSString *str = [searchString stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];\nNSString *url = [NSString stringWithFormat:YouTubeBaseUrl, str, YouTubeAppKey, @(YouTubeMaxResults)];\nAFHTTPRequestOperationManager *manager = [AFHTTPRequestOperationManager manager];\n[manager GET:url parameters:nil success:^(AFHTTPRequestOperation *operation, id responseObject) {\n   NSLog(@\"JSON: %@\", responseObject);\n} failure:^(AFHTTPRequestOperation *operation, NSError *error) {\n   NSLog(@\"Error: %@\", error);\n}];\n\u003c/pre\u003e\n\nAnd the second question. For this you can use the \u003ca href=\"https://github.com/youtube/youtube-ios-player-helper\"\u003eYouTube Player\u003c/a\u003e. It’s a great control with a really simple usage:\n\n\u003cpre\u003e\n[self.playerView loadWithVideoId:@\"M7lc1UVf-VE\"];\n\u003c/pre\u003e\n\nI think it doesn’t make sense to explain the details, just download the repository and use the sample.\n\n![alt tag](https://raw.github.com/maximbilan/ios_youtube_browser/master/img/img5.png)\n\nThat’s all. Happy coding!!!\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmaximbilan%2Fios-youtube-browser","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmaximbilan%2Fios-youtube-browser","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmaximbilan%2Fios-youtube-browser/lists"}