Skip to content

Commit

Permalink
Update search.js
Browse files Browse the repository at this point in the history
Refactor
  • Loading branch information
same31 authored Apr 2, 2018
1 parent 49dfe34 commit c3b8081
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions lib/search.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ function findSubtitles (body, languages) {
versionRegExp = /Version (.+?),([^]+?)<\/table/g,
versionMatch,
version,
hearingImpaired,
subInfoRegExp = /class="language">([^]+?)<a[^]+?(% )?Completed[^]+?href="([^"]+?)"><strong>(?:most updated|Download)/g,
subInfoMatch,
lang,
Expand All @@ -71,6 +72,7 @@ function findSubtitles (body, languages) {
// ===============================
while ((versionMatch = versionRegExp.exec(body)) !== null) {
version = versionMatch[1].toUpperCase();
hearingImpaired = ~versionMatch[2].indexOf('Hearing Impaired');

while ((subInfoMatch = subInfoRegExp.exec(versionMatch[2])) !== null) {
notCompleted = subInfoMatch[2];
Expand Down Expand Up @@ -100,7 +102,7 @@ function findSubtitles (body, languages) {

team = version.replace(/.?(REPACK|PROPER|[XH].?264|HDTV|480P|720P|1080P|2160P|AMZN|WEB(.DL|.?RIP)?|WR|BRRIP|BDRIP|BLURAY)+.?/g, '')
.trim().toUpperCase() || 'UNKNOWN';

subs.push({
lang: lang,
langId: langId,
Expand All @@ -109,7 +111,7 @@ function findSubtitles (body, languages) {
version: version,
link: link,
referer: referer,
hearingImpaired: versionMatch[2].includes("Hearing Impaired")
hearingImpaired: hearingImpaired
});
}
}
Expand Down

0 comments on commit c3b8081

Please sign in to comment.