{"id":14979637,"url":"https://github.com/antonyhaman/youtube-jextractor","last_synced_at":"2025-10-28T19:31:40.206Z","repository":{"id":53604597,"uuid":"185376412","full_name":"antonyhaman/youtube-jextractor","owner":"antonyhaman","description":"Android based library that allows you to download or play audio and video from Youtube, in other words - youtube-dl for android","archived":false,"fork":false,"pushed_at":"2021-03-21T19:55:08.000Z","size":346,"stargazers_count":113,"open_issues_count":16,"forks_count":26,"subscribers_count":13,"default_branch":"master","last_synced_at":"2024-09-29T03:21:14.316Z","etag":null,"topics":["android","android-library","audio","extract-video","extractor","java","muxed-streams","stream","streams","videodetails","youtube","youtube-dl","youtube-dl-android","youtube-downloader","youtube-extractor","youtube-video","youtube-videos","youtubeextractor"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/antonyhaman.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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":"2019-05-07T10:08:06.000Z","updated_at":"2024-09-25T11:21:09.000Z","dependencies_parsed_at":"2022-09-19T04:32:02.837Z","dependency_job_id":null,"html_url":"https://github.com/antonyhaman/youtube-jextractor","commit_stats":null,"previous_names":["antonyhaman/youtube-jextractor"],"tags_count":27,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/antonyhaman%2Fyoutube-jextractor","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/antonyhaman%2Fyoutube-jextractor/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/antonyhaman%2Fyoutube-jextractor/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/antonyhaman%2Fyoutube-jextractor/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/antonyhaman","download_url":"https://codeload.github.com/antonyhaman/youtube-jextractor/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":219858900,"owners_count":16556039,"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":["android","android-library","audio","extract-video","extractor","java","muxed-streams","stream","streams","videodetails","youtube","youtube-dl","youtube-dl-android","youtube-downloader","youtube-extractor","youtube-video","youtube-videos","youtubeextractor"],"created_at":"2024-09-24T14:00:25.673Z","updated_at":"2025-10-28T19:31:39.811Z","avatar_url":"https://github.com/antonyhaman.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":" # YoutubeJExtractor for Android! ![Android CI](https://github.com/kotvertolet/youtube-jextractor/workflows/Android%20CI/badge.svg)\n\nYoutubeJExtractor is Android extractor library that allows you to extract video and audio from any youtube video along with some other data such as a video title, description, author, thumbnails and others.\n\nThis library was initially created for my android app [Youtube audio player](https://github.com/kotvertolet/youtube-audio-player)\n## Features\n1. Extracts video and audio streams from Youtube videos. Supports both adaptive and muxed streams.\n2. Extracts various video data like title, description, view count, channel id, etc.\n3. Supports age restricted videos.\n4. Supports videos with restricted embedding.\n5. Supports regon restricted videos (through a proxy).\n6. Supports HLS and DASH live streams.\n7. Supports subtitles extraction \n \n## How to install\n[![](https://jitpack.io/v/kotvertolet/youtube-jextractor.svg)](https://jitpack.io/#kotvertolet/youtube-jextractor)\n\n## What's new?\n### v0.3.2\nSubtitles extraction implemented\n\n### v0.3.1\nBug fixes\n\n### v0.3.0\n1. Fixed NPE #28, thanks @niteshfel for reporting\n2. Implemented new overloaded extract method that takes callback as parameter:\n```java\n     youtubeJExtractor.extract(videoId, new JExtractorCallback() {\n            @Override\n            public void onSuccess(YoutubeVideoData videoData) {\n                // use extracted data\n            }\n\n            @Override\n            public void onNetworkException(YoutubeRequestException e) {\n                // may be a connection problem, ask user to check his internet connection\n            }\n\n            @Override\n            public void onError(Exception exception) {\n                // some serious problem occured, just show some error message\n            }\n        });\n```\n\u003cdetails\u003e\n  \u003csummary\u003eOlder versions\u003c/summary\u003e\n \n### v0.2.9\nMinor changes, increased stability and logging is slightly improved\n\n### v0.2.8\n1. Code updated to match latest youtube changes\n2. Improved age restricted videos detection\n\n### v0.2.5:\nMuxed streams are now supported! Thanks to @comptoost for enchancement request \n\n### v0.2.4:\n1. Possibility to use YoutubeJExtractor with custom `OkHttpClient` instance via the following one argument constructor - `YoutubeJExtractor(OkHttpClient client)`. It could be usefull for region restricted video (via creating `OkHttpClient` instance with proxy).\n2. Implemented RequestExecutor class with `executeWithRetry(...)` method - now every http call will be executed up to 3 times before `YoutubeRequestException` throw, it will increase stability.\n\u003c/details\u003e\n\n## How to use\n\n```java\n    YoutubeJExtractor youtubeJExtractor = new YoutubeJExtractor();\n    YoutubeVideoData videoData;\n    try {\n        videoData = youtubeJExtractor.extract(videoId);\n    }\n    catch (ExtractionException e) {\n        // Something really bad happened, nothing we can do except just show some error notification to the user \n    }\n    catch (YoutubeRequestException e) {\n        // Possibly there are some connection problems, ask user to check the internet connection and then retry \n    }\n``` \n**YoutubeVideoData** is an object that contains data for the requested \nvideo split across two main objects: **VideoDetails** and **StreamingData**.\n\n* **VideoDetails** contains various video data such as title, description, author, rating, view count, etc.\n* **StreamingData** contains two fields with the lists of adaptive streams (video and audio), ***muxedStreams** contains as the name implies muxed streams (streams that contain both audio and video) ***dashManifestUrl*** and ***hlsManifestUrl*** fields which are contains links to the DASH and HLS manifests (if you dealing with a live stream) and ***expiresInSeconds*** which indicates how long links will be alive.\n \nTo get all the video streams:\n```java\n    List\u003cAdaptiveVideoStream\u003e videoStreamsList = videoData.getStreamingData().getAdaptiveVideoStreams()\n``` \n\nEach StreamItem object contains fields that describe the stream such as:\n* it's ***extension*** (like mp4, ogg, etc),\n* ***codec***, ***bitrate***, ***url*** and many others. \n\n Check `AdaptiveVideoStream.class` and `AdaptiveAudioStream.class` for the details.\n \n ### Live streams\n \nLive streams are also supported by ***YoutubeJextractor***, but you have to treat them differently than the regular videos, to play live content you have to use ***DASH*** or ***HLS*** manifests. Your code will look like this:\n```java\nYoutubeVideoData videoData = youtubeJExtractor.extract(\"stream_video_id\");\nif (videoData.getVideoDetails().isLiveContent()) {\n    String dashManifest = videoData.getStreamingData().getDashManifestUrl();\n   // or use HLS manifest via getHlsManifestUrl() method\n}\nelse {\n...\n}\n```\nThen you have to decide how to deal with manifest url, it depends on how you're gonna play media content, for instance, if you are using [ExoPlayer](https://exoplayer.dev/), please refer to the [DASH](https://exoplayer.dev/dash.html) and [HLS](https://exoplayer.dev/hls.html) guides.\n\n ### Subtitles\nSubtitles extraction is very simple:\n ```java\n youtubeJExtractor.extractSubtitles(videoId)\n ```\nThis line will return a map where key is language and value is a list of subtitle lines with time codes. **Note that autogenerated subtitles are not currently supported.\n\n## FAQ\n### Q: What is a muxed stream?\n[Muxed](https://wiki.videolan.org/Muxing/) stream is a stream that contains video and audio at the same time. My library extracts muxed streams along with [demuxed](https://wiki.videolan.org/Demuxing/) that contain only video or audio.\n\n### Q: I need to play both video and audio at the same time, but your library gives me no muxed streams (or they have lower quality), is it a bug of the library?\nNo, it's not, my library extracts *everything* what youtube provides for the specific video, but for some youtube's internal reasons they have different set of streams available for each video, sometimes there are muxed streams sometimes there aren't. But it's not a problem because you can take separately audio and video stream and then combine them into a single, muxed stream, with any quality you want! \n #### How to do that?\nDepends on how you're gonna play your streams, for instance if you're using ExoPlayer (what I personally recommend for media playback in andoird) you need to take a look at [MergingMediaSource.class](https://exoplayer.dev/doc/reference/com/google/android/exoplayer2/source/MergingMediaSource.html):\n\n``` java\n\nMediaSource videoSource = new ProgressiveMediaSource.Factory(...)\n    .createMediaSource(videoUri);\nMediaSource audioSource = new ProgressiveMediaSource.Factory(...)\n    .createMediaSource(audioUri);\n\nMergingMediaSource mergedSource = new MergingMediaSource(videoSource, audioSource);\n```\n\n## Requirements\n\nWorks on API 19+.\n\n## Credits\n\n[Youtube-dl](https://github.com/ytdl-org/youtube-dl) - the idea and implementation were influenced by Youtube-dl\n \n## License\n\n Distributed under the GPL v2 License. See [LICENSE.md](https://github.com/kotvertolet/YoutubeJExtractor/blob/master/LICENSE) for terms and conditions.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fantonyhaman%2Fyoutube-jextractor","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fantonyhaman%2Fyoutube-jextractor","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fantonyhaman%2Fyoutube-jextractor/lists"}