jaimeMF / youtube-dl-api-server

A youtube-dl REST API server
https://youtube-dl-api-server.readthedocs.org/
The Unlicense
364 stars 212 forks source link

net::ERR_CONNECTION_REFUSED using youtube-web with localhost server #19

Open jotterbot opened 10 years ago

jotterbot commented 10 years ago

My steps:

$ "sudo apt-get update && sudo apt-get install git python-pip -y" $ "git clone https://github.com/jaimeMF/youtube-dl-api-server.git" $ "cd youtube-dl-api-server/" Per the docs here https://youtube-dl-api-server.readthedocs.org/en/latest/install.html I run: $ "sudo pip install -r requirements.txt" Output:

Downloading/unpacking youtube-dl>=2014.03.12 (from -r requirements.txt (line 1))
  Downloading youtube_dl-2014.06.19.tar.gz (384Kb): 384Kb downloaded
  Running setup.py egg_info for package youtube-dl

Downloading/unpacking flask (from -r requirements.txt (line 2))
  Downloading Flask-0.10.1.tar.gz (544Kb): 544Kb downloaded
  Running setup.py egg_info for package flask

    warning: no files found matching '*' under directory 'tests'
    warning: no previously-included files matching '*.pyc' found under directory 'docs'
    warning: no previously-included files matching '*.pyo' found under directory 'docs'
    warning: no previously-included files matching '*.pyc' found under directory 'tests'
    warning: no previously-included files matching '*.pyo' found under directory 'tests'
    warning: no previously-included files matching '*.pyc' found under directory 'examples'
    warning: no previously-included files matching '*.pyo' found under directory 'examples'
    no previously-included directories found matching 'docs/_build'
    no previously-included directories found matching 'docs/_themes/.git'
Downloading/unpacking Werkzeug>=0.7 (from flask->-r requirements.txt (line 2))
  Downloading Werkzeug-0.9.6.tar.gz (1.1Mb): 1.1Mb downloaded
  Running setup.py egg_info for package Werkzeug

    warning: no files found matching '*' under directory 'werkzeug/debug/templates'
    warning: no files found matching '*' under directory 'tests'
    warning: no previously-included files matching '*.pyc' found under directory 'docs'
    warning: no previously-included files matching '*.pyo' found under directory 'docs'
    warning: no previously-included files matching '*.pyc' found under directory 'tests'
    warning: no previously-included files matching '*.pyo' found under directory 'tests'
    warning: no previously-included files matching '*.pyc' found under directory 'examples'
    warning: no previously-included files matching '*.pyo' found under directory 'examples'
    no previously-included directories found matching 'docs/_build'
Downloading/unpacking Jinja2>=2.4 (from flask->-r requirements.txt (line 2))
  Downloading Jinja2-2.7.3.tar.gz (378Kb): 378Kb downloaded
  Running setup.py egg_info for package Jinja2

    warning: no files found matching '*' under directory 'custom_fixers'
    warning: no previously-included files matching '*' found under directory 'docs/_build'
    warning: no previously-included files matching '*.pyc' found under directory 'jinja2'
    warning: no previously-included files matching '*.pyc' found under directory 'docs'
    warning: no previously-included files matching '*.pyo' found under directory 'jinja2'
    warning: no previously-included files matching '*.pyo' found under directory 'docs'
Downloading/unpacking itsdangerous>=0.21 (from flask->-r requirements.txt (line 2))
  Downloading itsdangerous-0.24.tar.gz (46Kb): 46Kb downloaded
  Running setup.py egg_info for package itsdangerous

    warning: no previously-included files matching '*' found under directory 'docs/_build'
Downloading/unpacking markupsafe (from Jinja2>=2.4->flask->-r requirements.txt (line 2))
  Downloading MarkupSafe-0.23.tar.gz
  Running setup.py egg_info for package markupsafe

Installing collected packages: youtube-dl, flask, Werkzeug, Jinja2, itsdangerous, markupsafe
  Running setup.py install for youtube-dl

    Installing youtube-dl script to /usr/local/bin
  Running setup.py install for flask

    warning: no files found matching '*' under directory 'tests'
    warning: no previously-included files matching '*.pyc' found under directory 'docs'
    warning: no previously-included files matching '*.pyo' found under directory 'docs'
    warning: no previously-included files matching '*.pyc' found under directory 'tests'
    warning: no previously-included files matching '*.pyo' found under directory 'tests'
    warning: no previously-included files matching '*.pyc' found under directory 'examples'
    warning: no previously-included files matching '*.pyo' found under directory 'examples'
    no previously-included directories found matching 'docs/_build'
    no previously-included directories found matching 'docs/_themes/.git'
  Running setup.py install for Werkzeug

    warning: no files found matching '*' under directory 'werkzeug/debug/templates'
    warning: no files found matching '*' under directory 'tests'
    warning: no previously-included files matching '*.pyc' found under directory 'docs'
    warning: no previously-included files matching '*.pyo' found under directory 'docs'
    warning: no previously-included files matching '*.pyc' found under directory 'tests'
    warning: no previously-included files matching '*.pyo' found under directory 'tests'
    warning: no previously-included files matching '*.pyc' found under directory 'examples'
    warning: no previously-included files matching '*.pyo' found under directory 'examples'
    no previously-included directories found matching 'docs/_build'
  Running setup.py install for Jinja2

    warning: no files found matching '*' under directory 'custom_fixers'
    warning: no previously-included files matching '*' found under directory 'docs/_build'
    warning: no previously-included files matching '*.pyc' found under directory 'jinja2'
    warning: no previously-included files matching '*.pyc' found under directory 'docs'
    warning: no previously-included files matching '*.pyo' found under directory 'jinja2'
    warning: no previously-included files matching '*.pyo' found under directory 'docs'
  Running setup.py install for itsdangerous

    warning: no previously-included files matching '*' found under directory 'docs/_build'
  Running setup.py install for markupsafe

    building 'markupsafe._speedups' extension
    gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -I/usr/include/python2.7 -c markupsafe/_speedups.c -o build/temp.linux-x86_64-2.7/markupsafe/_speedups.o
    markupsafe/_speedups.c:12:20: fatal error: Python.h: No such file or directory
    compilation terminated.
========================================================================
    WARNING: The C extension could not be compiled, speedups are not enabled.
    Failure information, if any, is above.
    Retrying the build without the C extension now.
==========================================================================
    WARNING: The C extension could not be compiled, speedups are not enabled.
    Plain-Python installation succeeded.
==========================================================================
Successfully installed youtube-dl flask Werkzeug Jinja2 itsdangerous markupsafe
Cleaning up...

then I run: $ "python -m youtube_dl_server" * Running on http://localhost:9191/

Now when I point something like youtube-dl-web (https://github.com/jaimeMF/youtube-dl-web) to my localserver (hosted on same server as youtube-dl-api-server) and search for a youtube video in Chrome console I get:

GET http://localhost:9191/api/?url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3Dk-xSP_T0VqU net::ERR_CONNECTION_REFUSED jquery-latest.js:8706 send jquery-latest.js:8706 jQuery.extend.ajax jquery-latest.js:8136 jQuery.(anonymous function) jquery-latest.js:8282 jQuery.extend.getJSON jquery-latest.js:8265 BaseVideoInfo.get_info VideoInfo.js:14 processVideosURL processURL.js:37 processURLform processURL.js:43 onclick (index):47

Have you encountered this? The installation instructions are kind of .... sparse. Can you suggest what I may be doing wrong?

Thank you for your time!

jaimeMF commented 10 years ago

I have one question: are you accessing the webpage in the same computer where you run the server?

If you have specific suggestions about the documentation, feel free to open a new issue (or even better, a pull request with the proposed changes)

jotterbot commented 10 years ago

I have a copy of the youtube-dl-api-server and the youtube-dl-web running on the same server. I access it from another computer though. (I tried changing "localhost" to "my-server-ip-address" for example in processURL.js to see if that worked but it didn't).

Please don't take me to mean anything negative or ungrateful by my comments regarding documentation. I just think they could be more clear regarding config/setup.

Ideally it would be great to also include how to run the api server in the backround as a service (I understand that is probably well outside of the scope the documentation requires though).

I will happily amend the instructions to include what worked for me, if I can get it running. Cheers!

jaimeMF commented 10 years ago

I was going to suggest replacing localhost with your ip adress, but it seems it doesn't work. Maybe the problem is that the port is blocked, in which port are you running youtube-dl-web?