youtube video url series backtracking
Say you find a link to a youtube video on a forum. It's a link to part five of i don't know how many parts. Until recently, I'd pop the URL into links (the only safe non-popup non-clutter way to look at modern/current web sites) and find the URL to part 1, and all the others. and then use youtube-dl on part one and then assess and decide if I wanted to see the other parts.
Well, they (youtube) recently changed something so that doesn't work. More anti-text-mode programming on their part. Finally I had to give up and look at the page for part five in a full javoids-on browser. Wow, what a bunch of popup, makes it feel like a wack a mole game or something, but less fun. Right. Anyway, so after all that work on my part ... no links for first or previous. Good show. Golf clap. Let's reduce the actual functionality of our web site. Good job. /sarcasm Anyway, does anyone know of any way of getting to part one of a series of videos, given only one link to part five? Thank you. p.s. I know this should not be posted here because it is "technical" but where else here could I post it, since this is not a OS-dependent, and this not a Linux question? |
I turned to python to deal with utube years ago. You can search that using whatever criteria you wish. And I don't use their api either.
Here is an example that will search it, without javascripts running. This simple one uses urllib. Code:
#!/usr/bin/python |
@teckk thank you, that was interesting. I've had to write custom things to get around stuff as well. The most programming my case was for getting cartoons to fetch), and that was in C with a little bit of bash.
I've already got youtube-dl, but I can't tell if it can ascertain next and/or previous videos from one video's url. |
If it is from one uploader, then search for videos from that uploader. All of their videos will show. More likely that you will get all 3 episodes lined up in your search, or at least on the same page. You can search videos by date uploaded too. If it's from the same uploader it's likely that they uploaded them all at once. Even if the did not they may be on the same search page.
You can search youtube with youtube-dl. Read man youtube-dl when you have a free hour. That man page is getting larger. |
Thanks teckk for that python youtube searcher! It works...
It's the one thing I need to avoid opening the YT web site at all. Recently it started popping up some "Consent Required" thing, very annoying. |
Welcome, I've made several that do different searches, using different modules.
I know that you like youtube-dl. You can import it into python and use it. It is python after all. This is really basic. Code:
>>> from youtube_dl import YoutubeDL |
This will spit you out more info than you want. Title, description, actual url of videos, formats.
Code:
from youtube_dl import YoutubeDL |
Quote:
(I did have a lok at the man page but found no option to do that) |
I just remembered this: https://gitlab.com/uoou/ytp
Downside is that it requires an API key (and thus a Google account) for the searching, though maybe that bit could be swapped for a suitably modified version of teckk's code. |
@teckk: is there a license on your code?
I have modified it and would like to share it. Quote:
|
Quote:
The arch AUR and arch repo has lots of python. And then I use what I have installed. I think that urllib is a little more handy that requests. I use pyqt5 and qtwebengine instead of selenium and firefox. Anyway no, I make a script every now and then for something needed. I don't know if a youtube page will even load in a browser now unless you have scripts turned on. Dillo, w3m, palemoon with scripts off won't display them. There are python scripts that use googles api to search youtube. That kind of defeats the point though. |
Quote:
https://choosealicense.com/no-permission/ |
Quote:
Code:
youtube-dl -g ytsearch10:python Code:
ytsearchdate:keyword, ytsearchdate10:keyword, ytsearchdateall:keyword Code:
youtube-dl -g "ytsearch3:python scrape with urllib" You can control that better by importing youtube_dl |
Quote:
|
Quote:
Let me know what you decide on, I'll put a note in the code. For now I slapped a GPL3 on it. This sort of stuff might seem minuscule and pointless, but I prefer to stay on top of it. Thanks, anyhow. All this finally got me started on python! I didn't change the parsing mechanism, I concentrated on usability. I changed the output formatting, and it takes search terms from the clipboard & copies a chosen URL to the clipboard. That way I can immediately launch the video with another script. The input mechanism uses readline, that's particularly cool I think: copy-pasting, line editing etc. Here it is. Quote:
Quote:
Code:
$> youtube-dl --list-extractors|grep -i search Quote:
|
All times are GMT -5. The time now is 08:45 PM. |