Viewing a single comment thread. View all comments

2

leftous wrote

Alright, if you're seriously not just a hooktube troll, I'll put some more work into it.

Right now, the code is essentially just a static html5 page that hits an instance of youtubedl api

<!DOCTYPE html>
<html>
  <head>
    <meta charset="UTF-8">
    <title>test</title>
  </head>
  <body>
	<div id="video_area">
	</div>
	<p>
	<h3>Source url:</h3>
	<textarea id="source_url" rows="3">
	</textarea>
	</p>
	
  </body>
  <script type="text/javascript">
    var httpRequest = new XMLHttpRequest();
	httpRequest.onreadystatechange = function (data) {
	  if(httpRequest.readyState === 4) {
		if(httpRequest.status === 200) { 
		  var resp = JSON.parse(httpRequest.responseText);
		  var source_url = resp.info.url;
		  document.getElementById('source_url').value = source_url;
		  document.getElementById('video_area').innerHTML 
		  = '<video controls>'
	    +'<source id="mp4" src="'+source_url+'">'
		+'</video> ';
		} else {
		  console.log(httpRequest.statusText);
		} 
	  }
	}
	var params = new URLSearchParams(location.search.slice(1));
	var yt_vid = "https://www.youtube.com/watch?v="+params.get('v').trim();
	var url = "https://youtdl.herokuapp.com/api/info?url="+yt_vid;
	httpRequest.open('GET', url);
	httpRequest.send();
	
</script>
</html>
2

imminent wrote

Mate, there's nothing stopping you from copying hooktube's whole html and css source code and make some necessary modifications to it to adapt it to the youtubedl server instance view-source:https://hooktube.com/ and view-source:https://hooktube.com/watch?v=NotReallyaCorrectValue

2

leftous wrote

I can certainly do that, but I'd have to take a closer look to make sure it's safe

2

imminent wrote (edited )

Here's something that may be better (for the time being),

  • Download all hooktube public source
  • Change all instances of https://hooktube.com/api to https://web.archive.org/save/_embed/https://hooktube.com/api
  • Delete the entry for popular videos on the front page
  • Edit marketing, delete fascist stuff
  • Harden it by adding security headers (no referrer policy, ...) and hashes checks for 3rd party scripts (change cloudflare's cdnjs with jsdeliver which is faster - but the best is to have the Decentraleyes addon installed)
  • Host it on github pages or gitlab pages,

That way while it still invokes the hooktube API there's the internet archive that acts as a proxy which is better than the current situation.

What do you think?

1

leftous wrote (edited )

It could be an issue with the way the code is licensed and I have no idea what is going on with their servers. It might be preferable to get the info myself from youtubes API to keep it free and safe.

2

imminent wrote

It could be an issue with the way the code is licensed and I have no idea what is going on with their servers. It might be preferable to get the info myself from youtubes API to keep it free and safe.

I only meant that as a temporary solution, you could then change the video API that is used to yours when it gets more advanced.