Commit 829e9421 authored by liyang's avatar liyang

fix:爬取youtube

parent f066fdea
...@@ -26,7 +26,8 @@ def convert_string_to_time(string): ...@@ -26,7 +26,8 @@ def convert_string_to_time(string):
weeks = int(string.split("周前")[0]) weeks = int(string.split("周前")[0])
converted_time = current_time - timedelta(weeks=weeks) converted_time = current_time - timedelta(weeks=weeks)
elif "月前" in string: elif "月前" in string:
months = int(string.split("月前")[0]) cleaned_string = re.sub(r'\D', '', string.split("月前")[0])
months = int(cleaned_string)
converted_time = current_time - timedelta(days=months * 30) converted_time = current_time - timedelta(days=months * 30)
elif "年前" in string: elif "年前" in string:
years = int(string.split("年前")[0]) years = int(string.split("年前")[0])
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment