Skip to content

Commit

Permalink
NHentai | Fixed IMG urls (#63)
Browse files Browse the repository at this point in the history
* NHentai | Fixed IMG urls and added homepage popular monthly and all time sections

* version update

* Actually bruh moment

---------

Co-authored-by: TheNetsky <[email protected]>
  • Loading branch information
hammyo-o and TheNetsky authored Dec 11, 2024
1 parent 088ce72 commit 11042d4
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 8 deletions.
26 changes: 25 additions & 1 deletion src/NHentai/NHentai.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ import { popularTags } from './tags.json'
const NHENTAI_URL = 'https://nhentai.net'

export const NHentaiInfo: SourceInfo = {
version: '4.0.8',
version: '4.0.9',
name: 'nhentai',
icon: 'icon.png',
author: 'NotMarek & Netsky',
Expand Down Expand Up @@ -236,6 +236,30 @@ export class NHentai implements SearchResultsProviding, MangaProviding, ChapterP
containsMoreItems: true,
type: HomeSectionType.singleRowNormal
})
},
{
request: App.createRequest({
url: `${NHENTAI_URL}/api/galleries/search?query=${await this.generateQuery()}&sort=popular-month`,
method: 'GET'
}),
sectionID: App.createHomeSection({
id: 'popular-month',
title: 'Popular Monthly',
containsMoreItems: true,
type: HomeSectionType.singleRowNormal
})
},
{
request: App.createRequest({
url: `${NHENTAI_URL}/api/galleries/search?query=${await this.generateQuery()}&sort=popular`,
method: 'GET'
}),
sectionID: App.createHomeSection({
id: 'popular',
title: 'Popular All-Time',
containsMoreItems: true,
type: HomeSectionType.singleRowNormal
})
}
]

Expand Down
4 changes: 2 additions & 2 deletions src/NHentai/NHentaiInterfaces.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@

export interface ImagePageObject {
t: 'j' | 'p' | 'g';// JPG (≧◡≦)
t: 'j' | 'p' | 'g' | 'w';// JPG (≧◡≦)
w: number;
h: number;
}
Expand Down Expand Up @@ -107,5 +107,5 @@ export interface QueryResponse {
export interface RequestMetadata {
nextPage?: number;
maxPages?: number;
sort: 'popular-today' | 'popular-week' | 'popular' | '';
sort: 'popular-today' | 'popular-week' | 'popular-month' | 'popular' | '';
}
10 changes: 5 additions & 5 deletions src/NHentai/NHentaiParser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,10 @@ export const parseMangaDetails = (data: Gallery): SourceManga => {
titles: Object.values(data.title).filter(title => title !== null),
artist: artist,
author: artist,
image: `https://t.nhentai.net/galleries/${data.media_id}/cover.${typeOfImage(data.images.cover)}`,
image: `https://t3.nhentai.net/galleries/${data.media_id}/cover.${typeOfImage(data.images.cover)}`,
status: 'Completed',
tags: [App.createTagSection({ id: 'tags', label: 'Tags', tags: tags })],
desc: `Pages: ${data.num_pages}`
desc: `Pages: ${data.num_pages} | Favorites: ${data.num_favorites}`
})
})
}
Expand All @@ -55,7 +55,7 @@ export const parseChapterDetails = (data: Gallery, mangaId: string): ChapterDeta
mangaId: mangaId,
pages: data.images.pages.map((image, i) => {
const type = typeOfImage(image)
return `https://i.nhentai.net/galleries/${data.media_id}/${i + 1}.${type}`
return `https://i4.nhentai.net/galleries/${data.media_id}/${i + 1}.${type}`
})
})
}
Expand All @@ -73,10 +73,10 @@ export const parseSearch = (data: QueryResponse): PartialSourceManga[] => {

if (collectedIds.includes(gallery.id.toString())) continue
tiles.push(App.createPartialSourceManga({
image: `https://t.nhentai.net/galleries/${gallery.media_id}/cover.${typeOfImage(gallery.images.cover)}`,
image: `https://t3.nhentai.net/galleries/${gallery.media_id}/cover.${typeOfImage(gallery.images.cover)}`,
title: gallery.title.pretty,
mangaId: gallery.id.toString(),
subtitle: NHLanguages.getName(getLanguage(gallery))
subtitle: NHLanguages.getName(getLanguage(gallery)).substring(0, 3) + ' | Pgs: ' + gallery.num_pages
}))
collectedIds.push(gallery.id.toString())
}
Expand Down

0 comments on commit 11042d4

Please sign in to comment.