fix(cache): problem caching
This commit is contained in:
parent
d1b9469342
commit
ab72ec9559
2 changed files with 13 additions and 14 deletions
|
|
@ -1,6 +1,6 @@
|
|||
local M = {}
|
||||
|
||||
local cache_file = vim.fn.stdpath("data") .. "/cp-contest-cache.json"
|
||||
local cache_file = vim.fn.stdpath("data") .. "/cp-nvim.json"
|
||||
local cache_data = {}
|
||||
|
||||
local function get_expiry_date(platform)
|
||||
|
|
|
|||
|
|
@ -27,20 +27,19 @@ def scrape(url: str) -> list[tuple[str, str]]:
|
|||
input_lines: list[str] = []
|
||||
output_lines: list[str] = []
|
||||
|
||||
for line_div in inp_pre.find_all("div", class_="test-example-line"):
|
||||
input_lines.append(line_div.get_text().strip())
|
||||
input_text_raw = inp_pre.get_text().strip().replace("\r", "")
|
||||
input_lines = [
|
||||
line.strip()
|
||||
for line in input_text_raw.split("\n")
|
||||
if line.strip()
|
||||
]
|
||||
|
||||
output_divs = out_pre.find_all("div", class_="test-example-line")
|
||||
if not output_divs:
|
||||
output_text_raw = out_pre.get_text().strip().replace("\r", "")
|
||||
output_lines = [
|
||||
line.strip()
|
||||
for line in output_text_raw.split("\n")
|
||||
if line.strip()
|
||||
]
|
||||
else:
|
||||
for line_div in output_divs:
|
||||
output_lines.append(line_div.get_text().strip())
|
||||
output_text_raw = out_pre.get_text().strip().replace("\r", "")
|
||||
output_lines = [
|
||||
line.strip()
|
||||
for line in output_text_raw.split("\n")
|
||||
if line.strip()
|
||||
]
|
||||
|
||||
if input_lines and output_lines:
|
||||
input_text = "\n".join(input_lines)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue