Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Perl > Perl Misc > grabbing a facebook group

Reply
Thread Tools

grabbing a facebook group

 
 
Uno
Guest
Posts: n/a
 
      04-15-2011
My family completed an intervention this week by obtaining guardianship
of our uncle, who was being abused and defrauded. I'd like to thank
this forum for its forbearance of me during this difficult time and for
all of the contributions that made the technical part of this endeavor
successful.

I also coordinated this effort as the creator and administer of
"operation bonhoeffer," which is a secret facebook group populated by my
large and extended family. My more successful siblings had not had an
fb presence at all. This group gave us the ability to share information
in real time, but

now it's over and we want to put it in the books. I think that perl can
do anything a browser can do (is that correct), so I'd like to find a
way to serialize the data and take it down.

So how does one behave like a browser when there's a login and password
involved?
--
Uno
 
Reply With Quote
 
 
 
 
Uno
Guest
Posts: n/a
 
      04-16-2011
On 04/15/2011 11:38 AM, Sherm Pendley wrote:

> For Facebook data, you'll probably have better luck using their API than
> trying to emulate a browser& scraping their pages. There's a module
> for that:
>
> <http://search.cpan.org/perldoc?Facebook>
>
> If you're talking about a FB *user*, rather than a *group*, it's even
> easier - they provide a tool to download a record of everything you've
> done there, including copies of any images& videos you've posted.
> Unfortunately, there doesn't seem to be an equivalent tool for group
> activity.
>
> <https://www.facebook.com/help/?topic=download>
>
> sherm--
>


Well, hot damn, sherm, I'm really pleased with my initial effort. I
went to a terminal and typed
cpan
install Facebook
, and it was doing it's thing, but telling me that it couldn't do
things, so I ctrl-C'ed out of that and typed
sudo cpan
install Facebook
, and think I'm sitting pretty:

Running make install
Prepending /home/dan/.cpan/build/Facebook-0.102-C7c3EJ/blib/arch
/home/dan/.cpan/build/Facebook-0.102-C7c3EJ/blib/lib to PERL5LIB for
'install'
Installing /usr/local/share/perl/5.10.1/Facebook.pm
Installing /usr/local/share/perl/5.10.1/Facebook/Manual.pod
Installing /usr/local/share/perl/5.10.1/Facebook/Signed.pm
Installing /usr/local/share/perl/5.10.1/Facebook/Cookie.pm
Installing /usr/local/share/perl/5.10.1/Facebook/Cookbook.pod
Installing /usr/local/man/man3/Facebook::Cookie.3pm
Installing /usr/local/man/man3/Facebook::Signed.3pm
Installing /usr/local/man/man3/Facebook.3pm
Installing /usr/local/man/man3/Facebook::Cookbook.3pm
Installing /usr/local/man/man3/Facebook::Manual.3pm
Appending installation info to /usr/local/lib/perl/5.10.1/perllocal.pod
FRANKS/Facebook-0.102.tar.gz
make install -- OK
Warning (usually harmless): 'YAML' not installed, will not store
persistent state

cpan[2]>

Why is my terminal always telling me that 'YAML' is not installed, while
python-yaml is?
--
Uno
 
Reply With Quote
 
 
 
 
Uno
Guest
Posts: n/a
 
      04-16-2011
On 04/15/2011 02:22 AM, bugbear wrote:

> I think facebook may well make extensive use of javascript and/or flash,
> which will complicate your task.
>
> BugBear


I'm able to complicate my task in any event:

$ ./fb1.pl
../fb1.pl: line 2: use: command not found
../fb1.pl: line 3: use: command not found
../fb1.pl: line 5: use: command not found
../fb1.pl: line 7: syntax error near unexpected token `('
../fb1.pl: line 7: ` my $fb = Facebook->new('
$ cat fb1.pl
#!/usr/bin/perl
use strict;
use warnings;

use Facebook;

my $fb = Facebook->new(
app_id => $app_id,
api_key => $api_key,
secret => $secret,
);

use Facebook::Signed;

my $logged_in_fb = Facebook->new(
signed => Facebook::Signed->new(
secret => $secret,
facebook_data => $facebook_cookie_for_your_application_as_text,
),
app_id => $app_id,
secret => $secret,
api_key => $api_key,
);

# If you dont provide secret, it will try to fetch it from signed values
my $shorter_logged_in_fb = Facebook->new(
signed => Facebook::Signed->new(
secret => $secret,
facebook_data => $facebook_cookie_for_your_application_as_text,
),
app_id => $app_id,
api_key => $api_key,
);

# You need to have Facebook::Graph installed so that this works
my $gettys_facebook_profile = $fb->graph->query
->find(100001153174797)
->include_metadata
->request
->as_hashref;

__END__

$

How does my interpreter all of a sudden not know what I mean when I say
"use?"
--
Uno
 
Reply With Quote
 
C.DeRykus
Guest
Posts: n/a
 
      04-16-2011
On Apr 16, 12:14*am, Uno <(E-Mail Removed)> wrote:
> On 04/15/2011 02:22 AM, bugbear wrote:
>
> > I think facebook may well make extensive use of javascript and/or flash,
> > which will complicate your task.

>
> > BugBear

>
> I'm able to complicate my task in any event:
>
> $ ./fb1.pl
> ./fb1.pl: line 2: use: command not found
> ./fb1.pl: line 3: use: command not found
> ./fb1.pl: line 5: use: command not found
> ./fb1.pl: line 7: syntax error near unexpected token `('
> ./fb1.pl: line 7: ` *my $fb = Facebook->new('
> $ cat fb1.pl


> * #!/usr/bin/perl

^^^^
^^^^
^^^^
Eliminate leading space above

> use strict;
> use warnings;
> ...
>
> How does my interpreter all of a sudden not know what I mean when I say
> "use?"


--
Charles DeRykus


 
Reply With Quote
 
Martijn Lievaart
Guest
Posts: n/a
 
      04-16-2011
On Sat, 16 Apr 2011 01:14:12 -0600, Uno wrote:

> On 04/15/2011 02:22 AM, bugbear wrote:
>
>> I think facebook may well make extensive use of javascript and/or
>> flash, which will complicate your task.
>>
>> BugBear

>
> I'm able to complicate my task in any event:
>
> $ ./fb1.pl
> ./fb1.pl: line 2: use: command not found ./fb1.pl: line 3: use: command
> not found ./fb1.pl: line 5: use: command not found ./fb1.pl: line 7:
> syntax error near unexpected token `(' ./fb1.pl: line 7: ` my $fb =
> Facebook->new(' $ cat fb1.pl
> #!/usr/bin/perl
> use strict;
> use warnings;



Get rid of the spaces before the hash. Your shell does not see it needs
to start perl, so it is interpreted by the shell as a shell script.

M4
 
Reply With Quote
 
Mart van de Wege
Guest
Posts: n/a
 
      04-16-2011
Uno <(E-Mail Removed)> writes:

>
> $ ./fb1.pl
> ./fb1.pl: line 2: use: command not found
> ./fb1.pl: line 3: use: command not found
> ./fb1.pl: line 5: use: command not found
> ./fb1.pl: line 7: syntax error near unexpected token `('
> ./fb1.pl: line 7: ` my $fb = Facebook->new('
> $ cat fb1.pl
> #!/usr/bin/perl
> use strict;
> use warnings;

<snip>

> How does my interpreter all of a sudden not know what I mean when I
> say "use?"


Because your system is trying to run a shell script instead of perl.

When you launch an executable text file, Linux will look at the first
two characters: if these are #!, then the rest of the line will be used
as the interpreter command to run the text file with. If the first two
characters are *not* #!, then the code will be run by your shell.

Now take a *good* look at your code. What are the first two characters?

Mart

--
"We will need a longer wall when the revolution comes."
--- AJS, quoting an uncertain source.
 
Reply With Quote
 
Uno
Guest
Posts: n/a
 
      04-16-2011
On 04/16/2011 02:39 AM, Mart van de Wege wrote:

> Because your system is trying to run a shell script instead of perl.
>
> When you launch an executable text file, Linux will look at the first
> two characters: if these are #!, then the rest of the line will be used
> as the interpreter command to run the text file with. If the first two
> characters are *not* #!, then the code will be run by your shell.
>
> Now take a *good* look at your code. What are the first two characters?
>
> Mart
>


$ perl fb1.pl
Global symbol "$app_id" requires explicit package name at fb1.pl line 8.
Global symbol "$api_key" requires explicit package name at fb1.pl line 9.
Global symbol "$secret" requires explicit package name at fb1.pl line 10.
BEGIN not safe after errors--compilation aborted at fb1.pl line 13.
$

It was a single, white space. I find that white space is not your
friend in perl.
--
Uno
 
Reply With Quote
 
Mart van de Wege
Guest
Posts: n/a
 
      04-16-2011
Uno <(E-Mail Removed)> writes:

> On 04/16/2011 02:39 AM, Mart van de Wege wrote:
>
>> Because your system is trying to run a shell script instead of perl.
>>
>> When you launch an executable text file, Linux will look at the first
>> two characters: if these are #!, then the rest of the line will be used
>> as the interpreter command to run the text file with. If the first two
>> characters are *not* #!, then the code will be run by your shell.
>>
>> Now take a *good* look at your code. What are the first two characters?
>>
>> Mart
>>

>
> $ perl fb1.pl
> Global symbol "$app_id" requires explicit package name at fb1.pl line 8.
> Global symbol "$api_key" requires explicit package name at fb1.pl line 9.
> Global symbol "$secret" requires explicit package name at fb1.pl line 10.
> BEGIN not safe after errors--compilation aborted at fb1.pl line 13.
> $
>
> It was a single, white space. I find that white space is not your
> friend in perl.


When people do you the courtesy of patiently explaining how something
works, please do have the courtesy in return of actually *reading* what
they wrote.

Mart

--
"We will need a longer wall when the revolution comes."
--- AJS, quoting an uncertain source.
 
Reply With Quote
 
Uno
Guest
Posts: n/a
 
      04-17-2011
On 04/16/2011 11:26 AM, Sherm Pendley wrote:
> Uno<(E-Mail Removed)> writes:
>
>> Why is my terminal always telling me that 'YAML' is not installed,
>> while python-yaml is?

>
> Because YAML is a Perl module, and python-yaml is not.
>
> sherm--
>

$ man YAML
$ ysh
No command 'ysh' found, but there are 25 similar ones
ysh: command not found
$ perl fb1.pl
Global symbol "$app_id" requires explicit package name at fb1.pl line 8.
Global symbol "$api_key" requires explicit package name at fb1.pl line 9.
Global symbol "$secret" requires explicit package name at fb1.pl line 10.
BEGIN not safe after errors--compilation aborted at fb1.pl line 13.
$ man Moose
$ cat fb1.pl
#!/usr/bin/perl
use strict;
use warnings;

use Facebook;

my $fb = Facebook->new(
app_id => $app_id,
api_key => $api_key,
secret => $secret,
);

use Facebook::Signed;

my $logged_in_fb = Facebook->new(
signed => Facebook::Signed->new(
secret => $secret,
facebook_data => $facebook_cookie_for_your_application_as_text,
),
app_id => $app_id,
secret => $secret,
api_key => $api_key,
);

# If you dont provide secret, it will try to fetch it from signed values
my $shorter_logged_in_fb = Facebook->new(
signed => Facebook::Signed->new(
secret => $secret,
facebook_data => $facebook_cookie_for_your_application_as_text,
),
app_id => $app_id,
api_key => $api_key,
);

# You need to have Facebook::Graph installed so that this works
my $gettys_facebook_profile = $fb->graph->query
->find(100001153174797)
->include_metadata
->request
->as_hashref;

__END__

$

I had hoped that getting YAML, Moose, Facebook::Signed and so forth was
going to help me resolve these 3 errors, but not so. Ideas?
--
Uno
 
Reply With Quote
 
Uno
Guest
Posts: n/a
 
      04-17-2011
On 04/16/2011 08:26 AM, Mart van de Wege wrote:
> Uno<(E-Mail Removed)> writes:
>
>> On 04/16/2011 02:39 AM, Mart van de Wege wrote:
>>
>>> Because your system is trying to run a shell script instead of perl.
>>>
>>> When you launch an executable text file, Linux will look at the first
>>> two characters: if these are #!, then the rest of the line will be used
>>> as the interpreter command to run the text file with. If the first two
>>> characters are *not* #!, then the code will be run by your shell.
>>>
>>> Now take a *good* look at your code. What are the first two characters?
>>>
>>> Mart
>>>

>>
>> $ perl fb1.pl
>> Global symbol "$app_id" requires explicit package name at fb1.pl line 8.
>> Global symbol "$api_key" requires explicit package name at fb1.pl line 9.
>> Global symbol "$secret" requires explicit package name at fb1.pl line 10.
>> BEGIN not safe after errors--compilation aborted at fb1.pl line 13.
>> $
>>
>> It was a single, white space. I find that white space is not your
>> friend in perl.

>
> When people do you the courtesy of patiently explaining how something
> works, please do have the courtesy in return of actually *reading* what
> they wrote.
>
> Mart
>


Whatever, Mart, I think you overestimate your courtesy when you try to
tell me what I read. The first 2 characters were whitespace and then a
hash. Now I've got my shebang line correct and am moving on ....
--
Uno
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Writing/Developing Facebook Applications in .NET using Facebook.NETSDK Dutt ASP .Net 1 02-08-2008 03:38 PM
Cisco Systems - Facebook Social Networking Group Fleckz328 Cisco 0 10-17-2007 03:51 PM
Cisco Systems - facebook group - spread word people and join, and let the web 2.0 community grow Fleckz328 Cisco 1 10-14-2007 02:48 PM
Facebook app give feedback -Send birthday cards to buds http://apps.facebook.com/groupcards/start fringo Python 0 10-08-2007 08:04 PM
Facebook app give feedback -Send birthday cards to buds http://apps.facebook.com/groupcards/start fringo Ruby 0 10-08-2007 08:03 PM



Advertisments