Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

android version? #967

Closed
ghost opened this issue Jun 29, 2013 · 38 comments
Closed

android version? #967

ghost opened this issue Jun 29, 2013 · 38 comments

Comments

@ghost
Copy link

@ghost ghost commented Jun 29, 2013

I want to use my android phone to download youtube videos via public wi-fi and watch them later back home. Will you (plan to) release android version for youtube-dl?

@phihag

This comment has been minimized.

Copy link
Collaborator

@phihag phihag commented Jun 30, 2013

You can already run youtube-dl on android; just install Python, download youtube-dl, and run it. However, at the moment, there are no official plans to provide further android integration, but you are of course welcome to contribute the necessary code. As with GUIs, it is usually better to call youtube-dl though and move the work into an external repository.

@daprofessa19

This comment has been minimized.

Copy link

@daprofessa19 daprofessa19 commented Aug 26, 2013

I'm trying to do this, but I get an encoding error. Is there anything else I must do with the youtube-dl.py file?

@canamcy

This comment has been minimized.

Copy link

@canamcy canamcy commented Sep 14, 2013

There are other linux systems as well that don't declare filesysencoding?
I'm getting "ERROR:" when i try on android with a recent version.
I only use youtube video id's for filenames, it'd be nice if I could at least use that.

@jaimeMF

This comment has been minimized.

Copy link
Collaborator

@jaimeMF jaimeMF commented Sep 14, 2013

@canamcy & @daprofessa19 open new issues for that

@canamcy

This comment has been minimized.

Copy link

@canamcy canamcy commented Sep 16, 2013

2013-09-16 works.

@bazzawill

This comment has been minimized.

Copy link

@bazzawill bazzawill commented Sep 25, 2013

How do I get python to run youtube-dl do I need to use sl4a cheers

@Mariusz-W

This comment has been minimized.

Copy link

@Mariusz-W Mariusz-W commented Sep 29, 2013

@phihag

Quote: "You can already run youtube-dl on android; just install Python, download youtube-dl, and run it"

Have you verified that yourself? — I doubt it.

The link that you supplied is to an essentially dead project. Neither their ancient Python 2.6.2 nor their more recent 3.2 work with youtube-dl.

I couldn't make any use of QPython apps available at Google Play either. I am not aware of any working port of Python 2.7 or 3.3. to Android. That's really a great pity since youtube-dl has been a great command line tool. Making it available under Android would be very desirable.

@phihag

This comment has been minimized.

Copy link
Collaborator

@phihag phihag commented Sep 29, 2013

@Mariusz-W youtube-dl works fine with Python 2.6 (3.2 is fundamentally incompatible to 2.x, so we don't support that). Since you don't seem to believe me, here is a screenshot of youtube-dl on android, under SL4A 2.6:

Android screenshot

Since it works fine and comments seem to go off the rails, I'm closing this issue now.

If anyone wants to develop a youtube-dl GUI for android, you're more than welcome to do so - feel free to open new issues on anything that doesn't work or could be improved. I would also be happy to contribute to any development, but not lead it. I agree that we are missing a great port of current-day cPython versions, but that's out of the scope of this project.

@phihag phihag closed this Sep 29, 2013
@Mariusz-W

This comment has been minimized.

Copy link

@Mariusz-W Mariusz-W commented Sep 29, 2013

Would you kindly provide information (or the relevant screenshots) regarding how did you execute youtube-dl with command line arguments?

@phihag

This comment has been minimized.

Copy link
Collaborator

@phihag phihag commented Sep 29, 2013

@Mariusz-W Install Python somewhere (I used SL4A for this screenshot, but you can also compile your own), download youtube-dl and run python youtube-dl (or even ./youtube-dl). If python isn't in your PATH, simply pass in the whole filename. For example, on a default SL4A with Python 2.6 installation,

/data/user/0/com.googlecode.pythonforandroid/files/python/bin/python youtube-dl

was used to produce the above screenshot. I prefer to use adb shell to test the shell, or a terminal emulator, but neither of them would give a good screenshot.

@Mariusz-W

This comment has been minimized.

Copy link

@Mariusz-W Mariusz-W commented Sep 29, 2013

@bazzawill

Thank you for suggesting it. I am aware of YTD. In fact, I installed it yesterday—but your suggestion may be helpful to others who, like me, struggle to make youtube-dl available under Android. I would love if I could use it from the command line, like youtube-dl. The latter has a number of great command line options that I frequently use.

My tablet is an unrooted Nexus 7 with Android 4.3.

I like to use Android terminal with /sdcard being the home directory. In ~/.mkshrc I set a number of environemental variables like augmented PATH, TEMP, VIM, VIMRUNTIME (I installed vim with compiled multi-byte support), TERMINFO (I point this variable to the /data/data/com.spartacusrex.spartacuside/files/system/etc/terminfo). I installed the Terminal IDE app for this purpose and in order to have busybox utilities available without necessity to root the device. I don't use Terminal IDE's embedded terminal emulator, however, or its vim, since neither supports UTF-8; also Terminal IDE's own wget seems to be basically useless, so I installed my own wget with SSL.

I keep my own executables in /data/data/jackpal.androidterm/bin, and various files like .viminfo — in /data/data/jackpal.androidterm. Only the .mkshrc and .vimrc files are kept in /sdcard which I find useful in case I am forced to open them and edit from a file manager or, to copy them to a PC.

@canamcy

This comment has been minimized.

Copy link

@canamcy canamcy commented Sep 30, 2013

I made my own runytdl.py which uses the python interpreter path and
raw_input to get the youtube-dl commands. I run it in sl4a scripts.

On Sun, Sep 29, 2013 at 7:11 PM, Mariusz-W notifications@github.com wrote:

@bazzawill https://github.com/bazzawill

Thank you for suggesting it. I am aware of YTD. In fact, I installed it
yesterday—but your suggestion may be helpful to others who, like me,
struggle to make youtube-dl available under Android. I would love if I
could use it from the command line, like youtube-dl. The latter has a
number of great command line options that I frequently use.

My tablet is an unrooted Nexus 7 with Android 4.3.

I like to use Android terminal with /sdcard being the home directory. In
~/.mkshrc I set a number of environemental variables like augmented PATH,
TEMP, VIM, VIMRUNTIME (I installed vim with compiled multi-byte support),
TERMINFO (I point this variable to the
/data/data/com.spartacusrex.spartacuside/files/system/etc/terminfo — I
installed the Terminal IDE app for this purpose, among others, but I don't
use its embedded terminal emulator, or its vim, since neither supports
UTF-8; also Terminal IDE's own wget seems to be useless — I installed my
own wget with SSL).

I keep my own executables in /data/data/jackpal.adroidterm/bin, and
various files like .viminfo, .mksh_history (HISTFILE) — in
/data/data/jackpal.adroidterm. Only .mkshrc and .vimrc files are kept in
/sdcard (they could be moved to the Android terminal root directory too,
of course).


Reply to this email directly or view it on GitHubhttps://github.com//issues/967#issuecomment-25331391
.

@Adrianzo

This comment has been minimized.

Copy link

@Adrianzo Adrianzo commented Oct 20, 2014

Tried running YoutubeDL.py in qpython but I get following error:
Traceback (most recent call last):
File ".last_tmp.py", line 25, in
from .utils import (
ValueError: Attempted relative import in non-package

Any ideas?

@phihag

This comment has been minimized.

Copy link
Collaborator

@phihag phihag commented Oct 20, 2014

@Adrianzo Don't run YouTubeDL.py, that's a core class. Run __main__.py.

@Adrianzo

This comment has been minimized.

Copy link

@Adrianzo Adrianzo commented Oct 20, 2014

Ok. Now it says...
Traceback (most recent call last):
File ".last_tmp.py", line 15, in
import youtube_dl
File
"/storage/emulated/0/com.hipipal.qpyplus/projects/youtube_dl/init.py",
line 93, in
from .options import (
File
"/storage/emulated/0/com.hipipal.qpyplus/projects/youtube_dl/options.py",
line 8, in
from .utils import (
File
"/storage/emulated/0/com.hipipal.qpyplus/projects/youtube_dl/utils.py",
line 7, in
import ctypes
ImportError: No module named ctypes

How can I add that module? It's not avaiable at
http://packages.qpython.org/?s=ctypes&submit=Search
On Oct 20, 2014 8:14 PM, "Philipp Hagemeister" notifications@github.com
wrote:

@Adrianzo https://github.com/Adrianzo Don't run YouTubeDL.py, that's a
core class. Run main.py.


Reply to this email directly or view it on GitHub
#967 (comment).

@phihag

This comment has been minimized.

Copy link
Collaborator

@phihag phihag commented Oct 21, 2014

@Adrianzo ctypes is part of the python stdlib, so check your Python installation. If ctypes is not present, you don't have a real Python running.

@Adrianzo

This comment has been minimized.

Copy link

@Adrianzo Adrianzo commented Oct 21, 2014

Hmm. I reinstalled both qpy 2 and 4. Same ctypes error on qpy 2 but I'm
getting this syntax error msg on qpy3:

ects3/youtube_dl/.last_tmp.py" <
Traceback (most recent call last):
File
"/storage/emulated/0/com.hipipal.qpyplus/projects3/youtube_dl/.last_tmp.py",
line 15, in
import youtube_dl
File
"/storage/emulated/0/com.hipipal.qpyplus/projects3/youtube_dl/init.py",
line 135
setproctitle(u'youtube-dl')
^
SyntaxError: invalid syntax

@Adrianzo https://github.com/Adrianzo ctypes is part of the python stdlib
https://docs.python.org/dev/library/ctypes.html, so check your Python
installation. If ctypes is not present, you don't have a real Python
running.


Reply to this email directly or view it on GitHub
#967 (comment).

@phihag

This comment has been minimized.

Copy link
Collaborator

@phihag phihag commented Oct 21, 2014

@Adrianzo It may sound strange, but qpy3 is an outdated version of Python. youtube-dl requires Python 2.6, 2.7, or 3.3+. qpython3 is using the horribly outdated (and long deprecated) 3.2. Please contact the qpy project and request ctypes and/or a recent version of Python.

@Adrianzo

This comment has been minimized.

Copy link

@Adrianzo Adrianzo commented Oct 21, 2014

Ok thanks for all the support. Really appreciate it.

Isn't any other way to run python software on Android?

I tried sl4a but didn't knew how to execute the code or load the
interpreter. After installing python I tried opening a terminal but I
didn't knew how to add py to my path... So I got the python not installed
error.

@cprior

This comment has been minimized.

Copy link

@cprior cprior commented Nov 15, 2014

Some people replied to this older thread.

Current youtube-dl is NOT compatible with SL4A anymore because 2.6.5 and higher seems to be required (or 3.3).

If anybody knows his to install this on an Android please let me know.

@phihag

This comment has been minimized.

Copy link
Collaborator

@phihag phihag commented Nov 15, 2014

@cprior While we do recommend a current version of Python and are hesitant to support really old versions of Python, youtube-dl 2014.11.15.1 works fine on Python 2.6.2 for me.

Can you provide any sources to your statement of (the current version of) youtube-dl not running on SL4A? If you encounter a bug, please report it.

@cprior

This comment has been minimized.

Copy link

@cprior cprior commented Nov 15, 2014

Wohoo, I was a day behind!

YES, it works now! (Just downloaded the latest version.)

Thanks for the heads-up!

@cprior

This comment has been minimized.

Copy link

@cprior cprior commented Nov 16, 2014

I confirm that with 2014-11-15.1 it is possible to link on an Android phone Tasker, AutoShare and Python into youtube-dl.
I have downloaded a first test video out of the YouTube app woth 'share' to a location on my SD card.

I will now implement (in Tasker) a basic 'queue' to 'download later when in WiFi'.

@Adrianzo

This comment has been minimized.

Copy link

@Adrianzo Adrianzo commented Nov 21, 2014

I'm still having troubles... At least I now got to a python 262 console
(thanks to standalone python shell script). But then... I cant run ytdl.
See:

u0_a422@t03g:/storage/emulated/0 $
e/emulated/0/sl4a/yt-dl/init.py<
'import site' failed; use -v for traceback
Traceback (most recent call last):
File "/storage/emulated/0/sl4a/yt-dl/init.py", line 6, in
import codecs
ImportError: No module named codecs
1|u0_a422@t03g:/storage/emulated/0 $
On Nov 16, 2014 6:32 AM, "cprior" notifications@github.com wrote:

I confirm that with 2014-11-15.1 it is possible to link on an Android
phone Tasker, AutoShare and Python into youtube-dl.
I have downloaded a first test video out of the YouTube app woth 'share'
to a location on my SD card.

I will now implement (in Tasker) a basic 'queue' to 'download later when
in WiFi'.


Reply to this email directly or view it on GitHub
#967 (comment).

@alseambusher

This comment has been minimized.

Copy link

@alseambusher alseambusher commented Jan 18, 2015

Here is a simple way to run youtube-dl on android:
http://lifepluslinux.blogspot.in/2015/01/how-to-use-youtube-dl-on-android.html

@Adrianzo it seems that python is not able to find the libraries in its path. Follow Step1 in the above link

@LoveSponge

This comment has been minimized.

Copy link

@LoveSponge LoveSponge commented Oct 12, 2015

i know it's been a while since the last time someone posted but i'm just trying this out on my HTC one M9 without root and a terminal emulator, i have python(r5) installed on it which i got from the website the last poster commented here; It installs fine, i have the unzipped youtube-dl on my local sdcard (not external) and i'm getting permission denied for ./youtube-dl ; i've tried running several different chmod commands in different places, still all the same, can someone who has had the same problem who managed to fix it please help!!! thanks in advance.

@yan12125

This comment has been minimized.

Copy link
Collaborator

@yan12125 yan12125 commented Oct 12, 2015

I've not tested it, while AFAIK either directly executing files or chmod is not allowed for SD cards. Try the following command:

/path/to/python ./youtube-dl
@LoveSponge

This comment has been minimized.

Copy link

@LoveSponge LoveSponge commented Oct 13, 2015

this is where ima sound like a complete n00b, i have no idea where my python is installed... i've looked on internal and external /android/. folders

@yan12125

This comment has been minimized.

Copy link
Collaborator

@yan12125 yan12125 commented Nov 11, 2015

@bossG Sorry for the late response. In many cases the Python binary locates somewhere in /data/. However, you need root priviledge for reading all files in this folder.

@yan12125

This comment has been minimized.

Copy link
Collaborator

@yan12125 yan12125 commented Nov 11, 2015

There's a command at http://stackoverflow.com/a/13780633/3786245. The author of that answer uses SL4A for the trick. I didn't try the command by my own, and I guess these parameters may not apply to the latest version of SL4A.

@codaman

This comment has been minimized.

Copy link

@codaman codaman commented Oct 19, 2016

is there any way to use youtube-dl on android app. There is 2 possible way first; add executable youtube-dl file to android project and run it with command codes second way add scripts to android project and run it. i succeed second way as running scripts on ios project. and also i cant use youtube-dl executable file on android project. i am searching a native example project that can run python codes

@tristan-k

This comment has been minimized.

Copy link

@tristan-k tristan-k commented Dec 11, 2016

@cprior Can your share this tasker project? Trying to do the same with Termux and youtube-dl.

I confirm that with 2014-11-15.1 it is possible to link on an Android phone Tasker, AutoShare and Python into youtube-dl.

@yan12125

This comment has been minimized.

Copy link
Collaborator

@yan12125 yan12125 commented Dec 11, 2016

Termux provides Python. You can apt-get install it and run youtube-dl following Linux/Mac ways.

@tristan-k

This comment has been minimized.

Copy link

@tristan-k tristan-k commented Dec 11, 2016

Already did that. I'm interessted in the tasker project to automate things.

@bdovaz

This comment has been minimized.

Copy link

@bdovaz bdovaz commented Jan 22, 2017

Any way to integrate it into an existing Android app? I mean, is there a way to run a python script from Java? I've been researching but haven't find anything useful yet.

@codaman

This comment has been minimized.

Copy link

@codaman codaman commented Feb 5, 2017

i ran python scripts in ios. It must be possible to run python scripts in android. I am searching a good example. If i will find out, i will share from here

@YECAPP

This comment has been minimized.

Copy link

@YECAPP YECAPP commented Feb 12, 2017

Final run ok for me, this is the code that running right

import sys,os
sys.path.append('/sdcard/youtube-dl')
import youtube_dl
os.chdir(r'/sdcard/Download')
youtube_dl.main(['sfR_HWMzgyc'])

Add os library to change directory if denied write permissions

Resume:
1)Install Python SL4A
2)Install Qpython
3)Add Script in Qpython
4)type or copy this code


import sys,os
sys.path.append('/sdcard/youtube-dl')
import youtube_dl
os.chdir(r'/sdcard/Download')
youtube_dl.main(['linkVideo'])

Where Link video is copy from youtube
5)download youtube-dl from web page https://youtube-dl.org/
6)transfer youtube-dl file to any directory in your phone, my dir is /sdcard/
7)run it !

Use this method if you are not root user

Update:
I have improved the code adding one input dialog to ask link video, I Share with you

import sys, os, androidhelper
sys.path.append('/sdcard/youtube-dl')
import youtube_dl
print os.getcwd()

os.chdir(r'/sdcard/Download')
print os.getcwd()
droid =androidhelper.Android()
yvideo= droid.dialogGetInput("enter video link")
print yvideo.result
youtube_dl.main([yvideo.result])

@madacol

This comment has been minimized.

Copy link

@madacol madacol commented Mar 4, 2020

Installing youtube-dl in Termux.

  • Install Termux (F-Droid | Play Store)
  • Run the command termux-setup-storage to let Termux access your user storage and accept the permission request
  • Run the command apt update && apt upgrade && apt install python ffmpeg && pip install youtube-dl
    this will update your package repo, upgrade outdated packages, install python and ffmpeg (important later on) and install youtube-dl using pip

More info: https://www.reddit.com/r/Piracy/comments/baufql/youtubedl_the_easy_way_on_android/

In that link is explained how to automate it, so you just share the link, and it starts downloading

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
You can’t perform that action at this time.