Hi
Thanks for the tip. I was able to figure that out the hard way by carefully seeing where by browser was going. I didnt know about the META tag. I am now able to download the file
'https://secure2.playboy.com/security/cookieGenerator.do'
Once again this file is a redirect to
https://secure2.spicetv.com/security/cookieGenerator.do
but with a lot of cookie information added at the end. So I am trying to get the value of the "content" attribute of the "meta" tag.
I am now trying to parse the html file using HTML::TokeParserL::Simple. The trouble is the html file has the first few lines as the new line character and each line after that has a new line character. The HTML::TokerParser::Simple is choking on the malformed (??) html. So I am trying to remove the lines which have only a new line character (^M) and remove the ^M at the end of each line. Since this is my first time with perl I am struggling with this simple task.
Any help or code sample to strip off lines with only a new line character and the new line character at the end of each line is appreciated. I am trying to use chomp but dont know how to loop through the entire output of mech->content
If I clean up the html file by hand and then run the following script
my $p = HTML::TokeParser::Simple->new( $html );
my $token = $p->get_token;
my $tag = "meta";
my $att = "content";
if ( $token->is_tag($tag) ) { print "There is a $tag tag\n" };
my $att_value = $token->get_attr($att);
print "The value of the $att attribute of the $tag tag is $att_value \
+n\n\n\n";
my $url = substr($att_value,6);
print $url,"\n";
Iam able to get the info I need but cleaning up the html file is the problem
Thanks
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.