Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Anime365 [RU] (fix #2376) #2384

Merged
merged 6 commits into from
May 14, 2024
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
118 changes: 118 additions & 0 deletions src/pages/Anime365/main.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,118 @@
import { urlPart } from '../../utils/general';
import { pageInterface } from '../pageInterface';

// const logger = con.m('Anime365', '#1b5e20');

function isNumeric(str: string) {
return !Number.isNaN(parseInt(str));
}

function isSlug(part: string) {
const slugArr = part.split('-');
return isNumeric(slugArr[slugArr.length - 1]);
}

export const Anime365: pageInterface = {
name: 'Anime365',
languages: ['Russian'],
domain: ['https://smotret-anime.com', 'https://anime365.ru', 'https://anime-365.ru'],
type: 'anime',
isSyncPage(url) {
// Example: https://smotret-anime.com/catalog/horimiya-24061/1-seriya-252417/angliyskie-subtitry-3494584
if (utils.urlPart(url, 5) !== '' && utils.urlPart(url, 3) === 'catalog') {
return true;
}
return false;
},
isOverviewPage(url) {
// Example: https://smotret-anime.com/catalog/uzaki-chan-wa-asobitai-21810
if (utils.urlPart(url, 5) === '' && utils.urlPart(url, 3) === 'catalog') {
return isSlug(urlPart(url, 4));
}
return false;
},
getImage() {
return utils.absoluteLink(
j.$('meta[property~="og:image"]').attr('content') ||
j.$('.m-catalog-item__poster img').attr('src'),
window.location.hostname,
);
},
// Parsing from page could be very buggy
overview: {
getTitle(url) {
return j.$('.card-content .line-2').clone().children().remove().end().text().trim();
NoPlagiarism marked this conversation as resolved.
Show resolved Hide resolved
},
getIdentifier(url) {
return utils.urlPart(url, 4);
},
getMalUrl(provider) {
const MalHref = j.$('.m-catalog-view-links a[href^="https://myanimelist.net/"]').attr('href');
if (MalHref) {
return MalHref;
}
return false;
},
uiSelector(selector) {
let resSelector = '<div class="card"><div class="card-content">';
resSelector += selector;
resSelector += '</div></div>';
j.$('.body-container > .section > .container > .row > .col:last-of-type > .card')
NoPlagiarism marked this conversation as resolved.
Show resolved Hide resolved
.first()
.after(j.html(resSelector));
},
},
sync: {
getTitle(url) {
return j.$('.card-content .line-2 a').clone().children().remove().end().text().trim();
},
getIdentifier(url) {
return Anime365.overview!.getIdentifier(url);
},
getOverviewUrl(url) {
return `https://${utils.urlPart(url, 2)}/catalog/${Anime365.sync.getIdentifier(url)}`;
},
getEpisode(url) {
const ep_meta = j.$('meta[property~="ya:ovs:episode"]');
if (ep_meta.length === 0) return 1;
const ep_str = ep_meta.attr('content');
return parseInt(ep_str || '1');
},
getMalUrl(provider) {
return Anime365.overview!.getMalUrl!(provider);
},
nextEpUrl(url) {
const rightIcon = j.$('.m-select-sibling-episode .waves-effect:has(i.right)');
if (rightIcon.length > 0)
return utils.absoluteLink(rightIcon.attr('href'), window.location.hostname);
return undefined;
},
uiSelector(selector) {
Anime365.overview!.uiSelector!(selector);
},
},
init(page) {
api.storage.addStyle(
require('!to-string-loader!css-loader!less-loader!./style.less').toString(),
);
utils.urlChangeDetect(() => {
utils.waitUntilTrue(
() => {
return (
j.$('.body-container > .section > .container > .row > .col:last-of-type > .card')
NoPlagiarism marked this conversation as resolved.
Show resolved Hide resolved
.length > 0
);
},
() => {
j.$(() => {
page.reset();
page.handlePage();
});
},
);
});
j.$(() => {
page.handlePage();
});
},
};
10 changes: 10 additions & 0 deletions src/pages/Anime365/meta.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"search": "https://smotret-anime.com/catalog/search?q={searchtermPlus}",
"urls": {
"match": [
"*://smotret-anime.com/catalog/*",
"*://anime365.ru/catalog/*",
"*://anime-365.ru/catalog/*"
]
}
}
25 changes: 25 additions & 0 deletions src/pages/Anime365/style.less
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
@import './../pages';

.flash {
background-color: transparent !important;
}

#malStatus,
#malTotal,
#malEpisodes,
#malUserRating,
#malVolumes,
#malTotalVol,
#malTotalCha {
color: inherit !important;
}

#malRating,
#AddMal {
color: #039be5;
}

#malRating:hover,
#AddMal:hover {
color: #01579b;
}
22 changes: 22 additions & 0 deletions src/pages/Anime365/tests.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"title": "Anime365",
"url": "https://smotret-anime.com",
"testCases": [
{
"url": "https://smotret-anime.com/catalog/genres",
NoPlagiarism marked this conversation as resolved.
Show resolved Hide resolved
"expected": {
"sync": false
}
},
{
"url": "https://smotret-anime.com/catalog/horimiya-24061/10-seriya-254224/russkie-subtitry-3626417",
"expected": {
"sync": true,
"title": "Horimiya",
"identifier": "horimiya-24061",
"episode": 10,
"overviewUrl": "https://smotret-anime.com/catalog/horimiya-24061"
}
}
]
}
2 changes: 2 additions & 0 deletions src/pages/pages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ import { MangaPark } from './MangaPark/main';
import { AnimesHouse } from './AnimesHouse/main';
import { AnimeXin } from './AnimeXin/main';
import { MonosChinos } from './MonosChinos/main';
import { Anime365 } from './Anime365/main';
import { AnimeFire } from './AnimeFire/main';
import { OtakuFR } from './OtakuFR/main';
import { mangatx } from './mangatx/main';
Expand Down Expand Up @@ -170,6 +171,7 @@ export const pages = {
AnimesHouse,
AnimeXin,
MonosChinos,
Anime365,
AnimeFire,
OtakuFR,
mangatx,
Expand Down
8 changes: 8 additions & 0 deletions src/pages/playerUrls.js
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,14 @@ module.exports = {
aniboom: {
match: ['*://aniboom.one/*'],
},
// Anime365
anime365: {
match: [
'*://smotret-anime.com/translations/embed/*',
'*://anime365.ru/translations/embed/*',
'*://anime-365.ru/translations/embed/*',
],
},
// kickassanime
animopacestream: {
match: ['*://animo-pace-stream.io/*'],
Expand Down
Loading