From dabe9c0c42b9ed7d3ef4fb0695cf40857a71eea4 Mon Sep 17 00:00:00 2001 From: Roland Reichwein Date: Wed, 17 Jun 2020 14:32:31 +0200 Subject: downtube 1.1: bugfixes --- downtube.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'downtube.cpp') diff --git a/downtube.cpp b/downtube.cpp index 6e45764..7fd8b66 100644 --- a/downtube.cpp +++ b/downtube.cpp @@ -52,7 +52,7 @@ namespace { const fs::path& getPath() const {return m_path;} }; - std::regex re{"https?://(www\\.youtube\\.com/watch\\?v=|youtu\\.be/)[[:alnum:]-]+", std::regex::extended}; // www.youtube.com/watch?v=ItjMIxS3-rI or https://youtu.be/ItjMIxS3-rI + std::regex re{"https?://(www\\.youtube\\.com/watch\\?v=|youtu\\.be/)[[:alnum:]_&=-]+", std::regex::extended}; // www.youtube.com/watch?v=ItjMIxS3-rI or https://youtu.be/ItjMIxS3-rI } // anonymous namespace @@ -113,6 +113,11 @@ int main(void) throw std::runtime_error("Bad URL"); } + // remove trailing "&..." + size_t and_pos {url.find('&')}; + if (and_pos != std::string::npos) + url = url.substr(0, and_pos); + //FCGX_FPrintF(request.out, "command: %s\r\n", command.c_str()); TempDir tempDir; -- cgit v1.2.3