OS2 World Community Forum

OS/2, eCS & ArcaOS - Technical => Web applications => Topic started by: mauro on February 02, 2021, 11:57:12 pm

Title: clipgrab
Post by: mauro on February 02, 2021, 11:57:12 pm
Good evening, I've just downloaded/installed ClipGrab 3.7.2  by his rpm package (ANPM).
It starts, but after pasted a youtube video link in the field for downloading, it warns that link is not a valid one for video contents.
Has it maybe become obsolete due to a Youtube platform update against video grabbing?
Thank you
Title: Re: clipgrab
Post by: Dave Yeo on February 03, 2021, 01:28:29 am
Wouldn't be surprised if YouTube changed its API again. Also watch out for ampersands and such in the URL, IIRC you need to prune  the ampersand and following text off.
Title: Re: clipgrab
Post by: mauro on February 03, 2021, 07:07:53 pm
Thank you for answering Dave, no amperstands appear in the URL
Title: Re: clipgrab
Post by: TeLLie on February 03, 2021, 07:30:37 pm
Hi,
The version you downloaded is a bit outdated unfortunately.
The newer version of clipgrab needs webenginewidgets and that we dont have yet.
So  we need to wait till BWW have made it ready for us...

But  donations, are welcome for BWW, so they can further work on QT5 and more OS/2 based projects ....
Title: Re: clipgrab
Post by: mauro on February 06, 2021, 09:16:18 am
Hi,
The version you downloaded is a bit outdated unfortunately.
The newer version of clipgrab needs webenginewidgets and that we dont have yet.
So  we need to wait till BWW have made it ready for us...

But  donations, are welcome for BWW, so they can further work on QT5 and more OS/2 based projects ....

Understand, thank you
Title: Re: clipgrab
Post by: TeLLie on March 19, 2021, 08:25:44 pm
Hi,

I just compile the latest Clipgrab but unfortunately  it wont work with OS2 anymore.
ClipGrab uses youtube-dl in order to download videos from the Internet
And the Os2 python dont work with youtube-dl

So for now its a no go, sorry  :'(
Title: Re: clipgrab
Post by: Dave Yeo on March 19, 2021, 11:01:39 pm
Works here, after minor patching to disable CTYPES,
With a new clone from github,
Code: [Select]
K:\work\youtube-dl>python -m youtube_dl https://www.youtube.com/watch?v=JV7xHhvo
[youtube] JV7xHhvowGc: Downloading webpage
[download] Destination: taking Rubber band ball to pawn shop #shorts-JV7xHhvowGc
.f248.webm
[download] 100% of 18.23MiB in 00:1706MiB/s ETA 00:008
[download] Destination: taking Rubber band ball to pawn shop #shorts-JV7xHhvowGc.f251.webm
[download] 100% of 999.34KiB in 00:0013MiB/s ETA 00:001
[ffmpeg] Merging formats into "taking Rubber band ball to pawn shop #shorts-JV7xHhvowGc.webm"
Deleting original file taking Rubber band ball to pawn shop #shorts-JV7xHhvowGc.f248.webm (pass -k to keep)
Deleting original file taking Rubber band ball to pawn shop #shorts-JV7xHhvowGc.f251.webm (pass -k to keep)

Quick hack, needs work, likely just operating system changes like (if NT and !os2) but I have to look up the correct syntax.
Code: [Select]
diff --git a/youtube_dl/YoutubeDL.py b/youtube_dl/YoutubeDL.py
index 8f65c6499..0018c1a4a 100755
--- a/youtube_dl/YoutubeDL.py
+++ b/youtube_dl/YoutubeDL.py
@@ -109,8 +109,8 @@ from .postprocessor import (
 )
 from .version import __version__
 
-if compat_os_name == 'nt':
-    import ctypes
+#if compat_os_name == 'nt':
+#    import ctypes
 
 
 class YoutubeDL(object):
diff --git a/youtube_dl/compat.py b/youtube_dl/compat.py
index 6c3d49d45..d1a8feae6 100644
--- a/youtube_dl/compat.py
+++ b/youtube_dl/compat.py
@@ -4,7 +4,7 @@ from __future__ import unicode_literals
 import base64
 import binascii
 import collections
-import ctypes
+#import ctypes
 import email
 import getpass
 import io
diff --git a/youtube_dl/utils.py b/youtube_dl/utils.py
index 8e4d144c9..966d202eb 100644
--- a/youtube_dl/utils.py
+++ b/youtube_dl/utils.py
@@ -9,7 +9,7 @@ import calendar
 import codecs
 import collections
 import contextlib
-import ctypes
+#import ctypes
 import datetime
 import email.utils
 import email.header
@@ -3520,7 +3520,7 @@ def setproctitle(title):
 
     # ctypes in Jython is not complete
     # http://bugs.jython.org/issue2148
-    if sys.platform.startswith('java'):
+    if sys.platform.startswith('os2'):
         return
 
     try:

And of course packaging.
Title: Re: clipgrab
Post by: Dave Yeo on March 19, 2021, 11:17:25 pm
Tried running make, which failed due to no pandoc installed. It did package it somewhat, but running the script gives weirdness,
Code: [Select]
H:\tmp>python youtube-dl
Usage: youtube-dl [OPTIONS] URL [URL...]

youtube-dl: error: You must provide at least one URL.
Type youtube-dl --help to see a list of all options.

H:\tmp>python youtube_dl https://www.youtube.com/watch?v=JV7xHhvowGc
W:\USR\BIN\python.exe: can't open file 'youtube_dl': [Errno 2] No such file or directory

Note that the script seems to be zipped or such,
Code: [Select]
H:\tmp>file youtube-dl
youtube-dl: a /usr/bin/env python script executable (binary data)
Title: Re: clipgrab
Post by: Dave Yeo on March 19, 2021, 11:39:03 pm
Anyways for now, here's the unpackaged youtube-dl. Unluckily it is very CPU intensive while loading, taking almost a minute on this I5 before it does anything.
Create a directory, yt-down or whatever. Unzip the file. run python -m youtube-dl url or python -m youtube-dl --help | less to see the possible options.
Also doesn't seem to like to run on an HPFS volume, so use a JFS volume
Title: Re: clipgrab
Post by: TeLLie on March 20, 2021, 12:47:41 pm
Hi Dave

Thankz, will look if this works with clipgrab  :)

If i unzip it and run

E:\GCC\youtube-dl>python -m youtube-dl
C:/USR/BIN/python.exe: No module named youtube-dl
Title: Re: clipgrab
Post by: Dave Yeo on March 20, 2021, 04:59:07 pm
Did you run it in the parent of the youtube-dl subdirectory?  E:\GCC in your case.
Title: Re: clipgrab
Post by: Dariusz Piatkowski on March 20, 2021, 05:07:41 pm
TeLLie,
...If i unzip it and run

E:\GCC\youtube-dl>python -m youtube-dl
C:/USR/BIN/python.exe: No module named youtube-dl

I think the proper module name to run is actually 'YoutubeDL.py', at least that's what Dave has in his bundle...unless of course 'youtube-dl' is actually a clipgrab module name...not sure as I do not have clipgrab instaled here.
Title: Re: clipgrab
Post by: Dave Yeo on March 20, 2021, 05:43:45 pm
TeLLie,
...If i unzip it and run

E:\GCC\youtube-dl>python -m youtube-dl
C:/USR/BIN/python.exe: No module named youtube-dl

I think the proper module name to run is actually 'YoutubeDL.py', at least that's what Dave has in his bundle...unless of course 'youtube-dl' is actually a clipgrab module name...not sure as I do not have clipgrab instaled here.

It's the whole subdirectory that needs to be run, not an individual file. As I said, it is unpackaged and packaging should create a binary script holding the subdirectory and documentation.
Title: Re: clipgrab
Post by: TeLLie on March 20, 2021, 06:53:25 pm
Hi Dave,
I used youtube-dl all the time till i saw you called it youtube_dl :)
Now its working
E:\GCC\youtube-dl>python -m youtube_dl https://www.youtube.com/watch?v=U4_RFEY5WDA
[youtube] U4_RFEY5WDA: Downloading webpage
[download] Destination: Lady Gaga - Million Reasons _ Yoü and I _ The Edge of Glory live at One America Appeal-U4_RFEY5WDA.f136.mp4
[download] 100% of 72.14MiB in 00:07
[download] Destination: Lady Gaga - Million Reasons _ Yoü and I _ The Edge of Glory live at One America Appeal-U4_RFEY5WDA.f140.m4a
[download] 100% of 20.38MiB in 00:02
[ffmpeg] Merging formats into "Lady Gaga - Million Reasons _ Yoü and I _ The Edge of Glory live at One America Appeal-U4_RFEY5WDA.mp4"

Btw: python3 is much faster to use...
Title: Re: clipgrab
Post by: Dave Yeo on March 20, 2021, 07:05:34 pm
Yea, it looks like I screwed up with directions, the underline is correct. Good that it is working for you and I see you're getting good download speeds.
Title: Re: clipgrab
Post by: Paul Smedley on March 20, 2021, 10:19:46 pm
Btw: python3 is much faster to use...

My python3 build presumably? I should update it - I think with some fixes to readline, that readline.pyd should work now...
Title: Re: clipgrab
Post by: TeLLie on March 20, 2021, 11:15:48 pm
Hi Paul,

Sorry i should mention this.
Yes its you're python3 build :)
Title: Re: clipgrab
Post by: Dave Yeo on March 21, 2021, 12:16:23 am
Btw: python3 is much faster to use...

My python3 build presumably? I should update it - I think with some fixes to readline, that readline.pyd should work now...

Can you remind me of its URL?
Title: Re: clipgrab
Post by: Dariusz Piatkowski on March 21, 2021, 01:13:43 am
Hi Dave,

..It's the whole subdirectory that needs to be run, not an individual file. As I said, it is unpackaged and packaging should create a binary script holding the subdirectory and documentation...

Yup, I got it now...works great here!

So is this update something that's meant to be run from within clipgrab? Sorry, it may be obvious to those who have done it, I haven't run clipgrab in a while so before I go off installing it I figured I better ask first.

Thanks!
Title: Re: clipgrab
Post by: Paul Smedley on March 21, 2021, 01:15:55 am
Btw: python3 is much faster to use...

My python3 build presumably? I should update it - I think with some fixes to readline, that readline.pyd should work now...

Can you remind me of its URL?

See thread at https://www.os2world.com/forum/index.php/topic,2484.30.html
Title: Re: clipgrab
Post by: Dave Yeo on March 21, 2021, 04:28:03 am
Great, Python3 works much better then Python2 for youtube-dl, no patching to avoid the CTYPES error needed, much faster.
The script can be downloaded at https://youtube-dl.org/ (https://youtube-dl.org/), if you get the complete tar.gz, just extract the youtube-dl binary from the top folder of the package and run it. Generally the URL may need quoting with double quotes.
Title: Re: clipgrab
Post by: Dave Yeo on March 21, 2021, 04:35:10 am
Hi Dave,

..It's the whole subdirectory that needs to be run, not an individual file. As I said, it is unpackaged and packaging should create a binary script holding the subdirectory and documentation...

Yup, I got it now...works great here!

So is this update something that's meant to be run from within clipgrab? Sorry, it may be obvious to those who have done it, I haven't run clipgrab in a while so before I go off installing it I figured I better ask first.

Thanks!

Actually it is the recommended way to download videos with clipgrab being a frontend. See https://youtube-dl.org/ (https://youtube-dl.org/) and in particular the Documentation link to get an idea of its power.
Basically running python3 youtube-dl "URL" will download the video referenced in the URL and use FFmpeg to assemble the video and audio into a container that'll play in vlc, mplayer etc. Being Canadian, you can also legally use it to download music, without the video, from YouTube.
Note that the URL should generally be quoted with double quotes to work around shell characters such as ? or &

edit, simple way to get the script/binary,
Code: [Select]
wget https://yt-dl.org/downloads/latest/youtube-dl -O /usr/local/bin/youtube-dl
Adjust the path as needed after the -O