Last active
July 5, 2022 18:53
-
-
Save Pigpog/2c85ee4987d6d55069d34c850a30f190 to your computer and use it in GitHub Desktop.
KissCartoon.app scraper bash script using dmenu and mpv
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Your search on the kisscartoon website | |
query="$(echo "" | dmenu -p "Search:" | tr ' ' '+')"; | |
[ -z "$query" ] && exit; | |
# Each search result as HTML elements, containing names and URLs of shows | |
results="$(curl --silent "https://kisscartoon.app/?s=$query" | grep -F 'oldtitle')"; | |
# The name of the result you chose | |
chosenSeriesName="$(echo "$results" | cut -f10 -d\" | dmenu -i -l 10 -p "Pick a result")"; | |
[ -z "$chosenSeriesName" ] && exit; | |
# Get the URL of the result you selected | |
chosenSeriesUrl="$(echo "$results" | grep -F "$chosenSeriesName\"" | cut -f2 -d\")"; | |
# Get episode list and filter for episode link elements | |
episodes="$(curl --silent "$chosenSeriesUrl" | grep -F "les-title")"; | |
# If there are no episodes, you probably chose a movie | |
if [ -z "$episodes" ]; then | |
echo "you chose a movie" | |
# Use the movie URL | |
selectedUrl="$chosenSeriesUrl"; | |
else | |
# The name of the episode you selected | |
selectedEpisode="$(echo "$episodes" | cut -f3 -d\> | cut -f1 -d\< | dmenu -i -l 10)"; | |
[ -z "$selectedEpisode" ] && exit; | |
# Grab the URL for your choice in the episode list | |
selectedUrl="$(echo "$episodes" | grep -F "$selectedEpisode" | cut -f4 -d\")"; | |
fi | |
# Find the kisscartoon catalog ID of the episode | |
filmId=$(curl --silent "$selectedUrl" | grep -F "var filmId = " | cut -f2 -d\"); | |
# Query for the CDN's ID for the video | |
videoId="$(curl --silent "https://kisscartoon.app/ajax-get-link-stream/?server=youtu&filmId=$filmId" -H 'authority: kisscartoon.app' -H 'accept: */*' --compressed | cut -f2 -d\=)"; | |
# Get an m3u8 playlist of video pieces, and filter just the URLs | |
pieceUrls="$(curl --silent "https://lb.gogomovies.to/hls/$videoId/$videoId.m3u8" | grep -F "https")"; | |
for piece in $pieceUrls | |
do | |
curl --silent "$piece" -H 'Accept: */*' -H 'Connection: keep-alive' -H 'Origin: https://lb.gogomovies.to' --fail --fail-early --compressed || break; | |
done | mpv - | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment