+ backported flashplayergit status

18l-fix
Dominika Liberda 2021-02-26 23:23:55 +01:00
parent d8517f545a
commit a42af1ceef
6 changed files with 170 additions and 4 deletions

View File

@ -1,2 +1,3 @@
cfg[title]='BashTube'
cfg[_cookies]='cookiejar'
cfg[flash_host]='flash.xn--domi-o5a.pl'

View File

@ -1,7 +1,15 @@
#router "/profile/:user" "app/webroot/index.shs"
#router "/uwu" "owo"
router "/watch" "${cfg[namespace]}/webroot/watch.shs"
router "/channel/:id" "${cfg[namespace]}/webroot/channel.shs"
router "/user/:user" "${cfg[namespace]}/webroot/channel.shs"
router "/playlist" "${cfg[namespace]}/webroot/playlist.shs"
if [[ "${r[host]}" == "${cfg[flash_host]}" ]]; then
router "/watch" "${cfg[namespace]}/webroot/watch_flash.shs"
else
router "/watch" "${cfg[namespace]}/webroot/watch.shs"
fi
echo "${r[host]}" > tmp

File diff suppressed because one or more lines are too long

8
webroot/player_flash.shs Executable file
View File

@ -0,0 +1,8 @@
url_="$(echo "$url" | xxd -ps | sed -E 's/.{2}/%&/g' | tr -d '\n')"
echo '<script>
(function() {
var fmt_url_map = "34%7C'"$url_"'"
var fmt_stream_map = fmt_url_map;
document.write("<embed height=\"38" + "5\" width=\"64" + "0\" type=\"application\/x-shockwave-flash\" src=\"http:\/\/f.sakamoto.pl\/watch-vfl168525.swf\" id=\"movie_player\" flashvars=\"rv.7.length_seconds=53&rv.2.thumbnailUrl=http%3A%2F%2Fi4.ytimg.com%2Fvi%2Fgkeiv_eNlxs%2Fdefault.jpg&rv.0.url=http%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3D4jbkRGPxvaM&rv.0.view_count=109338857&enablecsi=1&rv.2.title=Who+Is+The+Oldest+YouTuber%3F&rv.6.author=judsonlaipply&rv.3.view_count=204757&is_doubleclick_tracked=0&rv.4.thumbnailUrl=http%3A%2F%2Fi2.ytimg.com%2Fvi%2FY7dpJ0oseIA%2Fdefault.jpg&fmt_url_map=" + fmt_url_map + "&csi_page_type=watch&keywords=jawed%2Ckarim%2Celephant%2Czoo%2Cyoutube%2Cfirst%2Cvideo%2Cyakov%2Clapitsky&cr=US&cc3_module=http%3A%2F%2Fs.ytimg.com%2Fyt%2Fswf%2Fsubtitles3_module-vfl169211.swf&rv.6.thumbnailUrl=http%3A%2F%2Fi1.ytimg.com%2Fvi%2FdMH0bHeiRNg%2Fdefault.jpg&rv.3.rating=3.2731629393&fmt_list=34%2F0%2F9%2F0%2F115%2C5%2F0%2F7%2F0%2F0&rv.7.id=feGZ4l5fk4Q&iv_storage_server=http%3A%2F%2Fwww.google.com%2Freviews%2Fy%2F&rv.7.url=http%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DfeGZ4l5fk4Q&creator=jawed&rv.0.rating=2.5226886736&rv.4.rating=2.88055644388&rv.3.title=Oldest+Youtube+Video&rv.5.id=_OBlgSz8sSM&rv.2.view_count=101702&rv.0.featured=1&rv.0.id=4jbkRGPxvaM&cc_font=Arial+Unicode+MS%2C+arial%2C+verdana%2C+_sans&sdetail=p%3Awww.bookofjoe.com%2F2009%2F09%2F08%2Fi&rv.5.url=http%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3D_OBlgSz8sSM&rv.6.length_seconds=360&sourceid=r&timestamp=1275761040&rv.0.author=SHOWTIME&cc_asr=1&rv.2.author=creamofcardstv&rv.6.url=http%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DdMH0bHeiRNg&fmt_map=34%2F0%2F9%2F0%2F115%2C5%2F0%2F7%2F0%2F0&hl=en_US&rv.0.thumbnailUrl=http%3A%2F%2Fi1.ytimg.com%2Fvi%2F4jbkRGPxvaM%2Fdefault.jpg&rv.5.length_seconds=56&rv.0.length_seconds=200&referrer=http%3A%2F%2Fwww.bookofjoe.com%2F2009%2F09%2F08%2Findex.html&rv.3.thumbnailUrl=http%3A%2F%2Fi1.ytimg.com%2Fvi%2Fl2lnMbnBzuM%2Fdefault.jpg&rv.7.author=jawed&tts_watch_url=%2Fwatch_ajax%3Faction_get_caption_track_all%26v%3DjNQXAC9IVRw&rv.1.length_seconds=307&rv.3.id=l2lnMbnBzuM&rv.2.id=gkeiv_eNlxs&rv.2.length_seconds=163&t=vjVQa1PpcFNO0Qg-PCO7YpsFsZwwrE-J1ymhKZWUDAY%3D&rv.6.id=dMH0bHeiRNg&vq=auto&rv.6.view_count=144980590&rv.3.author=Melcland&rv.4.id=Y7dpJ0oseIA&ttsurl=http%3A%2F%2Fvideo.google.com%2Ftimedtext%3Fsparams%3Dcaps%252Cexpire%252Cv%26expire%3D1275786000%26caps%3Dasr%26key%3Dyttt1%26signature%3D8A6B1478FE76B2A937FB34E1F13D1AEE9DE0EA8B.2EC9BD41592AE7D79F5B7C9FB898BA8AD9619B1A&fexp=907011&rv.4.author=YouTube&rv.7.thumbnailUrl=http%3A%2F%2Fi3.ytimg.com%2Fvi%2FfeGZ4l5fk4Q%2Fdefault.jpg&allow_embed=1&fmt_stream_map=" + fmt_stream_map + "&rv.2.rating=3.49242424242&rv.7.title=Extremely+short+runway+747+takeoff&cc_load_policy=1&rv.1.url=http%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DuImk2RgCq_U&rv.1.id=uImk2RgCq_U&rv.6.title=Evolution+of+Dance+-+By+Judson+Laipply&rv.4.length_seconds=125&rv.7.view_count=4005023&rv.5.view_count=197773468&length_seconds=18&enablejsapi=1&video_id=jNQXAC9IVRw&plid=AASITEOh6RC4XUBh&iv_module=http%3A%2F%2Fs.ytimg.com%2Fyt%2Fswf%2Fiv_module-vfl168524.swf&rv.5.rating=4.61405687817&rv.4.url=http%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DY7dpJ0oseIA&rv.1.author=1nterwebs&rv.1.rating=4.70571010249&rv.4.title=YouTube&rv.5.thumbnailUrl=http%3A%2F%2Fi4.ytimg.com%2Fvi%2F_OBlgSz8sSM%2Fdefault.jpg&watermark=http%3A%2F%2Fs.ytimg.com%2Fyt%2Fswf%2Flogo-vfl106645.swf%2Chttp%3A%2F%2Fs.ytimg.com%2Fyt%2Fswf%2Fhdlogo-vfl100714.swf&rv.0.title=Lezberado%3A+Revenge+Fantasies&iv3_module=http%3A%2F%2Fs.ytimg.com%2Fyt%2Fswf%2Fiv3_module-vfl169211.swf&rv.7.rating=4.5715796897&rv.3.url=http%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3Dl2lnMbnBzuM&rv.2.url=http%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3Dgkeiv_eNlxs&ttslisturl=%2Fajax_timedtext%3FvideoId%3DjNQXAC9IVRw%26type%3Dlist&cc_module=http%3A%2F%2Fs.ytimg.com%2Fyt%2Fswf%2Fsubtitle_module-vfl167653.swf&ttstrackurl=%2Fajax_timedtext%3FvideoId%3DjNQXAC9IVRw%26type%3Dtrack%26lang%3Den%26name%3D&rv.4.view_count=296911&iv_load_policy=0&rv.1.view_count=172499&rv.5.title=Charlie+bit+my+finger+-+again+%21&rv.6.rating=4.66225384259&sk=2mqJTltP8SpOATYtW_nZrjNZASKI-NT4C&rv.1.title=The+20+oldest+Videos+on+Youtube&rv.1.thumbnailUrl=http%3A%2F%2Fi2.ytimg.com%2Fvi%2FuImk2RgCq_U%2Fdefault.jpg&rv.3.length_seconds=11&rv.5.author=HDCYT\" allowscriptaccess=\"always\" allowfullscreen=\"true\" bgcolor=\"#000000\" \/>");
})();
</script>'

View File

@ -81,7 +81,7 @@ if [[ "${get_data[v]}" ]]; then
# echo "<div><a href='/watch?v=$i'><img src='https://i.ytimg.com/vi/$i/mqdefault.jpg'></a><br></div>";
#done
vid="$(curl -s "https://www.youtube.com/watch?v=LACbVhgtx9I" -c cookiejar_)" # broken comment support, we need this for now
vid="$(curl -s "https://www.youtube.com/watch?v=${get_data[v]}" -c cookiejar_)" # broken comment support, we need this for now
echo "</div><h1>Comments</h1>"

149
webroot/watch_flash.shs Executable file
View File

@ -0,0 +1,149 @@
#!/bin/bash
if [[ "${get_data[v]}" ]]; then
if [[ "${get_data[v]}" == '18l' || "${get_data[v]}" == '5eFdt6Y_34E' ]]; then
uploader='MyMusicGroup'
title='█▬█ █ ▀█▀ Jeden Osiem L - Jak Zapomnieć (Oficjalny Teledysk)'
url='https://f.sakamoto.pl/videoplayback_.flv'
meta[title]="$title"
source templates/head.sh
else
cd temp
video=$(haruhi-dl --write-pages --cookies ${cfg[_cookies]} -J "http://youtube.com/watch?v=${get_data[v]}")
if [[ $video == '' ]]; then # okay who did this
video=$(haruhi-dl --write-pages --cookies ${cfg[_cookies]} -J "http://youtube.com/watch?v=${get_data[v]}")
if [[ $video == '' ]]; then # seriously WHO DID THIS
return
fi
fi
cd ..
#echo "http://youtube.com/watch?v=${get_data[v]}" > /dev/stderr
channel_id=$(jq -r '.channel_url' <<< "$video" | sed -s 's/http:\/\/www.youtube.com\/channel\///')
uploader=$(jq -r '.uploader' <<< "$video")
title=$(jq -r '.title' <<< "$video")
meta[title]="$title"
source templates/head.sh
IFS=$'\n'
urls=($(jq -r '.formats[] | select(.format_id == "22" or .format_id == "18").url' <<< "$video"))
unset IFS
if [[ ${urls[1]} != '' ]]; then
url=${urls[1]}
else
url=${urls[0]}
fi
fi
echo "<form action='search.shs'>
<input name='q' type='text'>
<input type='submit' value='Search'>
</form>
<div><br>"
source "${cfg[namespace]}/webroot/player_flash.shs"
#<video id='player' src='$url' controls></video>
echo "<h2>$title</h2>
<div>
<div>
Uploaded by <b><a href='/channel/$channel_id'>$uploader</a></b> on <b>$(date -d "$(echo $video | jq -r '.upload_date' | sed -E 's/..../&-/;s/....-../&-/')" "+%d %B %Y")</b>
</div>
<div>
<b>$(echo $video | jq -r '.view_count')</b> views<br>
<b>$(echo $video | jq -r '.like_count')</b> likes, <b>$(echo $video | jq -r '.dislike_count')</b> dislikes.<br>"
if [[ ${cookies[sh_session]} ]]; then
if [[ $(grep $(session_get_username "${cookies[sh_session]}") storage/faves | grep "${get_data[v]}") == '' ]]; then
echo "<a href='fav.shs?v=$(sed -s 's/<//g;' <<< "${get_data[v]}")' target='_blank'>Add to favourites</a><br>"
else
echo "<a href='unfav.shs?v=$(sed -s 's/<//g;' <<< "${get_data[v]}")' target='_blank'>Remove from favourites</a><br>"
fi
if [[ $(grep $(session_get_username "${cookies[sh_session]}") storage/subscribed | grep "$channel_id") == '' ]]; then
echo "<a href='subscribe.shs?id=$channel_id' target='_blank'>Subscribe to $uploader!</a><br>"
else
echo "<a href='unsubscribe.shs?id=$channel_id' target='_blank'>Unsubscribe from $uploader</a><br>"
fi
else
echo "<b><a href='/login.shs?r=$(echo ${r[url]} | sed -s 's/?/___/')'>Log in</a> to add this video to your favourites and/or subscribe to this channel!</b><br>"
fi
echo "<br><br>
</div>
</div>
<span><i>Description</i>:<br>$(echo "$video" | jq -r '.description' | sed -E 's/$/<br>/g')</span>
</div>";
vid="$(cat "temp/${get_data[v]}_https_-_"*"watch"*".dump")"
vid_json="$(tr -d '\n' <<< "$vid" | grep -Poh "ytInitialData.*?</script>" | sed 's/ytInitialData = //;s/<\/script>//')"
echo "<h1>Recommended</h1>
<div style='display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));'>"
jq -r '.contents.twoColumnWatchNextResults.secondaryResults.secondaryResults.results[] | .compactAutoplayRenderer.contents[0].compactVideoRenderer, .compactVideoRenderer | if .videoId != null then "<div><a href='"'"'/watch?v="+.videoId+"'"'"'><img src='"'"'https://i.ytimg.com/vi/"+.videoId+"/mqdefault.jpg'"'"'>"+.title.simpleText+"</a></div>" else empty end' <<< "$vid_json"
#for i in $(grep -ohE "watch\?v\=[A-zaz0-9]{11}" <<< "$vid" | cut -c 9-19 | uniq); do
# echo "<div><a href='/watch?v=$i'><img src='https://i.ytimg.com/vi/$i/mqdefault.jpg'></a><br></div>";
#done
vid="$(curl -s "https://www.youtube.com/watch?v=${get_data[v]}" -c cookiejar_)" # broken comment support, we need this for now
echo "</div><h1>Comments</h1>"
cont="$(echo "$vid" | grep -Poh 'continuation":".*?"' | sed -E 's/.*":"//g;s/"//g')"
CSRF="$(echo "$vid" | grep -Poh 'XSRF_TOKEN":".*?"' | sed -E 's/XSRF_TOKEN":"//g;s/"//g;s/\\u00/%/g')"
comments="$(curl -vvv 'https://www.youtube.com/comment_service_ajax?action_get_comments=1&pbj=1&ctoken='"$cont"'&continuation='"$cont" -H 'Accept: */*' -H 'Accept-Language: en-US,en;q=0.5' --compressed -H 'X-YouTube-Client-Name: 1' -H 'X-YouTube-Client-Version: 2.20201105.01.01' --data-raw 'session_token='"$CSRF" -b cookiejar_)"
IFS=$'\n'
comment_nick=($(jq -r '.response.continuationContents.itemSectionContinuation.contents[].commentThreadRenderer.comment.commentRenderer.authorText.simpleText' <<< "$comments"))
comment_published=($(jq -r '.response.continuationContents.itemSectionContinuation.contents[].commentThreadRenderer.comment.commentRenderer.publishedTimeText.runs[0].text' <<< "$comments"))
comment_likes=($(jq -r '.response.continuationContents.itemSectionContinuation.contents[].commentThreadRenderer.comment.commentRenderer.likeCount' <<< "$comments"))
comment_avatar=($(jq -r '.response.continuationContents.itemSectionContinuation.contents[].commentThreadRenderer.comment.commentRenderer.authorThumbnail.thumbnails[1].url' <<< "$comments"))
unset IFS
x=$(jq '.response.continuationContents.itemSectionContinuation.contents[].commentThreadRenderer.comment.commentRenderer.contentText.runs | map(.text)' <<< "$comments")
IFS=']'
for i in $x; do
comment_text+=($(echo "$i]" | jq -r 'join("")')) # sincerely, fsck [] shell expansion
done
for (( i=0; i<${#comment_nick[@]}; i++ )); do
echo "<div><img src='${comment_avatar[$i]}'>
<b>${comment_nick[$i]}</b> | ${comment_published[$i]} | ${comment_likes[$i]} liked<br>
<pre>${comment_text[$i]}</pre>
</div><hr>"
done
if [[ "${get_data[playlist]}" ]]; then
playlist=$(haruhi-dl --cookies ${cfg[_cookies]} -j --flat-playlist "https://www.youtube.com/playlist?list=${get_data[playlist]}")
IFS=$'\n'
video_title=($(jq -r '.title' <<< $playlist))
video_id=($(jq -r '.id' <<< $playlist))
for (( i=0; i<${#video_id[@]}; i++ )); do
if [[ "${video_id[$i]}" == "${get_data[v]}" ]]; then
next="${video_id[$((i+1))]}"
break
fi
done
[[ "$next" == '' ]] && next='dQw4w9WgXcQ'
echo "<script type='text/javascript'>
window.addEventListener('DOMContentLoaded', (event) => {
var video = document.getElementById('player');
// video.play();
video.addEventListener('ended',function(){
window.location = 'watch?v=$next&playlist=$(html_encode ${get_data[playlist]})';
});
});
</script>"
echo "<h1>Playlist</h1>"
for (( i=0; i<${#video_id[@]}; i++ )); do
echo "<a href='watch?v=${video_id[$i]}&playlist=$(html_encode ${get_data[playlist]})'><img src='http://i.ytimg.com/vi/${video_id[$i]}/mqdefault.jpg'><br>${video_title[$i]}</a><br>"
done
fi
echo "<script type='text/javascript' src='js/player.js'></script>"
else
source templates/head.sh
echo "pls add ?v param i'm still WiP"
fi