First cummit.

This commit is contained in:
2023-03-28 10:11:14 +09:00
commit b92283ae9e
2 changed files with 64 additions and 0 deletions

47
README.md Normal file
View File

@ -0,0 +1,47 @@
# yt-linkifier
## Circumvents JewTube and BITCHute auto-embeds by turning them into links, thumbnails, and descriptions in a quote tag for use on web forums.
A little script made by Wrongthink (or BananaMulcher like how he's known as on The Crowhouse forum), with some adjustments done by me for portability sake.\
Also applied his adjustments to my adjustments as he specified in a reply.\
And also added 1 more adjustment, which is that it outputs files in the home directory regardless of where you execute it from.\
Forum thread in question: https://thecrowhouse.community/viewtopic.php?t=9430
To run, download this script into your home directory, then in the Terminal do this ONLY for the first time, no longer needed to do so afterwards:
```sh
chmod +x yt-linkifier
```
Then to run it:
```sh
~/yt-linkifier https://www.youtube.com/watch?v=27jKi-tlmwA
```
This will output a text file and thumbnails in the home directory which you can then use in for forum posts.\
You will only need to host the thumbnails somewhere, or attach them directly in threads/replies.
By the way, if you want to make it behave more like a normal command line program, add the following in your `.xinitrc` file (not sure for Wayland, but I don't care anyway).
```sh
export PATH=$PATH:~/.local/bin
```
Then create a `bin` folder in the `.local` folder if you haven't done so already.
```sh
mkdir -p ~/.local/bin
```
And move the file into that folder.
```sh
mv yt-linkifier ~/.local/bin
```
So now you can run it like this:
```sh
yt-linkifier https://www.youtube.com/watch?v=27jKi-tlmwA
```

17
yt-linkifier Normal file
View File

@ -0,0 +1,17 @@
#!/bin/sh
yttitle=$(yt-dlp -e "$1")
yt-dlp -o "$PWD/%(title)s.%(ext)s" --write-thumbnail --convert-thumbnails jpg --skip-download --write-description "$1"
mogrify -resize 640x360 ~/"$yttitle".jpg
#clickable link, comment out to disable
echo "[size=120][url=$(echo $1 | sed -e 's/m.youtube.com/yewtu.be/;s/www.youtube.com/yewtu.be/;s/youtu.be/yewtu.be/')]$yttitle[/url][/size]" > ~/"$yttitle".txt
#thumbnail image, comment out to disable
echo "[attachment=2]$yttitle.jpg[/attachment]" >> ~/"$yttitle".txt
#description quote, comment out to disable
echo "[quote]$(head -n 6 ~/$yttitle.description)...[/quote]" >> ~/"$yttitle".txt
rm -v "$yttitle".description
exit 0