ShareShortcuts

MangaDown

Download manga from Mangakakalot(https://mangakakalot.com)

wopson
Создать форк «MangaDown»

Создали что-то новое на основе этой команды? Поделитесь ей как форком: она станет вашей собственной командой, которой вы управляете, а обе страницы будут ссылаться друг на друга, чтобы wopson получил(а) признание.

  1. 1Получите команду и измените её в приложении «Быстрые команды». Дайте ей собственное название.
  2. 2Поделись ею из приложения «Быстрые команды» и скопируй ссылку iCloud.
  3. 3Вернись сюда, вставь ссылку и опиши, что изменилось, например: «Добавлен шаг, который использует Apple Intelligence для персонализации текста».
Загрузки
61K
Сохранено
2
Действия
257
Категория
Utilities
Версия
1.3
Язык
EN

Download manga from Mangakakalot.

Features:

  • Ability to search
  • Ability to download multiple chapters
  • Ability to visit the recent manga you've seen
  • Ability to make your most recent search
  • Ability to clear your manga history (recent search/manga)
  • Ability to choose the default app

Что нового

Версия 1.3

Default App Questions added

История версий
1.3 17 мар 2021 г.

Default App Questions added

1.2 14 мар 2021 г.

Fixed Image Grabbing method and Shortcut should function normally now

1.1 17 апр 2020 г.

Added import questions

1.0 17 апр 2020 г.

First release

Что делает

Действий: 257
  1. Comment
    Made with love /u/wet250 ( ͡° ͜ʖ ͡°)
  2. If
  3. Set Variable
    Passthrough
  4. If
  5. List
  6. Set Variable
    List
  7. Get File
  8. If
  9. Get Text from Input
  10. Match Text
  11. Set Variable
    Manga&URL
  12. Get Item from List
  13. Replace Text
  14. Text
  15. Add to Variable
  16. If
  17. Create Folder
  18. Get File
  19. If
  20. Get Text from Input
  21. Replace Text
  22. Text
  23. Add to Variable
  24. Text
  25. Add to Variable
  26. If
  27. Choose from List
  28. If
  29. Ask for Input
    Which manga?
  30. Save File
  31. Replace Text
  32. Set Variable
    SearchTerms
  33. URL
    https://mangakakalot.com/search/story/…
  34. If
  35. If
  36. Get Item from List
  37. Get URLs from Input
  38. Replace Text
  39. Run Shortcut
    MangaDown
  40. Stop This Shortcut
  41. If
  42. If
  43. Delete Files
  44. Delete Files
  45. Stop This Shortcut
  46. If
  47. URL
    https://mangakakalot.com/search/story/…
  48. Run Shortcut
    MangaDown
  49. Stop This Shortcut
  50. Comment
    If If result contains https://mangakakalot.com/manga or https://mangakakalot.com/read
  51. Match Text
  52. Count
  53. If
  54. Get File
  55. Match Text
  56. Set Variable
    LastMangaTemp
  57. Get Item from List
  58. Replace Text
  59. Replace Text
  60. Set Variable
    ChosenManga
  61. Get Item from List
  62. Set Variable
    MangaURL
  63. If
  64. Get Contents of URL
    …
  65. Make HTML from Rich Text
  66. Match Text
  67. Set Variable
    CheckPage
  68. Match Text
  69. Replace Text
  70. Get Item from List
  71. Set Variable
    TempSearchTerm
  72. Replace Text
  73. Set Variable
    SearchPage
  74. Replace Text
  75. Replace Text
  76. Match Text
  77. Get Group from Matched Text
  78. Replace Text
  79. Set Variable
    LatestChapter
  80. Count
  81. If
  82. If
  83. Show Result
  84. Nothing
  85. Run Shortcut
    MangaDown
  86. Stop This Shortcut
  87. Match Text
  88. Set Variable
    GroupedResults
  89. Get Group from Matched Text
  90. Set Variable
    NameResults
  91. Get Group from Matched Text
  92. Set Variable
    ImageResults
  93. Get URLs from Input
  94. Get Contents of URL
    …
  95. Repeat with Each
  96. Resize Image
  97. Base64 Encode
  98. Count
  99. Calculate
  100. If
  101. Get Item from List
  102. If
  103. Text
  104. Set Variable
    SetLatest
  105. Get Item from List
  106. Text
  107. Set Variable
    VcardList
  108. Get Variable
  109. If
  110. Match Text
  111. Count
  112. If
  113. Get URLs from Input
  114. Set Variable
    Next
  115. Text
  116. Add to Variable
  117. If
  118. Match Text
  119. Count
  120. If
  121. Get URLs from Input
  122. Set Variable
    Previous
  123. Text
  124. Add to Variable
  125. If
  126. Text
  127. Add to Variable
  128. If
  129. Combine Text
  130. Set Name
  131. Match Text
  132. Get Group from Matched Text
  133. Set Variable
    Current
  134. Set Variable
    DisplayCurrent
  135. Count
  136. If
  137. Number
  138. Set Variable
    DisplayCurrent
  139. If
  140. Match Text
  141. Match Text
  142. Count
  143. If
  144. Number
  145. Set Variable
    LastPageNum
  146. If
  147. Set Variable
    LastPageNum
  148. Comment
    Below action chooses the from list of manga
  149. Choose from List
  150. Get Details of Contacts
  151. Set Variable
    Name
  152. If
  153. Run Shortcut
    MangaDown
  154. Stop This Shortcut
  155. If
  156. If
  157. Run Shortcut
    MangaDown
  158. Stop This Shortcut
  159. If
  160. If
  161. Match Text
  162. Match Text
  163. Ask for Input
    Pages 1-…
  164. If
  165. Show Result
  166. URL
    https://mangakakalot.com/search/story/…?page=…
  167. Run Shortcut
    MangaDown
  168. Stop This Shortcut
  169. If
  170. If
  171. Show Result
  172. URL
    https://mangakakalot.com/search/story/…
  173. Run Shortcut
    MangaDown
  174. Stop This Shortcut
  175. If
  176. URL
    https://mangakakalot.com/search/story/…?page=…
  177. Run Shortcut
    MangaDown
  178. Stop This Shortcut
  179. If
  180. Replace Text
  181. Replace Text
  182. Set Variable
    ChosenManga
  183. Replace Text
  184. Set Variable
    Non-EscapedMangaName
  185. Match Text
  186. Get URLs from Input
  187. Get Item from List
  188. Set Variable
    MangaURL
  189. Text
  190. Save File
  191. Get URLs from Input
  192. Get Contents of URL
    …
  193. Make HTML from Rich Text
  194. Wait
  195. Match Text
  196. Set Variable
    ChapterPage
  197. Comment
    Below regex could be improved Crashes for manga with 100s of chapters UPDATE: Uses JavaScript to get chapters instead of shortcut actions
  198. Base64 Encode
  199. Text
  200. URL
    data:text/html,…

Посмотреть как код
Бета

Все действия этой команды, записанные на Cherri — языке программирования для приложения «Быстрые команды». Отлично подходит, чтобы разобраться, как она работает.

#include 'actions/web'
#include 'actions/text'
#define color orange
#define glyph openBook

/*
Made with love /u/wet250
( ͡° ͜ʖ ͡°)
*/

if ShortcutInput contains ShortcutInput {
	@Passthrough = ShortcutInput
} else {
	list("New Search")
	@List
	const File = getFileFromFolder(, "MangaDown/LastMangaRead.txt", false)
	if File contains File {
		getText(File)
		containsText(, "(.*)\n")
		@MangaURL
		getListItems(@MangaURL, 0, 0)
		replaceText("\n", "", true)
		@List += "Recent Manga ({})"
	} else {
		createFolder("MangaDown")
	}
	const File1 = getFile("MangaDown/LastSearch.txt", false)
	if File1 contains File1 {
		getText(File1)
		replaceText(" ", "_")
		@List += "Recent Search ({})"
		@List += "Clear History"
	} else {
	}
	const SelectedItem = chooseFromList(@List)
	if SelectedItem == "New Search" {
		const AskForInput = prompt("Which manga?")
		saveFile("MangaDown/LastSearch.txt", AskForInput, true)
		replaceText("\s", "_", AskForInput, true)
		@SearchTerms
		url("https://mangakakalot.com/search/story/{@SearchTerms}")
	} else {
		if SelectedItem contains "Recent Manga" {
			getRandomItem(@MangaURL)
			getURLs()
			const UpdatedText = replaceText("manganelo", "mangakakalot")
			const ShortcutResult = run("MangaDown", UpdatedText)
			stop()
		} else {
			if SelectedItem contains "Clear History" {
				deleteFiles(File)
				deleteFiles(File1)
				stop()
			} else {
				const URL = url("https://mangakakalot.com/search/story/{}")
				const ShortcutResult1 = run("MangaDown", URL)
				stop()
			}
		}
	}
}
// If If result contains https://mangakakalot.com/manga or https://mangakakalot.com/read

const Matches = containsText(@Passthrough, "https://mangakakalot.com/(read|manga)")
const Count = count(Matches)

if Count == 1 {
	getFile("MangaDown/LastMangaRead.txt")
	containsText(, "(.*)\n")
	@LastMangaTemp
	getListItems(@LastMangaTemp, 0, 0)
	replaceText("\s$", "", true)
	replaceText("^ ", "", true)
	@ChosenManga
	getListItems(@LastMangaTemp, 0, 0)
	@MangaURL
} else {
	const ContentsOfURL = formRequest(, "GET", {
		"searchword": "{@SearchTerms}"
	}, {})
	makeHTML(ContentsOfURL)
	containsText(, "<div class=\"panel_story_list\">(.*\n)*")
	@CheckPage
	containsText(@CheckPage, "https://mangakakalot.com/search/([^\?]*)")
	const UpdatedText1 = replaceText("https://mangakakalot.com/search/story/", "")
	getLastItem(UpdatedText1)
	@TempSearchTerm
	replaceText("<div style=\"clear: both\">(.*\n)*", "", @CheckPage, true)
	@SearchPage
	replaceText("</em>\n\s?<em class=\"story_chapter\">\n<a href=\".*\n.*", "", @SearchPage, true)
	replaceText("</em>\n\s?<em class=\"story_chapter\">\n<a rel=\"nofollow\" href=\".*\n.*", "", true)
	const Matches1 = containsText(, "<em class=\"story_chapter\">\n.*?<a.*\n(.*)")
	getMatchGroup(Matches1, 0)
	replaceText(" </a>", "")
	@LatestChapter
	const Count1 = count(@LatestChapter, "Items")
	if Count1 > 0 {
	} else {
		show("No results found for \"{@SearchTerms}\"!")
		nothing()
		const ShortcutResult2 = run("MangaDown", nil)
		stop()
	}
	containsText(@SearchPage, "<img src=\"([^\"]*)\" alt=\"([^\"]*)")
	@GroupedResults
	getMatchGroup(@GroupedResults, 2)
	@NameResults
	getMatchGroup(@GroupedResults, 0)
	@ImageResults
	getURLs(@ImageResults)
	const ContentsOfURL1 = downloadURL()
	for _ in ContentsOfURL1 {
		const ResizedImage = resizeImage(@RepeatItem, 132, 132)
		base64Encode(ResizedImage)
		const Count2 = count(@LatestChapter, "Items")
		const CalculationResult = Count2 + 1
		if @RepeatIndex < CalculationResult {
			getListItem(@LatestChapter, @RepeatIndex)
		} else {
		}
		@SetLatest = "N/A"
		getListItem(@NameResults, @RepeatIndex)
	}
	@VcardList = "BEGIN:VCARD\rVERSION:3.0\rN;CHARSET=utf-8:{};;;;\rORG:Latest: {@SetLatest};\rPHOTO;ENCODING=b:{}\rEND:VCARD"
	// TODO: Get Variable not supported: Assign variable here to '@CheckPage'.
	if @CheckPage contains "group_page" {
		const Matches2 = containsText(@CheckPage, "<a class=\"page_select\">\d+</a><a href=\"([^\"]*)\">")
		const Count3 = count(Matches2, "Items")
		if Count3 > 0 {
			getURLs(Matches2)
			@Next
			@VcardList += "BEGIN:VCARD\rVERSION:3.0\rN;CHARSET=utf-8:➡️ Next Page;;;;\rEND:VCARD"
		} else {
		}
		const Matches3 = containsText(@CheckPage, "<a href=\"([^\"]*)\">\d+</a><a class=\"page_select\">")
		const Count4 = count(Matches3, "Items")
		if Count4 > 0 {
			getURLs(Matches3)
			@Previous
			@VcardList += "BEGIN:VCARD\rVERSION:3.0\rN;CHARSET=utf-8:⬅️ Previous Page;;;;\rEND:VCARD"
		} else {
		}
		@VcardList += "BEGIN:VCARD\rVERSION:3.0\rN;CHARSET=utf-8:📄 Enter Page Number;;;;\rEND:VCARD"
	} else {
	}
	const CombinedText = joinText(@VcardList, "
")
	const SetName = setName(CombinedText, "Results.vcf")
	const Matches4 = containsText(@CheckPage, "<a class=\"page_select\">(\d+)<")
	getMatchGroup(Matches4, 0)
	@Current
	@DisplayCurrent = @Current
	const Count5 = count(@DisplayCurrent, "Items")
	if Count5 < 1 {
		@DisplayCurrent = 1
	} else {
	}
	containsText(@CheckPage, "Last\(\d+\)")
	const Matches5 = containsText(, "\d+")
	const Count6 = count(Matches5)
	if Count6 == 0 {
		@LastPageNum = 1
	} else {
		@LastPageNum = Matches5
	}
	// Below action chooses the from list of manga

	const SelectedItem1 = chooseFromList(SetName, "Search Results (Page #: {@DisplayCurrent} of {@LastPageNum}) ")
	const Name = getContactDetail(SelectedItem1, "Name")
	@Name = Name
	if Name == "➡️ Next Page" {
		const ShortcutResult3 = run("MangaDown", @Next)
		stop()
	} else {
		if Name == "⬅️ Previous Page" {
			const ShortcutResult4 = run("MangaDown", @Previous)
			stop()
		} else {
			if Name == "📄 Enter Page Number" {
				containsText(@CheckPage, "Last\(\d+\)")
				const TextMatches = containsText(, "\d+")
				const AskForInput1 = prompt("Pages 1-{TextMatches}", "Number")
				if AskForInput1 > TextMatches {
					show("Invalid Page Number!")
					const URL1 = url("https://mangakakalot.com/search/story/{@TempSearchTerm}?page={@Current}")
					const ShortcutResult5 = run("MangaDown", URL1)
					stop()
				} else {
					if AskForInput1 < 1 {
						show("Invalid Page Number!")
						const URL2 = url("https://mangakakalot.com/search/story/{@SearchTerms}")
						const ShortcutResult6 = run("MangaDown", URL2)
						stop()
					} else {
						const URL3 = url("https://mangakakalot.com/search/story/{@TempSearchTerm}?page={AskForInput1}")
						const ShortcutResult7 = run("MangaDown", URL3)
						stop()
					}
				}
			} else {
			}
		}
	}
	replaceText("(", "\(", @Name)
	replaceText(")", "\)")
	@ChosenManga
	replaceText("\", "", @ChosenManga)
	@NonEscapedMangaName
	containsText(@SearchPage, "<a rel=\"nofollow\" href=\"https://(mangakakalot|manganelo).com/([^\"]*)\">\n<img src=\"https://([^\"]*)\" alt=\"{@ChosenManga}\"")
	const URLs = getURLs()
	getFirstItem(URLs)
	@MangaURL
	const Text = "{@MangaURL}\n{@NonEscapedMangaName}\n"
	saveFile("MangaDown/LastMangaRead.txt", Text, true)
}
getURLs(@MangaURL)
const ContentsOfURL2 = downloadURL()
makeHTML(ContentsOfURL2)
wait(0)
containsText(, "(<div class=\"chapter-list\">|<div class=\"panel-story-chapter-list\">)(.*\n)*(<div class=\"comment-info\">|<div class=\"panel-story-comment panel-fb-comment a-h\">)")
@ChapterPage
/*
Below regex could be improved
Crashes for manga with 100s of chapters

UPDATE: Uses JavaScript to get chapters instead of shortcut actions
*/
base64Encode(@ChapterPage)
url("data:text/html,{}")
getWebpageContents()
const UpdatedText2 = replaceText("\s*\|\s*$", "", true)
splitText(UpdatedText2, "|")
@Chapters
count(@Chapters, "Items")
wait(0)
const ChosenItem = chooseFromList(@Chapters, "{} Chapters ", true)

for _ in ChosenItem {
	replaceText("(", "\(", @RepeatItem)
	replaceText(")", "\)")
	replaceText("[", "\[")
	replaceText("]", "\]")
	@ChosenChapter
	nothing()
	showNotification("Downloading...", "{@ChosenManga} - {@ChosenChapter}")
	const ScreenWidth = getDeviceDetail("Screen Width")
	@Width = ScreenWidth * 2
	containsText(@ChapterPage, "<a( rel=\"nofollow\" class=\"chapter-name text-nowrap\" |\s)?href=\"https://(mangakakalot|manganelo).com/chapter/([^\"]*)\"( title=\"[^\"]*\" |\s)?title=\"([^\"]*)\">{@ChosenChapter}<")
	getURLs()
	const ContentsOfURL3 = downloadURL()
	// Get content may return a 404

	makeHTML(ContentsOfURL3)
	containsText(, "(<div class=\"container-chapter-reader\">|<div class=\"vung-doc\" id=\"vungdoc\">).*\n.*")
	containsText(, "<img src=\"([^\"]*)")
	replaceText("<img src=\"", "")
	getURLs()
	const ContentsOfURL4 = downloadURL(, {
		"Referer": "https://manganelo.com/"
	})
	// Action above downloads images of the chapter. Another thing to consider is that I had to add a Referer header to “https://manganelo.com/“ or image links would direct me to an error 1040 page, preventing image download.

	for _ in ContentsOfURL4 {
		const Width = getImageDetail(@RepeatItem2, "Width")
		if Width > @Width {
			resizeImage(@RepeatItem2, @Width)
			@Images
		} else {
			@Images = @RepeatItem2
		}
	}
	const PDF = makePDF(@Images)
	setName(PDF, "{@ChosenManga} - {@ChosenChapter}")
	@MangaChapters
	@Images = "nil"
}

menu "What would you like to do?" {
item "Preview Files":
	quicklook(@MangaChapters)
	menu "Would you like to open all chapters in a single app?" {
	item "Yes":
		// Change app here

		for _ in @MangaChapters {
			openFile(@RepeatItem, false)
		}
		stop()
	item "No":
		stop()
	}
item "Open All Files in a Single App":
	for _ in @MangaChapters {
		// Change app here

		openFile(@RepeatItem, false)
	}
	stop()
}
Декомпилировано с помощью cherri 2.3.0 (GPL-2.0). Перед компиляцией могут понадобиться небольшие исправления.

Оценки и отзывы

Написать отзыв
–
из 5
★★★★★
★★★★
★★★
★★
★
0 ratings

Пока нет отзывов. Поделись мнением первым!

Реклама

Ещё от wopson

См. все

Вам также может понравиться

См. все
Реклама