Hi,
I am trying to parse a rss similar to the one found here (in example) http://www.feedforall.com/mediarss.htm
<!-- Snipped for Brevity --> -
<item>
-
<title>FeedForAll's Show Tunes and Song</title>
-
<link>http://www.feedforall.com/songs.htm</link>
-
<description>FeedForAll cool show tunes and lyrics. </description>
-
<media:group>
-
<media:content url="http://www.feedorall.com/sample.mp3" fileSize="122345" type="audio/mpeg" isDefault="true" expression="sample" bitrate="128" framerate="24" duration="98" height="220" width="300" />
-
<media:adult> false </media:adult>
-
<media:title> FeedForAll file sample </media:title>
-
<media:hash> dfdec888b72151965a34b4b59031290a </media:hash>
-
<media:player url="http://www.feedforall.com/player" height="220" width="300" />
-
<media:credit role="author"> J Housley </media:credit>
-
<media:text type="plain"> FeedForAll supports name space extentions, specifically Yahoo's media RSS </media:text>
-
</media:group>
-
</item>
-
<!--Snipped for Brevity-->
Now I want to get media:title, media:player url etc. I am trying to use XML::RSS, but no luck yet :(
Please help.
Thanks,
Subeen.
4 4430
Hi,
I am trying to parse a rss similar to the one found here (in example) http://www.feedforall.com/mediarss.htm
<!-- Snipped for Brevity --> -
<item>
-
<title>FeedForAll's Show Tunes and Song</title>
-
<link>http://www.feedforall.com/songs.htm</link>
-
<description>FeedForAll cool show tunes and lyrics. </description>
-
<media:group>
-
<media:content url="http://www.feedorall.com/sample.mp3" fileSize="122345" type="audio/mpeg" isDefault="true" expression="sample" bitrate="128" framerate="24" duration="98" height="220" width="300" />
-
<media:adult> false </media:adult>
-
<media:title> FeedForAll file sample </media:title>
-
<media:hash> dfdec888b72151965a34b4b59031290a </media:hash>
-
<media:player url="http://www.feedforall.com/player" height="220" width="300" />
-
<media:credit role="author"> J Housley </media:credit>
-
<media:text type="plain"> FeedForAll supports name space extentions, specifically Yahoo's media RSS </media:text>
-
</media:group>
-
</item>
-
<!--Snipped for Brevity-->
Now I want to get media:title, media:player url etc. I am trying to use XML::RSS, but no luck yet :(
Please help.
Thanks,
Subeen.
Could you please post your code so that we can see what you have been trying thus far? Also, when posting your code, please do not forget the code tags as explained in the REPLY GUIDELINES to the right of the reply window.
Regards,
Jeff
Here is what I am trying to do: -
$rss->parse($raw);
-
foreach my $item (@{$rss->{'items'}})
-
{
-
$title = $item->{'title'};
-
$media_keywords = $item->{'media:keywords'};
-
print $title, "\n";
-
print $media_keywords, "\n";
-
}
-
It prints the title, but doesn't print the keywords.
I have changed the code. -
$rss->add_module(prefix=>'dc', uri=>"http://purl.org/dc/terms/");
-
$rss->add_module(prefix=>'media', uri=>"http://search.yahoo.com/mrss");
-
$rss->parse($raw);
-
-
foreach my $item (@{$rss->{'items'}})
-
{
-
$title = $item->{'title'};
-
$media_keywords = $item->{'media'}->{'keywords'};
-
$media_player_url = $item->{'media'}->{'player'}->{'url'};
-
print $title, "\n";
-
print $media_keywords, "\n";
-
print $media_player_url, "\n";
-
}
-
Now it prints the title & keywords, but doesn't print the media player url.
I have changed the code. -
$rss->add_module(prefix=>'dc', uri=>"http://purl.org/dc/terms/");
-
$rss->add_module(prefix=>'media', uri=>"http://search.yahoo.com/mrss");
-
$rss->parse($raw);
-
-
foreach my $item (@{$rss->{'items'}})
-
{
-
$title = $item->{'title'};
-
$media_keywords = $item->{'media'}->{'keywords'};
-
$media_player_url = $item->{'media'}->{'player'}->{'url'};
-
print $title, "\n";
-
print $media_keywords, "\n";
-
print $media_player_url, "\n";
-
}
-
Now it prints the title & keywords, but doesn't print the media player url.
Unfortunately, I know nothing about this module, but have you tried running the media player line as: -
$media_player_url = $item->{'media'}->{'player'};
-
and see what it returns? I would play with it and see what happens. It may just be a formatting issue of the command.
Regards,
Jeff
Sign in to post your reply or Sign up for a free account.
Similar topics
by: John Smith |
last post by:
Hello,
I have a rather odd question. My company is an all java/oracle shop.
We do everything is Java... no matter what it is... parsing of text
files, messaging, gui you name it. My question...
|
by: Wayne Folta |
last post by:
I hadn't really followed the state of perl for quite a few years. When
Irecently found python, it just suited me and now I've switched. (And
am contributing to an open-source python project. Great...
|
by: John Smith |
last post by:
Hello,
I have a rather odd question. My company is an all java/oracle shop.
We do everything is Java... no matter what it is... parsing of text
files, messaging, gui you name it. My question...
|
by: .:mmac:. |
last post by:
I have a bunch of files (Playlist files for media player) and I am trying to
create an automatically generated web page that includes the last 20 or 30
of these files. The files are created every...
|
by: Jean-Marie Vaneskahian |
last post by:
Reading - Parsing Records From An LDAP LDIF File In .Net?
I am in need of a .Net class that will allow for the parsing of a LDAP
LDIF file. An LDIF file is the standard format for representing...
|
by: Sandman |
last post by:
Ok, so I'm the author of a pretty big CMS system (big as in huge, not
market-share big) and I've been thinking about a problem for a few
weeks here on media management.
The CMS accomodates both...
|
by: Robert Neville |
last post by:
Basically, I want to create a table in html, xml, or xslt; with any
number of regular expressions; a script (Perl or Python) which reads
each table row (regex and replacement); and performs the...
|
by: R Wood |
last post by:
Greetings -
A recent Perl experiment hasn't turned out so well, which has piqued my
interest in Python. The project is this: take a Vcard file exported from
Apple's Addressbook and use a...
|
by: worlman385 |
last post by:
I need to parse the following HTML page and extract TV listing data
using VC++
http://tvlistings.zap2it.com/tvlistings/ZCGrid.do
any good way to extract the data?
is easy for VC++ to call...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
| |