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.
Improve error reporting when proxies mess with the page #10877
Comments
Unfortunately it's not smart at all, so only the first option is feasible. A better comment can be:
|
Before submitting an issue make sure you have:
What is the purpose of your issue?
Description of your issue, suggested solution and other information
When using proxies to get around geo-location, there is a risk that the proxy will return a page different from the page you expect. See, for example, issue #10873. Unfortunately the error message given by youtube-dl is actively misleading: the error message explicitly tells you to report it as a bug. It would be very helpful if youtube-dl was smarter about this situation. I don't know exactly what could be done, but I have some ideas:
if there is a proxy set, suggest that the user check whether the proxy is returning the right page before reporting it as a bug;
perhaps youtube-dl could recognise the most common examples (e.g. phpinfo page?) and report a better error: "use a different proxy, this one redirects to phpinfo";
how smart can youtube-dl get? is it capable of recognising that (say) a BBC url doesn't give a BBC page? It doesn't need to be 100% accurate, just accurate enough to avoid misleading the user and suggesting the problem is a bug in youtube-dl. I know there is a big gap between the ability of a human to recognise a re-directed page and what an application like youtube-dl can do, but it might be possible to close the gap even a little bit.
a really dumb test which might catch 90% of the cases:
from urlparse import urlparse
domain = urlparse(url).hostname
page = download(url)
if domain not in page:
# probably not on the real page, probably redirected to something unexpected