Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upGitHub is where the world builds software
Millions of developers and companies build, ship, and maintain their software on GitHub — the largest and most advanced development platform in the world.
[Youtube] HTTP Error 404: Not Found (caused by HTTPError()) on Python 2 #8918
Comments
|
It works for me here. Can you check it was not a transient error on YouTube or your ISP? |
|
Could you elaborate, please (e.g. command to run in terminal to check this)? If you mean is there any errors regardless internet connection itself, everything is working okay except |
|
Headers from accessing url by
I've remembered that around a month ago |
|
What I meant is that the video downloads fine here. You should probably wait for another team member to help you but, in the mean time, can you post here the program output if you add --dump-pages to the command you run? Thanks. |
I've changed url from |
|
Post the output of |
|
|
What's the output of |
|
Can you watch it in browser at all? |
Yes |
|
Made some code experiments import urllib2
response = urllib2.urlopen('https://www.youtube.com/watch?v=UdO7_GrRttM')
html = response.read()
print(html)
import urllib2
response = urllib2.urlopen('https://www.youtube.com/')
html = response.read()
print(html)<html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Ссылка заблокирована</title>
<style type="text/css">
<!--
H5 {font-size:15px; font-weight:normal; letter-spacing:1px; text-transform:uppercase; white-space:nowrap; margin-bottom:14px; font-weight:bold;}
BODY {color:#4d4d9f; font-size:13px; background: #FFFFFF; width: 99%;}
DIV.container {width:50%;margin-top:20px; margin:100px auto; background:#FFFFFF; border:3px solid #E42319; padding:10px; -moz-border-radius:20px; -khtml-border-radius: 20px; -webkit-border-radius: 20px; border-radius:20px;}
-->
</style>
</head>
<body>
<div class="container">
<center><img onerror="this.style.display='none';" src="http://img.ytapi.com/ttk.png">
<h5>Ссылка заблокирована!!!<br>в соответствии с законодательством РФ<br>Причина блокировки: <a href="http://blocklist.rkn.gov.ru/">blocklist.rkn.gov.ru</a></h5><br><br><a href="http://ttk.ru/">ЗАО "Компания ТрансТелеКом"</a>
</center></div>
<script type="text/javascript"> (function (d, w, c) { (w[c] = w[c] || []).push(function() { try { w.yaCounter33269963 = new Ya.Metrika({ id:33269963, clickmap:true, trackLinks:true, accurateTrackBounce:true }); } catch(e) { } }); var n = d.getElementsByTagName("script")[0], s = d.createElement("script"), f = function () { n.parentNode.insertBefore(s, n); }; s.type = "text/javascript"; s.async = true; s.src = "https://mc.yandex.ru/metrika/watch.js"; if (w.opera == "[object Opera]") { d.addEventListener("DOMContentLoaded", f, false); } else { f(); } })(document, window, "yandex_metrika_callbacks");</script><noscript><div><img src="https://mc.yandex.ru/watch/33269963" style="position:absolute; left:-9999px;" alt="" /></div></noscript>
</body></html>It says that url is blocked by the government (so now 404 makes sense), but somehow Any ideas how could python's |
|
python 3 is working ok import urllib.request
url = 'https://www.youtube.com/'
request = urllib.request.urlopen(url)
print(request.read())and, when I set python3 as the default python in the system (
|
|
Similar issue.
|
|
@abhigenie92 There's no need to escape special characters in quotation marks. The following command should work fine:
|
|
@ewnd9 thank you for the python3 trick. It worked for me for some reason. That's a Russian censorship related issue but I don't understand the mechanism of urllib2 failing. I can browse YouTube perfectly fine with browser but at some point youtube-dl started failing. In Ubuntu/Debian it's sufficient to uninstall youtube-dl and then install |
|
@rkfg As I see it now, I believe you can simply run |
Nope, tried it right after I found this issue here. The libraries are installed to /usr/local/lib/python2.7/dist-packages/ so they're not found by python3. Reinstall did the trick just fine. |
|
Thanks for the clarification |
Anything else I should attach?