Compare commits
No commits in common. "d171f34e4eb4d57b7ee7ff96716856ff030eee9c" and "25f48592c0c49b0475513cdb9bd40619754c5ad0" have entirely different histories.
d171f34e4e
...
25f48592c0
@ -57,7 +57,6 @@ Tranga can download Chapters and Metadata from "Scanlation" sites such as
|
|||||||
- [MangaDex.org](https://mangadex.org/)
|
- [MangaDex.org](https://mangadex.org/)
|
||||||
- [Manganato.com](https://manganato.com/)
|
- [Manganato.com](https://manganato.com/)
|
||||||
- [Mangasee](https://mangasee123.com/)
|
- [Mangasee](https://mangasee123.com/)
|
||||||
- [MangaKatana](https://mangakatana.com)
|
|
||||||
- ❓ Open an [issue](https://github.com/C9Glax/tranga/issues)
|
- ❓ Open an [issue](https://github.com/C9Glax/tranga/issues)
|
||||||
|
|
||||||
and automatically import them with [Komga](https://komga.org/) and [Kavita](https://www.kavitareader.com/). Also Notifications will be sent to your devices using [Gotify](https://gotify.net/) and [LunaSea](https://www.lunasea.app/).
|
and automatically import them with [Komga](https://komga.org/) and [Kavita](https://www.kavitareader.com/). Also Notifications will be sent to your devices using [Gotify](https://gotify.net/) and [LunaSea](https://www.lunasea.app/).
|
||||||
|
@ -504,30 +504,8 @@ public static class Tranga_Cli
|
|||||||
Chapter[] availableChapters = connector.GetChapters(publication, "en");
|
Chapter[] availableChapters = connector.GetChapters(publication, "en");
|
||||||
int cIndex = 0;
|
int cIndex = 0;
|
||||||
Console.WriteLine("Chapters:");
|
Console.WriteLine("Chapters:");
|
||||||
|
|
||||||
System.Text.StringBuilder sb = new();
|
|
||||||
foreach(Chapter chapter in availableChapters)
|
foreach(Chapter chapter in availableChapters)
|
||||||
{
|
Console.WriteLine($"{cIndex++}: Vol.{chapter.volumeNumber} Ch.{chapter.chapterNumber} - {chapter.name}");
|
||||||
sb.Append($"{cIndex++}: ");
|
|
||||||
|
|
||||||
if(string.IsNullOrWhiteSpace(chapter.volumeNumber) == false)
|
|
||||||
{
|
|
||||||
sb.Append($"Vol.{chapter.volumeNumber} ");
|
|
||||||
}
|
|
||||||
|
|
||||||
if(string.IsNullOrWhiteSpace(chapter.chapterNumber) == false)
|
|
||||||
{
|
|
||||||
sb.Append($"Ch.{chapter.chapterNumber} ");
|
|
||||||
}
|
|
||||||
|
|
||||||
if(string.IsNullOrWhiteSpace(chapter.name) == false)
|
|
||||||
{
|
|
||||||
sb.Append($" - {chapter.name}");
|
|
||||||
}
|
|
||||||
|
|
||||||
Console.WriteLine(sb.ToString());
|
|
||||||
sb.Clear();
|
|
||||||
}
|
|
||||||
|
|
||||||
Console.WriteLine("Enter q to abort");
|
Console.WriteLine("Enter q to abort");
|
||||||
Console.WriteLine($"Select Chapter(s):");
|
Console.WriteLine($"Select Chapter(s):");
|
||||||
|
@ -341,13 +341,6 @@ public abstract class Connector
|
|||||||
logger?.WriteLine(this.GetType().ToString(), $"Request-Error {response.StatusCode}: {response.ReasonPhrase}");
|
logger?.WriteLine(this.GetType().ToString(), $"Request-Error {response.StatusCode}: {response.ReasonPhrase}");
|
||||||
return new RequestResult(response.StatusCode, Stream.Null);
|
return new RequestResult(response.StatusCode, Stream.Null);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Request has been redirected to another page. For example, it redirects directly to the results when there is only 1 result
|
|
||||||
if(response.RequestMessage is not null && response.RequestMessage.RequestUri is not null)
|
|
||||||
{
|
|
||||||
return new RequestResult(response.StatusCode, response.Content.ReadAsStream(), true, response.RequestMessage.RequestUri.AbsoluteUri);
|
|
||||||
}
|
|
||||||
|
|
||||||
return new RequestResult(response.StatusCode, response.Content.ReadAsStream());
|
return new RequestResult(response.StatusCode, response.Content.ReadAsStream());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -355,21 +348,12 @@ public abstract class Connector
|
|||||||
{
|
{
|
||||||
public HttpStatusCode statusCode { get; }
|
public HttpStatusCode statusCode { get; }
|
||||||
public Stream result { get; }
|
public Stream result { get; }
|
||||||
public bool HasBeenRedirected { get; }
|
|
||||||
public string? RedirectedToUrl { get; }
|
|
||||||
|
|
||||||
public RequestResult(HttpStatusCode statusCode, Stream result)
|
public RequestResult(HttpStatusCode statusCode, Stream result)
|
||||||
{
|
{
|
||||||
this.statusCode = statusCode;
|
this.statusCode = statusCode;
|
||||||
this.result = result;
|
this.result = result;
|
||||||
}
|
}
|
||||||
|
|
||||||
public RequestResult(HttpStatusCode statusCode, Stream result, bool hasBeenRedirected, string redirectedTo)
|
|
||||||
: this(statusCode, result)
|
|
||||||
{
|
|
||||||
this.HasBeenRedirected = hasBeenRedirected;
|
|
||||||
RedirectedToUrl = redirectedTo;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -30,14 +30,6 @@ public class MangaKatana : Connector
|
|||||||
if ((int)requestResult.statusCode < 200 || (int)requestResult.statusCode >= 300)
|
if ((int)requestResult.statusCode < 200 || (int)requestResult.statusCode >= 300)
|
||||||
return Array.Empty<Publication>();
|
return Array.Empty<Publication>();
|
||||||
|
|
||||||
// If a single result is found, the user will be redirected to the results directly instead of a result page
|
|
||||||
if(requestResult.HasBeenRedirected
|
|
||||||
&& requestResult.RedirectedToUrl is not null
|
|
||||||
&& requestResult.RedirectedToUrl.Contains("mangakatana.com/manga"))
|
|
||||||
{
|
|
||||||
return new Publication[] { ParseSinglePublicationFromHtml(requestResult.result, requestResult.RedirectedToUrl.Split('/')[^1]) };
|
|
||||||
}
|
|
||||||
|
|
||||||
return ParsePublicationsFromHtml(requestResult.result);
|
return ParsePublicationsFromHtml(requestResult.result);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -121,14 +113,9 @@ public class MangaKatana : Connector
|
|||||||
while (description.StartsWith('\n'))
|
while (description.StartsWith('\n'))
|
||||||
description = description.Substring(1);
|
description = description.Substring(1);
|
||||||
|
|
||||||
int year = DateTime.Now.Year;
|
|
||||||
string yearString = infoTable.Descendants("div").First(d => d.HasClass("updateAt"))
|
string yearString = infoTable.Descendants("div").First(d => d.HasClass("updateAt"))
|
||||||
.InnerText.Split('-')[^1];
|
.InnerText.Split('-')[^1];
|
||||||
|
int year = Convert.ToInt32(yearString);
|
||||||
if(yearString.Contains("ago") == false)
|
|
||||||
{
|
|
||||||
year = Convert.ToInt32(yearString);
|
|
||||||
}
|
|
||||||
|
|
||||||
return new Publication(sortName, authors.ToList(), description, altTitles, tags.ToArray(), posterUrl, coverFileNameInCache, links,
|
return new Publication(sortName, authors.ToList(), description, altTitles, tags.ToArray(), posterUrl, coverFileNameInCache, links,
|
||||||
year, originalLanguage, status, publicationId);
|
year, originalLanguage, status, publicationId);
|
||||||
|
Loading…
Reference in New Issue
Block a user