Closed japharl closed 2 months ago
I would suggest something like this?
#! /usr/bin/perl
use strict;
use warnings;
use Firefox::Marionette();
my $firefox = Firefox::Marionette->new();
$firefox->go('https://www.w3schools.com/tags/tryit.asp?filename=tryhtml5_video');
foreach my $iframe ($firefox->find_tag('iframe')) {
$firefox->switch_to_frame($iframe);
foreach my $video ($firefox->find_tag('video')) {
foreach my $source ($video->find_tag('source')) {
if ($source->property('type') eq 'video/mp4') {
my $url = $source->property('src');
my $handle = $firefox->download($url);
my $count = 0;
while(my $line = <$handle>) {
$count += length $line;
}
print "Video at $url is $count bytes long\n";
}
}
}
$firefox->switch_to_parent_frame();
}
$firefox->quit();
Does that meet your requirement?
Ooh, that's great. Thank you. Please close ticket. 😀
On Fri, Jun 14, 2024, 9:21 PM david-dick @.***> wrote:
I would suggest something like this?
! /usr/bin/perl
use strict; use warnings; use Firefox::Marionette();
my $firefox = Firefox::Marionette->new(); $firefox->go('https://www.w3schools.com/tags/tryit.asp?filename=tryhtml5_video'); foreach my $iframe ($firefox->find_tag('iframe')) { $firefox->switch_to_frame($iframe); foreach my $video ($firefox->find_tag('video')) { foreach my $source ($video->find_tag('source')) { if ($source->property('type') eq 'video/mp4') { my $url = $source->property('src'); my $handle = $firefox->download($url); my $count = 0; while(my $line = <$handle>) { $count += length $line; } print "Video at $url is $count bytes long\n"; } } } $firefox->switch_to_parent_frame(); } $firefox->quit();
Does that meet your requirement?
— Reply to this email directly, view it on GitHub https://github.com/david-dick/firefox-marionette/issues/46#issuecomment-2169021614, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAJR56UDC3Q5PPQ4MFXNDWLZHOJIDAVCNFSM6AAAAABJKQTROGVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCNRZGAZDCNRRGQ . You are receiving this because you authored the thread.Message ID: @.***>
I'm not sure how to download am embeded video from a webpage. Specifically, given this code:
The selfie function is close, but not quite. Also interested in the audio tag which has a similar format.