Help for making copies from youtube pages Topic is solved

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
asad41163
Posts: 268
Joined: 29 Jul 2014, 14:31

Help for making copies from youtube pages

10 Dec 2019, 17:56

Hello to all colleagues
Is there a way to make copy videos titles from the YouTube page?
So that i can translate it in google translate.
Because Google's website translation service does not work with YouTube.
Thanks in advance.
gregster
Posts: 9002
Joined: 30 Sep 2013, 06:48

Re: Help for making copies from youtube pages

10 Dec 2019, 20:15

The title of the youtube video in the active tab is usually part of the wintitle of the browser window - that's probably the easiest way to get video title, instead of automating your browser...
User avatar
boiler
Posts: 16926
Joined: 21 Dec 2014, 02:44

Re: Help for making copies from youtube pages  Topic is solved

10 Dec 2019, 20:52

I took it to mean that you had a results list of a search in YouTube and you wanted to extract all the titles. The following does that with YouTube results in Chrome when it is the active window. Press F1 and wait until you see the MsgBox saying it has copied the titles to the clipboard.

Code: Select all

SetTitleMatchMode, 2

#If WinActive(" - YouTube")
F1::
	Clipboard := ""
	Send, {Control down}u{Control up} ; view source
	Sleep, 2000
	Send, {Control down}ac{Control up} ; copy all
	ClipWait, 1
	HTML := Clipboard
	if ErrorLevel
	{
		SoundBeep ; error signal
		return
	}
	Send, {Control down}w{Control up}
	Needle = (?<="title":{"runs":\[{"text":")([^"]+)
	Start := 1
	TextOut := ""
	while (Found := RegExMatch(HTML, Needle, Match, Start))
	{
		TextOut .= Match1 "`n"
		Start := Found + StrLen(Match1) + 1
	}
	Clipboard := TextOut
	MsgBox,, YouTube Titles, Titles have been copied to clipboard, 2
return
There are some extraneous "titles" at the bottom that don't seem like an issue, but they could be removed if you like.
asad41163
Posts: 268
Joined: 29 Jul 2014, 14:31

Re: Help for making copies from youtube pages

13 Dec 2019, 02:02

Welcome, dear colleagues
Mr: gregster
I mean all the video titles on the page, not just the main video title, which is in the browser’s title bar.. Thank you very much for the fast response ..





Mr: Mr. boiler
Thank you very much, I appreciate this help and this wonderful effort .., this is exactly what I wanted.. :clap:

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: coder96, RandomBoy, Rohwedder and 170 guests