Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def login_check(html):
if '<a href="/user/login">' in html:
raise PauseDownloadError("You didn't login")
</a>
def check_login(html, url):
if not re.search('"loggedin":true', html, re.I):
raise PauseDownloadError("you didn't log in!")
path_each(
self.savepath.parent(),
lambda file: self.checksums.add(get_file_checksum(file))
)
checksum = get_checksum(self.image_bin)
if checksum in self.checksums:
raise LastPageError
else:
self.checksums.add(checksum)
try:
content_write(self.savepath.full_fn(self.get_filename(), self.image_ext), self.image_bin)
except OSError:
traceback.print_exc()
raise PauseDownloadError("Failed to write file!")
print("Start downloading " + mission.title)
mission.state = "DOWNLOADING"
try:
crawl(mission, savepath)
# Check if mission is complete
for ep in mission.episodes:
if not ep.complete and not ep.skip:
raise Exception("Mission is not completed")
except WorkerExit:
mission.state = "PAUSE"
download_ch.pub('DOWNLOAD_PAUSE', mission)
raise
except PauseDownloadError as err:
mission.state = "ERROR"
download_ch.pub('DOWNLOAD_INVALID', (err, mission))
except Exception as err:
mission.state = "ERROR"
download_ch.pub('DOWNLOAD_ERROR', (err, mission))
raise
else:
mission.state = "FINISHED"
download_ch.pub("DOWNLOAD_FINISHED", mission)
def check_login(html):
if html[6:10] == "JFIF":
raise PauseDownloadError("You didn't login!")
def check_login_html(html):
if "pixiv.user.loggedIn = true" not in html and "login: 'yes'" not in html:
raise PauseDownloadError("you didn't login!")
def check_login(data):
if not data.get("userData"):
raise PauseDownloadError("you didn't login!")