www-mechanize

How to handle UTF16 warning in Perl Mechanize call

南笙酒味 提交于 2019-12-24 07:09:37
问题 I get error while making mechanize call to websites having utf16 characters using mechanize in perl. It shows me this warning Parsing of undecoded UTF-16 at /usr/local/share/perl5/LWP/UserAgent.pm line 600 I know that this is generated when I call $mech->content() method. Is there a way to ignore these warnings in content method of mechanize? 回答1: Yes, you could ignore warnings like this: { no warnings; #your code that generate false warnings }; You could solve the encoding errors with this,

Scripts broke after upgrading LWP “certificate verify failed”

巧了我就是萌 提交于 2019-12-19 05:07:08
问题 I have a lot of scripts, most of them based around WWW::Mechanize that scrape data off of misc hardware that is accessible via HTTPs. After upgrading most of my perl installation and its modules, all scripts using HTTPS:// broke because of "certificate verify failed" This is a result of the fact that the newer versions of LWP does a proper check on the certificate and dies if something doesn't match. In my case, the failed certificate authentication is expected due to the circumstances, so i

perl retrieving page details after mechanize::POST

此生再无相见时 提交于 2019-12-12 18:41:19
问题 I am trying to gather data from a website. Some anti-patterns make looking finding the right form objects difficult but I have this solved. I am using a post method to get around some javascript acting as a wrapper to submit the form. My problem seems to be in getting the results from the mechanize->post method. Here's a shortened version of my code. use strict; use warnings; use HTML::Tree; use LWP::Simple; use WWW::Mechanize; use HTTP::Request::Common; use Data::Dumper; $| = 1; my $site_url

Issue with eval_in_page - Trying to interpolate an array

假装没事ソ 提交于 2019-12-12 03:56:20
问题 my @para_text = $mech->xpath('/html/body/form/table/tbody/tr[2]/td[3]/table/tbody/tr[2]/td/table/tbody/tr[3]/td/div/div/div', type => $mech->xpathResult('STRING_TYPE')); #BELOW IS JUST TO MAKE SURE THE ABOVE CAPTURED THE CORRECT TEXT print "Look here: @para_text"; $mech->click_button( id => "lnkHdrreplyall"); $mech->eval_in_page('document.getElementsByName("txtbdy")[0].value = "@para_text"'); In the last line of my code I need to put the contents of the @para_text array as the text to output

Facebook login via Perl WWW::Mechanize, login error “Cookies Required” [duplicate]

柔情痞子 提交于 2019-12-11 19:33:38
问题 This question already has answers here : Python Mechanize log into Facebook cookie error (2 answers) Closed 3 years ago . I have a Perl script that I run in Strawberry Perl in which I login to Facebook using WWW::Mechanize. For a short background, I use my script to automate an occasional "leaderboard" for a fun little game I invented to be played among my group of friends. I assign points based upon certain posts, and the objective is to earn the most points. Very simple. This script is

WWW::Mechanize Extraction Help - PERL

青春壹個敷衍的年華 提交于 2019-12-11 13:59:14
问题 I'm try to automate the extraction of a transcript found on a website. The entire transcript is found between dl tags since the site formatted the interview in a description list. The script I have below allows me to search the site and extract the text in a plain-text format, but I'm actually looking for it to include everything between the dl tags, meaning dd's, dt's, etc. This will allow us to develop our own CSS for the interview. Something to note about the page is that there are break

Perl WWW::Mechanize — Authentication Error GETing URL

拟墨画扇 提交于 2019-12-11 09:49:01
问题 I'm trying to fill out a web form using the Mechanize library of Perl. Whenever I enter the URL into the search box it prompts the below message, and I can manually login sucessfully. However, when I run the below script, I get the following error: How do I correctly fill in the first Authentication Box credentials using my $mech object? my $mech = WWW::Mechanize->new( 'keepalive' => 1 ); my $url = "http://URL/I/NEED/TO/ACCESS"; my $username = "username"; my $password = "password"; $mech-

LWP set max_size but still get content

为君一笑 提交于 2019-12-11 09:34:37
问题 I am using LWP to get the content from some sites and whenever the page size is larger than one megabyte, I would like LWP to stop downloading the page. This is accomplished with this code: my $ua = LWP::UserAgent->new; $ua->max_size(1024); And it works fine. The only problem is that even when the page is over 1mb, I would still like to be able to get the content of what it has downloaded so far. However, whenever I do this (the traditional way to get content with LWP when there are no errors

Perl WWW::Mechanize methods not working in AIX

旧时模样 提交于 2019-12-11 08:09:11
问题 I have a simple requirement of screen scraping a web-page (simple URL based reports) and direct the HTML response to an output file. The URL will however redirect to an authentication (HTTPS Login) page with "form based" authentication (no javascript) and upon authentication the report I am trying to view should show up in the $response (as HTML). Interestingly, my code is working just fine in a Windows machine, however the same code below is not working in AIX machine and it looks like the

Setting basic authentication credentials in WWW::Mechanize

谁说胖子不能爱 提交于 2019-12-11 07:34:43
问题 I'm having trouble using basic authentication in WWW::Mechanize. I'm trying to connect to the Streak API, the documentation for which states: Streak uses HTTP Basic Auth to sign each request with your API key. Simply set the username of the request to the API key. The password field is ignored. All requests must be made over HTTPS as HTTP requests will be ignored. Here's a sample request: curl https://www.streak.com/api/v1/pipelines -u YOUR_API_KEY: I can successfully access the API using