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

Added support for Animeworld.tv #1182

Merged
merged 29 commits into from
Jul 12, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
3272fad
Add Animeworld page support
n4y0n Jun 19, 2022
f0ed12e
Add Animeworld player url
n4y0n Jun 19, 2022
a8c6468
Add Animeworld support
n4y0n Jun 19, 2022
8a6bb85
Add Animeworld to supported pages
n4y0n Jun 19, 2022
a391b16
Run linting tool
n4y0n Jun 20, 2022
c30a032
Updated css for Animeworld.tv
n4y0n Jun 20, 2022
90d423e
Merge branch 'MALSync:master' into animeworld
n4y0n Jun 20, 2022
9731bf0
Fix in Animeworld.tv
n4y0n Jun 20, 2022
da0e6cd
Merge branch 'animeworld' of https://github.com/n4y0n/MALSync into an…
n4y0n Jun 20, 2022
3241a4b
Updated tests for Animeworld.tv
n4y0n Jun 20, 2022
6734893
Merge branch 'MALSync:master' into animeworld
n4y0n Jun 20, 2022
727ebae
Changed getEpisode selector
n4y0n Jun 20, 2022
471eb63
Implemented getMalUrl
n4y0n Jun 20, 2022
4836343
Reverted back to master
n4y0n Jun 20, 2022
12ea5ce
getMalUrl always return mal url if available
n4y0n Jun 20, 2022
0dd5afc
Fix getMalUrl misunderstanding
n4y0n Jun 20, 2022
da58649
Fixed page match url
n4y0n Jun 21, 2022
77a776f
Merge branch 'MALSync:master' into animeworld
n4y0n Jun 23, 2022
673b36e
Added 9anime-like active episode overview
n4y0n Jun 27, 2022
84e229f
Merge branch 'animeworld' of https://github.com/n4y0n/MALSync into an…
n4y0n Jun 27, 2022
defcdc9
Fixed small bug when changing episode
n4y0n Jun 27, 2022
3d7a442
Merge branch 'MALSync:master' into animeworld
n4y0n Jul 3, 2022
ec0ff1e
disable hex rule
henrik9999 Jul 12, 2022
0d58176
Merge branch 'MALSync:master' into animeworld
n4y0n Jul 12, 2022
39c7963
fix some things in animeworld
henrik9999 Jul 12, 2022
91afbb5
narrow selector
henrik9999 Jul 12, 2022
8ace8cf
enable test
henrik9999 Jul 12, 2022
f7da495
fix overviewurl
henrik9999 Jul 12, 2022
c06b86b
fix test
henrik9999 Jul 12, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 2 additions & 1 deletion .stylelintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
"selector-class-pattern": null,
"selector-id-pattern": null,
"number-max-precision": null,
"custom-property-empty-line-before": "never"
"custom-property-empty-line-before": "never",
"color-hex-length": null
}
}
92 changes: 92 additions & 0 deletions src/pages/Animeworld/main.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
import { pageInterface } from '../pageInterface';

export const Animeworld: pageInterface = {
name: 'Animeworld',
domain: 'https://www.animeworld.tv',
languages: ['Italian'],
type: 'anime',
isSyncPage(url) {
if (url.split('/')[4] !== undefined && url.split('/')[4].length) {
return true;
}
return false;
},
sync: {
getTitle(url) {
return j.$('#anime-title').text().trim();
},
getIdentifier(url) {
return utils.urlPart(url, 4);
},
getOverviewUrl(url) {
return utils.absoluteLink(
j.$('div.server:not([style*="display: none"]) a[href*="/play"]').first().attr('href'),
Animeworld.domain,
);
},
getMalUrl(provider) {
const malUrl = j.$('#mal-button').attr('href');
if (malUrl) {
return malUrl;
}

if (provider === 'ANILIST') {
return j.$('#anilist-button').attr('href') || false;
}

return false;
},
getEpisode(url) {
return parseInt(
j.$('div.server a[href*="/play"].active').first().attr('data-episode-num') || '1',
);
},
uiSelector(selector) {
j.$('div.widget.player')
.first()
.after(
j.html(
`<div id="mal-sync-ui-selector" class="widget crop text-center">${selector}</div>`,
),
);
},
},
overview: {
getTitle(url) {
return '';
},
getIdentifier(url) {
return '';
},
uiSelector(selector) {
// no ui
},
list: {
offsetHandler: false,
elementsSelector() {
return j.$('div.server a[href*="/play"]');
},
elementUrl(selector) {
return utils.absoluteLink(selector.attr('href'), Animeworld.domain);
},
elementEp(selector) {
return Number(selector.attr('data-episode-num'));
},
},
n4y0n marked this conversation as resolved.
Show resolved Hide resolved
},
init(page) {
api.storage.addStyle(
// eslint-disable-next-line global-require
require('!to-string-loader!css-loader!less-loader!./style.less').toString(),
);
utils.fullUrlChangeDetect(() => {
page.reset();
j.$('#mal-sync-ui-selector').remove();
if (document.title.includes('Pagina non trovata')) {
con.error('404');
return;
}
page.handlePage();
});
},
};
5 changes: 5 additions & 0 deletions src/pages/Animeworld/meta.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"urls": {
"match": ["*://*.animeworld.tv/play/*"]
}
}
28 changes: 28 additions & 0 deletions src/pages/Animeworld/style.less
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
@import './../pages';

@activeEp: #002966 !important;

.mal-sync-active {
color: #ffffff !important;
}

#malp {
padding: 0% 2%;
margin: 1%;
}

#malp * {
color: black;
select option {
color: black;
background-color: white;
}
}

body.dark #malp * {
color: white;
select option {
color: white;
background-color: black;
}
}
17 changes: 17 additions & 0 deletions src/pages/Animeworld/tests.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"title": "animeworld",
"url": "https://www.animeworld.tv/",
"testCases": [
{
"url": "https://www.animeworld.tv/play/otome-game-sekai-wa-mob-ni-kibishii-sekai-desu.5z9UH/htfv9X",
"expected": {
"sync": true,
"title": "Otome Game Sekai wa Mob ni Kibishii Sekai desu",
"identifier": "otome-game-sekai-wa-mob-ni-kibishii-sekai-desu.5z9UH",
"overviewUrl": "https://www.animeworld.tv/play/otome-game-sekai-wa-mob-ni-kibishii-sekai-desu.5z9UH/htfv9X",
"episode": 1,
"uiSelector": true
}
}
]
}
2 changes: 2 additions & 0 deletions src/pages/pages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@ import { Animetoast } from './Animetoast/main';
import { MuitoManga } from './MuitoManga/main';
import { RealmScans } from './RealmScans/main';
import { LuminousScans } from './LuminousScans/main';
import { Animeworld } from './Animeworld/main';

export const pages = {
nineAnime,
Expand Down Expand Up @@ -272,4 +273,5 @@ export const pages = {
MuitoManga,
RealmScans,
LuminousScans,
Animeworld,
};
4 changes: 4 additions & 0 deletions src/pages/playerUrls.js
Original file line number Diff line number Diff line change
Expand Up @@ -725,4 +725,8 @@ module.exports = {
simplyaweeb: {
match: ['*://player.simplyaweeb.to/*'],
},
// animeworld
animeworld: {
match: ['*://www.animeworld.tv/api/episode/serverPlayerAnimeWorld?id=*'],
},
};