Adds a check for rate-limit

This commit is contained in:
Nemo 2020-04-22 18:31:37 +05:30
parent a2db89ddf7
commit c3722430e1
2 changed files with 68 additions and 0 deletions

spec/fixtures/ratelimit.html vendored Normal file
View File

@ -0,0 +1,65 @@
<!DOCTYPE html>
<html lang="en">
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Too Many Free PDF Requests</title>
body {
margin: 0;
padding: 0;
.page429 {
display: table;
width: 100%;
padding: 60px 30px;
box-sizing: border-box;
min-height: 350px;
font-family: sans-serif;
.page429 .int {
display: table-cell;
vertical-align: middle;
text-align: left;
padding-left: 30px;
.page429 h4 {
margin-bottom: 10px;
font-weight: 700;
font-size: 24px;
.page429 .logo {
display: table-cell;
width: 23%;
max-width: 182px;
vertical-align: middle;
.page429 .logo img {
max-width: 100%;
height: auto;
.page429 p {
font-weight: normal;
line-height: 1.3;
.page429 a {
text-decoration: none;
color: #284f84;
<div class="page429" id="main">
<div class="logo">
<a href=""><img src="/images/muselogo_notext.png" alt="MUSE logo"></a>
<div class="int">
<h4>Too Many Free PDF Requests</h4>
<p>Your IP has requested too many free PDFs too quickly.</p>
<p>Please wait before you continue downloading, and if possible slow down the rate of your requests.</p>

View File

@ -71,6 +71,9 @@ module Muse::Dl
if /Unable to/.match line
raise"Error: MUSE is unable to generate PDF for #{url}")
if /Your IP has requested/.match line
raise"Error: MUSE Rate-limit reached")