Youtube Video URL Access to X was denied -


i'm creating youtube downloader , have issues link.

basically entered this song , program gave me this.

i'm pretty sure missing in link because saying "access r6---sn-oxu8pnpvo-ua8z.googlevideo.com denied".

i have tried other videos , every video giving access denied aswell.

how can fix link? missing? !

youtube.cpp

std::string decode_url(std::string str) { std::string ret; char ch; int i, ii, len = str.length();  (i=0; < len; i++){     if(str[i] != '%')     {         if(str[i] == '+')             ret += ' ';         else             ret += str[i];     }     else     {         sscanf(str.substr(i + 1, 2).c_str(), "%x", &ii);         ch = static_cast<char>(ii);         ret += ch;         = + 2;     } }  return ret; }  youtube::youtube() { std::cout << "youtube url:"; std::cin >> youtube::link;  youtube::id = youtube::link;  youtube::get_id(); youtube::get_info();  youtube::read_video_info(); };   void youtube::get_id() { size_t found = youtube::id.find("=");  if(found != std::string::npos)     youtube::id.erase(youtube::id.begin(), youtube::id.begin() + found + 1); else {     std::cout << "link not valid!";     youtube::remove_video_info();     exit(exit_failure); } }  void youtube::get_info() { std::string download = "wget -o youtube_page.txt http://www.youtube.com/get_video_info?video_id=" + youtube::id; system(download.c_str()); }  void youtube::read_video_info() { std::string mylines, line; std::ifstream file("youtube_page.txt");  if(file.is_open()) {     while(getline(file, line))         mylines += line;      link = mylines;      file.close(); } else {     std::cout << "unable find youtube_page.txt";     youtube::remove_video_info();     exit(exit_failure); }  youtube::get_stream_map(); }  void youtube::get_stream_map() { size_t url = link.find("url_encoded_fmt_stream_map");  if(url != std::string::npos)     link.erase(link.begin(), link.begin() + url); else {     std::cout << "could not find video !";     youtube::remove_video_info();     exit(exit_failure); }  size_t stop = link.find("&");  if(stop != std::string::npos)     link.erase(link.begin() + stop, link.end()); else {     std::cout << "error has occurd !";     youtube::remove_video_info();     exit(exit_failure); }  std::string decoded = link;  for(int = 0; < 3; i++)     decoded = decode_url(decoded);  size_t decoded_url = decoded.find("&url=");  if(decoded_url != std::string::npos)     decoded.erase(decoded.begin(), decoded.begin() + decoded_url); else {     std::cout << "error has occured !";     youtube::remove_video_info();     exit(exit_failure); }  size_t decoded_stop = decoded.find(";");  if(decoded_stop != std::string::npos)     decoded.erase(decoded.begin() + decoded_stop, decoded.end()); else {     std::cout << "error has occured !";     youtube::remove_video_info();     exit(exit_failure); }  decoded.erase(0, 5);  youtube::link = decoded;  youtube::download_video();  void youtube::download_video() { std::string url_download = "wget '" + link + "'"; system(url_download.c_str());  }  youtube::~youtube() { youtube::remove_video_info(); }  void youtube::remove_video_info() { if(remove("youtube_page.txt") != 0)     std::cout << "\ndeleting youtube_page.txt !"; } 

youtube.h

std::string decode_url(std::string str);  class youtube { private: std::string link; std::string id;  void get_id(); void get_info(); void read_video_info(); void get_stream_map(); void download_video(); void remove_video_info();  public: youtube(); ~youtube(); }; 


Comments

Popular posts from this blog

ios - MKAnnotationView layer is not of expected type: MKLayer -

ZeroMQ on Windows, with Qt Creator -

unity3d - Unity SceneManager.LoadScene quits application -