fix(scraper): multi-letter codeforces problems
This commit is contained in:
parent
10a9ff1e4c
commit
d1b9469342
2 changed files with 21 additions and 1 deletions
|
|
@ -11,6 +11,11 @@ local function ensure_io_directory()
|
|||
vim.fn.mkdir("io", "p")
|
||||
end
|
||||
|
||||
local function check_internet_connectivity()
|
||||
local result = vim.system({ "ping", "-c", "1", "-W", "3", "8.8.8.8" }, { text = true }):wait()
|
||||
return result.code == 0
|
||||
end
|
||||
|
||||
local function setup_python_env()
|
||||
local plugin_path = get_plugin_path()
|
||||
local venv_dir = plugin_path .. "/.venv"
|
||||
|
|
@ -50,6 +55,13 @@ function M.scrape_contest_metadata(platform, contest_id)
|
|||
}
|
||||
end
|
||||
|
||||
if not check_internet_connectivity() then
|
||||
return {
|
||||
success = false,
|
||||
error = "No internet connection available",
|
||||
}
|
||||
end
|
||||
|
||||
if not setup_python_env() then
|
||||
return {
|
||||
success = false,
|
||||
|
|
@ -119,6 +131,14 @@ function M.scrape_problem(ctx)
|
|||
}
|
||||
end
|
||||
|
||||
if not check_internet_connectivity() then
|
||||
return {
|
||||
success = false,
|
||||
problem_id = ctx.problem_name,
|
||||
error = "No internet connection available",
|
||||
}
|
||||
end
|
||||
|
||||
if not setup_python_env() then
|
||||
return {
|
||||
success = false,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue