Skip to content

Instantly share code, notes, and snippets.

@5j9
Last active February 24, 2021 09:13
Show Gist options
  • Save 5j9/9115c19ee4f01e2a20feaea6548328c6 to your computer and use it in GitHub Desktop.
Save 5j9/9115c19ee4f01e2a20feaea6548328c6 to your computer and use it in GitHub Desktop.
"""A simple script to unignore all the ignored words in a specific course in memrise.
You need to provide USERNAME, PASSWORD, and COURSE_URL below.
"""
from selenium.webdriver import Chrome
USERNAME = ''
PASSWORD = ''
COURSE_URL = 'https://app.memrise.com/course/{number}/{name}/'
driver = Chrome()
driver.implicitly_wait(5)
get = driver.get
get('https://app.memrise.com/signin')
select = driver.find_element_by_css_selector
selects = driver.find_elements_by_css_selector
select('#username').send_keys(USERNAME)
select('#password').send_keys(PASSWORD)
select('[type=submit]').click()
get(COURSE_URL)
ignored_text = select('.pull-right').text
if ignored_text == '0 ignored':
raise SystemExit('You have no ignored words on this course.')
print(ignored_text)
ignored = int(ignored_text.partition(' ')[0])
level_urls = [level.get_attribute('href') for level in selects('.level.clearfix')]
for level_url in level_urls:
get(level_url)
if (ignored_text := select('.pull-right').text) == '0 ignored':
continue
select('.ignore-show').click()
select('.ignore-none').click()
select('.ignore-save').click()
ignored -= int(ignored_text.partition(' ')[0])
if ignored == 0:
break
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment