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

error with youtube search if running python code directly #3489

Closed
gkreidl opened this issue Aug 11, 2014 · 6 comments
Closed

error with youtube search if running python code directly #3489

gkreidl opened this issue Aug 11, 2014 · 6 comments

Comments

@gkreidl
Copy link

@gkreidl gkreidl commented Aug 11, 2014

I prefer to use youtube-dl directly from python code on the Raspberry Pi for speed resaons (see http://www.raspberrypi.org/forums/viewtopic.php?f=38&t=83763 ).
This approach does not work with youtube search (but using the binary it works!). Verbose output:
youtube-dl -g --verbose 'https://www.youtube.com/results?search_query=raspberry+pi'
[debug] System config: []
[debug] User config: []
[debug] Command-line args: ['-g', '--verbose', 'https://www.youtube.com/results?search_query=raspberry+pi']
[debug] Encodings: locale 'UTF-8', fs 'UTF-8', out 'UTF-8', pref: 'UTF-8'
[debug] youtube-dl version 2013.12.26
[debug] Python version 2.7.3 - Linux-3.12.25+-armv6l-with-debian-7.6
[debug] Proxy map: {}
ERROR: Unable to download webpage: HTTP Error 403: Forbidden; please report this issue on https://yt-dl.org/bug . Be sure to call youtube-dl with the --verbose flag and include its complete output. Make sure you are using the latest version; type youtube-dl -U to update.
File "/usr/lib/python2.7/dist-packages/youtube_dl/extractor/common.py", line 182, in _request_webpage
return self._downloader.urlopen(url_or_request)
File "/usr/lib/python2.7/dist-packages/youtube_dl/YoutubeDL.py", line 1070, in urlopen
return self._opener.open(req)
File "/usr/lib/python2.7/urllib2.py", line 407, in open
response = meth(req, response)
File "/usr/lib/python2.7/urllib2.py", line 520, in http_response
'http', request, response, code, msg, hdrs)
File "/usr/lib/python2.7/urllib2.py", line 445, in error
return self._call_chain(_args)
File "/usr/lib/python2.7/urllib2.py", line 379, in _call_chain
result = func(_args)
File "/usr/lib/python2.7/urllib2.py", line 528, in http_error_default
raise HTTPError(req.get_full_url(), code, msg, hdrs, fp)

@phihag
Copy link
Contributor

@phihag phihag commented Aug 11, 2014

Your version of youtube-dl is outdated (plus, you seem not to actually have the linked post), since youtube-dl seems to be installed with apt-get or pip.

Try sudo apt-get remove -y youtube-dl; sudo rm -rf /usr/lib/python*/dist-packages/youtube_dl to remove the oudated apt-get version of youtube-dl. After then, simply follow the instructions given:

git clone git://github.com/rg3/youtube-dl
(cd youtube-dl && git pull)  # If you already have youtube-dl installed in the current directory
sudo ln -sf $(pwd)/youtube-dl/bin/youtube-dl /usr/bin/youtube-dl

After that, you can update with a simple git pull. In the youtube-dl directory.

@phihag phihag closed this Aug 11, 2014
@gkreidl
Copy link
Author

@gkreidl gkreidl commented Aug 11, 2014

I have a version from git and updated it with git pull

@phihag
Copy link
Contributor

@phihag phihag commented Aug 11, 2014

Excellent! So does it work now?

@gkreidl
Copy link
Author

@gkreidl gkreidl commented Aug 11, 2014

no. I was using that git version all along.

@phihag
Copy link
Contributor

@phihag phihag commented Aug 11, 2014

Can you humor me and post the output you get when running

sudo apt-get remove -y youtube-dl
sudo rm -rf /usr/lib/python*/dist-packages/youtube_dl 
hash -r
youtube-dl --version 
@phihag phihag reopened this Aug 11, 2014
@gkreidl
Copy link
Author

@gkreidl gkreidl commented Aug 11, 2014

Problem solved. I had an old version in the python dist directory. After removing that and creating a link to main.py it's now working. I'll update my tutorial in the Raspberry Pi forum accordingly.
Thanks for your help.

@phihag phihag closed this Aug 11, 2014
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
2 participants
You can’t perform that action at this time.