Git Product home page Git Product logo

youtubedl's Introduction

YoutubeDL

This iOS app uses yt-dlp python module to download videos from YouTube.

  • Screen shots

Screen shot 1 Screen shot 2 Screen shot 3 Screen shot 4

  • Video

Watch the video

Warning

This app is NOT AppStore-safe. Historically AppStore has been removing apps downloading videos from YouTube. This app will likely be rejected by AppStore.

Features

Usage

Run this app in a simulator.

To run on a device:

  • Change code sign identity
  • Change bundle ID

Swift Packages

TODO

  • Improve UI/UX
  • Improve modularization
  • Documentation

License

MIT

youtubedl's People

Contributors

kewlbear avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

youtubedl's Issues

How to cancel ongoing download

Can you guide me on how to cancel an ongoing download? Calling download again while another is downloading causes a crash. Thanks~

get stream URL

Is there a way i can get the steam URL without the downloading?

Requirements for the code to run elsewhere? (files, packages, libraries, etc.)

Hi,

I want to download a Youtube video (given the video id), save it in the app internally, and play/access it. I tried copying the files over and adding the package dependencies (e.g. ffmpeg, python, YoutubeDL), but when I ran the app and tried downloading a video, I get this error:

Could not find platform independent libraries <prefix>
Could not find platform dependent libraries <exec_prefix>
Consider setting $PYTHONHOME to <prefix>[:<exec_prefix>]
Python path configuration:
  PYTHONHOME = (not set)
  PYTHONPATH = (not set)
  program name = 'python3'
  isolated = 0
  environment = 1
  user site = 1
  import site = 1
  sys._base_executable = '/private/var/containers/Bundle/Application/214045C5-B223-4526-BFE5-39A9CB268D35/yt test.app/yt test'
  sys.base_prefix = '/Users/runner/work/Python-iOS/Python-iOS/kivy-ios/dist/root/python3'
  sys.base_exec_prefix = '/Users/runner/work/Python-iOS/Python-iOS/kivy-ios/dist/root/python3'
  sys.executable = '/private/var/containers/Bundle/Application/214045C5-B223-4526-BFE5-39A9CB268D35/yt test.app/yt test'
  sys.prefix = '/Users/runner/work/Python-iOS/Python-iOS/kivy-ios/dist/root/python3'
  sys.exec_prefix = '/Users/runner/work/Python-iOS/Python-iOS/kivy-ios/dist/root/python3'
  sys.path = [
    '/Users/runner/work/Python-iOS/Python-iOS/kivy-ios/dist/root/python3/lib/python38.zip',
    '/Users/runner/work/Python-iOS/Python-iOS/kivy-ios/dist/root/python3/lib/python3.8',
    '/Users/runner/work/Python-iOS/Python-iOS/kivy-ios/dist/root/python3/lib/lib-dynload',
  ]
Fatal Python error: init_fs_encoding: failed to get the Python codec of the filesystem encoding
Python runtime state: core initialized
ModuleNotFoundError: No module named 'encodings'

Current thread 0x000000016f587000 (most recent call first):
<no Python frame>

What else do I need to do for the DownloadViewController class to work?

App crashes when installed from Testflight

When testing on a device or simulator it works great but when installed from Testflight it crashes. Any idea why that could be?
@kewlbear

#0	(null) in _assertionFailure(_:_:file:line:flags:) ()
#1	(null) in specialized PythonLibrary.init+ 1395960 () ()
#2	(null) in one-time initialization function for shared ()
#3	(null) in _dispatch_client_callout ()
#4	(null) in _dispatch_once_callout ()
#5	(null) in swift_once ()
#6	(null) in specialized static PythonLibrary.loadSymbol<A>+ 1387732 (name:legacyName:type:) ()
#7	(null) in one-time initialization function for Py_Initialize ()
#8	(null) in _dispatch_client_callout ()
#9	(null) in _dispatch_once_callout ()
#10	(null) in swift_once ()
#11	(null) in one-time initialization function for Python ()
#12	(null) in _dispatch_client_callout ()
#13	(null) in _dispatch_once_callout ()
#14	(null) in swift_once ()
#15	(null) in specialized PythonObject.init<A>+ 1376396 (_:) ()
#16	(null) in one-time initialization function for defaultOptions ()
#17	(null) in _dispatch_client_callout ()
#18	(null) in _dispatch_once_callout ()
#19	(null) in swift_once ()
#20	(null) in defaultOptions.unsafeMutableAddressor ()
#21	(null) in default argument 0 of YoutubeDL.init(options:) ()
#22	(null) in closure #1 in YoutubeDLManager.loadYoutubeDl(completion:) ()
#23	(null) in thunk for @escaping @callee_guaranteed () -> () ()
#24	(null) in _dispatch_call_block_and_release ()
#25	(null) in _dispatch_client_callout ()
#26	(null) in _dispatch_root_queue_drain ()
#27	(null) in _dispatch_worker_thread2 ()
#28	(null) in _pthread_wqthread ()
#29	(null) in start_wqthread ()

HookMain crash when using `extractInfo`

Example project works without any issues and all unit tests working as expected too. However when I run the following code in a fresh project I get crash.

Code example:

        Task { @MainActor in
            let youtubeDL = YoutubeDL()
            let (formats, info) = try await youtubeDL.extractInfo(url: URL(string: "https://www.youtube.com/watch?v=WdFj7fUnmC0")!)
            print(formats, info)
        }

Crash info

Thread 5: EXC_BAD_ACCESS (code=2, address=0x2800001100)

Crash occurs on:

Hook.m

Line 55:

    ret = realMain(argc, argv);
    NSLog(@"%s: realMain=%d", __func__, ret);

When the following is called in YoutubeDL.swift:576

pythonObject = try await makePythonObject()

Fully expecting this to be something I am doing incorrectly.

Downloading m3u8 file issue - only works from Xcode and json.decoder.JSONDecodeError

Hello,

I am encountering two issues with the argv for downloading an m3u8 file.

let argv: [String] = (
    url.pathExtension == "mp4"
    ? ["-o", url.lastPathComponent,]
    : [
        "-f", "hls-2176",
        "-S","ext:mp4:m4a",
    ]
)
+ [
    "--no-check-certificates",
    url.absoluteString,
]

1st Issue: App functioning only when running from Xcode

The download only works when the app is run from Xcode. If I close Xcode and reopen it, the download no longer functions. Here are the steps to reproduce the issue:

  1. Clone the repository.
  2. Run the app from Xcode.
  3. Close the app.
  4. Open the app manually - not by running the project from Xcode.
  5. Attempt to download the sample URL using the provided argv.

I've included a screenshot of the issue:

IMG_2782

2nd Issue: json.decoder.JSONDecodeError

While the app is running via Xcode and the download is complete, I encounter the following error:

json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
startDownload(url:) Error Domain=App Code=1 "ERROR: Expecting value: line 1 column 1 (char 0)" UserInfo={NSLocalizedDescription=ERROR: Expecting value: line 1 column 1 (char 0)}

Steps to reproduce the issue:

  1. Run the app from Xcode.
  2. Attempt to download the sample URL using the provided argv.

Here are the screenshots of the second issue:

Screenshot 2023-07-24 at 11 10 25 AM Screenshot 2023-07-24 at 11 10 08 AM

I would appreciate any help or guidance with these issues.

Merging never finishes

I've tried downloading the webm version of the demo video from the readme, but the merging process never seems to finish. I'm running the app on iPhone 12 Mini with iOS 15.3.1.

Dependencies could not be resolved

I cloned this repo, opened Xcode and pressed Run. This is the error i got:

Dependencies could not be resolved because root depends on 'youtubedl-ios' 0.0.2..<1.0.0.
'youtubedl-ios' >= 0.0.2 cannot be used because no versions of 'youtubedl-ios' match the requirement 0.0.3..<1.0.0 and package 'youtubedl-ios' is required using a stable-version but 'youtubedl-ios' depends on an unstable-version package 'ffmpeg-ios'.

You have requested downloading the video partially, but ffmpeg is not installed

I'm facing this error when using example app:

You have requested downloading the video partially, but ffmpeg is not installed. Aborting

This is because of this line in python ffmpeg handler:

raise FileNotFoundError(errno.ENOENT, os.strerror(errno.ENOENT), args[0])

image

When I remove the line, it run through communicate function but after all it throws AttributionError:

Popen.__init__: <yt_dlp.utils.Popen object at 0x126d28160> (['ffmpeg', '-bsfs'],)
Popen.communicate: <yt_dlp.utils.Popen object at 0x126d28160> () {'timeout': None}
Popen.kill: <yt_dlp.utils.Popen object at 0x126d28160>
Popen.wait: <yt_dlp.utils.Popen object at 0x126d28160> {'timeout': None}
ERROR: 'Popen' object has no attribute '_Pop__args'

Please explain the python handler code, I have very little knowledge about python @kewlbear, thanks!

visionOS Support

Please adapt your small app to work on Apple visionOS’s UI framework, not just as an iOS app running on visionOS.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.