summaryrefslogtreecommitdiffhomepage
path: root/downtube.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'downtube.cpp')
-rw-r--r--downtube.cpp7
1 files changed, 6 insertions, 1 deletions
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;