This commit is contained in:
guanjihuan 2022-02-25 00:19:58 +08:00
parent c7260dc6e1
commit ff579a623d
2 changed files with 8 additions and 8 deletions

View File

@ -1,7 +1,7 @@
[metadata] [metadata]
# replace with your username: # replace with your username:
name = guan name = guan
version = 0.0.72 version = 0.0.73
author = guanjihuan author = guanjihuan
author_email = guanjihuan@163.com author_email = guanjihuan@163.com
description = An open source python package description = An open source python package

View File

@ -1791,7 +1791,7 @@ def play_academic_words(bre_or_ame='ame', random_on=0, show_translation=1, show_
if exist_directory == 0: if exist_directory == 0:
os.makedirs(directory) os.makedirs(directory)
soup = BeautifulSoup(html, features='lxml') soup = BeautifulSoup(html, features='lxml')
contents = re.findall('<h2>.*?<h2>', html, re.S) contents = re.findall('<h2>.*?</a></p>', html, re.S)
if random_on==1: if random_on==1:
random.shuffle(contents) random.shuffle(contents)
for content in contents: for content in contents:
@ -1817,12 +1817,12 @@ def play_academic_words(bre_or_ame='ame', random_on=0, show_translation=1, show_
pygame.mixer.init() pygame.mixer.init()
track = pygame.mixer.music.load(directory+word+'.mp3') track = pygame.mixer.music.load(directory+word+'.mp3')
pygame.mixer.music.play() pygame.mixer.music.play()
translation = re.findall('<p>.*?</p>', content, re.S)[0][3:-4]
if show_translation==1:
time.sleep(translation_time)
print(translation)
time.sleep(rest_time)
pygame.mixer.music.stop()
except: except:
pass pass
translation = re.findall('<p>.*?</p>', content, re.S)[0][3:-4]
if show_translation==1:
time.sleep(translation_time)
print(translation)
time.sleep(rest_time)
pygame.mixer.music.stop()
print() print()