fix(extractor): handle Uqload File Not Found
This commit is contained in:
parent
4598151034
commit
f0a66e1984
4 changed files with 124 additions and 0 deletions
|
|
@ -13,4 +13,8 @@ describe('Uqload', () => {
|
|||
test('uqload.net /embed-', async () => {
|
||||
expect(await extractorRegistry.handle(ctx, new URL('https://uqload.net/embed-z0xbr87oz637.html'))).toMatchSnapshot();
|
||||
});
|
||||
|
||||
test('file not found', async () => {
|
||||
expect(await extractorRegistry.handle(ctx, new URL('https://uqload.cx/2ua47fdfkjgd.html'))).toMatchSnapshot();
|
||||
});
|
||||
});
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
import * as cheerio from 'cheerio';
|
||||
import { NotFoundError } from '../error';
|
||||
import { Context, Format, Meta, UrlResult } from '../types';
|
||||
import { buildMediaFlowProxyExtractorRedirectUrl, supportsMediaFlowProxy } from '../utils';
|
||||
import { guessSizeFromMp4 } from '../utils/size';
|
||||
|
|
@ -24,6 +25,10 @@ export class Uqload extends Extractor {
|
|||
|
||||
const html = await this.fetcher.text(ctx, url, { headers });
|
||||
|
||||
if (/File Not Found/.test(html)) {
|
||||
throw new NotFoundError();
|
||||
}
|
||||
|
||||
const heightMatch = html.match(/\d{3,}x(\d{3,})/);
|
||||
|
||||
const $ = cheerio.load(html);
|
||||
|
|
|
|||
113
src/extractor/__fixtures__/Uqload/https:uqload.cx2ua47fdfkjgd.html
generated
Normal file
113
src/extractor/__fixtures__/Uqload/https:uqload.cx2ua47fdfkjgd.html
generated
Normal file
|
|
@ -0,0 +1,113 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8"/>
|
||||
<meta name=viewport content="width=device-width, initial-scale=1.0" />
|
||||
<title>Watch The Ultimate Free Video Hosting Solution for Webmasters and Bloggers</title>
|
||||
<meta name="description" content="Introducing Uqload: The Ultimate Free Video Hosting Solution for Webmasters and Bloggers. Say goodbye to limited storage and bandwidth constraints with Uqload. Enjoy unlimited storage, fastest HLS technology, customizable embedding, comprehensive analytics, monetization opportunities, top-notch security, and responsive customer support."/>
|
||||
<link rel="shortcut icon" href="/favicon.ico?v=0" type="image/x-icon"/>
|
||||
<link rel="stylesheet" type="text/css" href="https://uqload.cx/css/main.css?v=13"/>
|
||||
<link rel="stylesheet" type="text/css" href="https://uqload.cx/css/style.css"/>
|
||||
<script type="text/javascript" src="/js/modernizr.custom.04022.js"></script>
|
||||
<script language="JavaScript" type="text/javascript" CHARSET="UTF-8" src="https://uqload.cx/js/jquery.min.js?v=0"></script>
|
||||
<script language="JavaScript" type="text/javascript" CHARSET="UTF-8" src="https://uqload.cx/js/xupload.js?v=6"></script>
|
||||
<link rel="stylesheet" type="text/css" href="https://uqload.cx/css/bootstrap.min.css"/>
|
||||
<link rel="stylesheet" type="text/css" href="https://uqload.cx/css/bootstrap-theme.min.css"/>
|
||||
<script type="text/javascript" src="https://uqload.cx/js/bootstrap.min.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="https://uqload.cx/css/uqload_style.css?v=48"/>
|
||||
<link rel="stylesheet" type="text/css" href="https://uqload.cx/css/uqload_icons.css"/>
|
||||
<link href="https://fonts.googleapis.com/css?family=Roboto" rel="stylesheet"/>
|
||||
<link href="https://fonts.googleapis.com/css?family=Raleway:200,200i,300,300i,400,400i,500,500i,600,600i,700,700i,800,800i&subset=latin-ext" rel="stylesheet"/>
|
||||
<script type="text/javascript" src="https://uqload.cx/js/actions.js?v=9"></script>
|
||||
<!--<META NAME="keywords" CONTENT="file upload,share files,free upload"/>-->
|
||||
<!-- Global site tag (gtag.js) - Google Analytics -->
|
||||
<script async src="https://www.googletagmanager.com/gtag/js?id=G-49F5JJ5589"></script>
|
||||
|
||||
|
||||
<script>
|
||||
window.dataLayer = window.dataLayer || [];
|
||||
function gtag(){dataLayer.push(arguments);}
|
||||
gtag('js', new Date());
|
||||
|
||||
gtag('config', 'G-49F5JJ5589');
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<div class="container-fluid" id="main">
|
||||
<header class="row" id="header">
|
||||
<div class="mobile-menu"></div>
|
||||
<div class="col-md-3 col-sm-4">
|
||||
<a href="https://uqload.cx">
|
||||
<span class="top-logo"></span></a>
|
||||
</div>
|
||||
|
||||
<!--start menu-->
|
||||
<div class="col-md-9 col-sm-8 menu">
|
||||
<ul class="top-menu">
|
||||
|
||||
|
||||
<li><a href="https://uqload.cx/contact">Support</a></li>
|
||||
<li><a href="https://uqload.cx/login.html">Login</a></li>
|
||||
<li class="header-signup text-uppercase"><a href="https://uqload.cx/?op=registration">Sign Up</a></li>
|
||||
|
||||
|
||||
|
||||
<!--<li class="dropdown">
|
||||
<div id="language">
|
||||
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false"><span class="trf trf-english"></span> <span class="caret"></span></a>
|
||||
<ul class="dropdown-menu">
|
||||
|
||||
<li>
|
||||
<a href="https://uqload.cx/?op=change_lang&lang=2">
|
||||
<span class="trf trf-russian"></span><span class="langname">Russian</span>
|
||||
</a>
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
</div>
|
||||
</li>-->
|
||||
</ul>
|
||||
<div class="clearfix"></div>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<!--end menu-->
|
||||
</header> <!--end header-->
|
||||
<div class="row content">
|
||||
<div class="container">
|
||||
<b>File Not Found</b><br><br>
|
||||
<div style="width:500px;text-align:left;">
|
||||
The file you were looking for could not be found, sorry for any inconvenience.<br><br>
|
||||
Possible causes of this error could be:
|
||||
<ul>
|
||||
<li>The file expired
|
||||
<li>The file was deleted by its owner
|
||||
<li>The file was deleted by administration because it didn't comply with our Terms of Use
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div> <!--end conteiner-->
|
||||
<footer class="row">
|
||||
<div class="col-md-2 col-sm-2 copyright hidden-xs">© uqload 2017.</div>
|
||||
<div class="col-md-8 col-sm-8 footer-menu">
|
||||
<ul>
|
||||
<li><a href="https://uqload.cx">Home</a></li>
|
||||
|
||||
|
||||
<li><a href="https://uqload.cx/faq">FAQ</a></li>
|
||||
<li><a href="https://uqload.cx/tos">Terms of service</a></li>
|
||||
<li><a href="https://uqload.cx/dmca">DMCA</a></li>
|
||||
<li><a href="https://uqload.cx/copyright">Copyright Policy</a></li>
|
||||
|
||||
<li><a href="https://uqload.cx/make_money.html">Make Money</a></li>
|
||||
<li><a href="https://uqload.cx/checkfiles.html">Link Checker</a></li>
|
||||
<li><a href="https://uqload.cx/contact">Contact Us</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="col-md-2 col-sm-2 footer-logo hidden-xs"><a href="https://uqload.cx" class="foot-logo"></a></div>
|
||||
</footer>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -1,5 +1,7 @@
|
|||
// Jest Snapshot v1, https://jestjs.io/docs/snapshot-testing
|
||||
|
||||
exports[`Uqload file not found 1`] = `[]`;
|
||||
|
||||
exports[`Uqload uqload.net /embed- 1`] = `
|
||||
[
|
||||
{
|
||||
|
|
|
|||
Loading…
Reference in a new issue