{"id":19529313,"url":"https://github.com/davepartner/youtube-url-to-embed-url","last_synced_at":"2025-04-17T05:30:02.387Z","repository":{"id":110557183,"uuid":"129590670","full_name":"davepartner/youtube-url-to-embed-url","owner":"davepartner","description":"A simple PHP code to effectively  convert normal youtube url to youtube embed url.","archived":false,"fork":false,"pushed_at":"2018-04-15T08:27:22.000Z","size":5,"stargazers_count":4,"open_issues_count":1,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-29T06:03:36.767Z","etag":null,"topics":["mysql","php","video","youtube"],"latest_commit_sha":null,"homepage":null,"language":null,"has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/davepartner.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-04-15T08:21:45.000Z","updated_at":"2024-02-23T20:57:04.000Z","dependencies_parsed_at":"2023-05-12T05:00:42.335Z","dependency_job_id":null,"html_url":"https://github.com/davepartner/youtube-url-to-embed-url","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/davepartner%2Fyoutube-url-to-embed-url","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/davepartner%2Fyoutube-url-to-embed-url/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/davepartner%2Fyoutube-url-to-embed-url/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/davepartner%2Fyoutube-url-to-embed-url/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/davepartner","download_url":"https://codeload.github.com/davepartner/youtube-url-to-embed-url/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249318967,"owners_count":21250444,"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":["mysql","php","video","youtube"],"created_at":"2024-11-11T01:23:39.194Z","updated_at":"2025-04-17T05:30:02.367Z","avatar_url":"https://github.com/davepartner.png","language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":"# youtube-url-to-embed-url\nA simple PHP code to effectively  convert normal youtube url to youtube embed url.\n\n```\n\n\n\u003c?php \n//there are two types of youtube normal url\n//the code below simulatneously takes care of the two.\n//many codes that attempt to do this fail because they don't realize this ancient truth\n\n              $url = \"https://www.youtube.com/watch?v=q4aL9h6-WIA\";\n              $shortUrlRegex = '/youtu.be\\/([a-zA-Z0-9_]+)\\??/i';\n              $longUrlRegex = '/youtube.com\\/((?:embed)|(?:watch))((?:\\?v\\=)|(?:\\/))(\\w+)/i';\n          \n              if (preg_match($longUrlRegex, $url, $matches)) {\n                  $youtube_id = $matches[count($matches) - 1];\n              }\n          \n              if (preg_match($shortUrlRegex, $url, $matches)) {\n                  $youtube_id = $matches[count($matches) - 1];\n              }\n              $fullEmbedUrl = 'https://www.youtube.com/embed/' . $youtube_id ;\n          ?\u003e\n          \n          \u003c!-- the embed code --\u003e\n          \n\u003ciframe id=\"ytplayer\" type=\"text/html\" width=\"560\" height=\"400\"\n    src=\"\u003c?php echo $fullEmbedUrl ?\u003e?rel=0\u0026showinfo=0\u0026color=white\u0026iv_load_policy=3\"\n    frameborder=\"0\" allowfullscreen\u003e\u003c/iframe\u003e \n    \n```\n\nCheck me out on udemy, you could find one of my courses you may like =\u003e\n[Dave Partner on Udemy](udemy.com/user/daveozoalor)\n\nChat me up to say thank you =\u003e daveozoalor@gmail.com\nI rant on twitter [Dave Partner on Twitter](twitter.com/daveozoalor)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdavepartner%2Fyoutube-url-to-embed-url","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdavepartner%2Fyoutube-url-to-embed-url","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdavepartner%2Fyoutube-url-to-embed-url/lists"}