Facebook operators

ncjanesncjanes Member Posts: 3 Contributor I
edited December 2018 in Help

Hi RM community, 

 

I need to pull data from a Facebook page and attach reactions in the same dataset, and write it to CSV. Then I need an easy way to explore comments per post on that page as well. 

 

It looks like there's been some discussion around this, but not specifically around the newish Facebook operators from the marketplace. Find Pages, Find Page Content, Find Comments, and Find Reactions. 

 

@sgenzer 

@AleckN (I saw you post about similar stuff)

 

Thanks!!!

Tagged:

Best Answer

  • sgenzersgenzer Administrator, Moderator, Employee, RapidMiner Certified Analyst, Community Manager, Member, University Professor, PM Moderator Posts: 2,959 Community Manager
    Solution Accepted

    hi @ncjanes - so I think there is some code inside the FB "Find Reactions" code that does not return data for some Post IDs. You can see this if you put breakpoints in like I have, and not parallelize the Loop Values. Writing to CSV is easy - use the Write CSV operator.

     

    As for data prep, that's a whole kettle of fish. I'd recommend watching some of our great data prep videos.

     

    <?xml version="1.0" encoding="UTF-8"?><process version="8.1.000">
    <context>
    <input/>
    <output/>
    <macros/>
    </context>
    <operator activated="true" class="process" compatibility="8.1.000" expanded="true" name="Process">
    <process expanded="true">
    <operator activated="true" breakpoints="after" class="facebook:FindPageContent" compatibility="1.0.002" expanded="true" height="68" name="Find Page Content" width="90" x="45" y="34">
    <parameter key="Page ID" value="REI"/>
    <parameter key="FB Connection" value="Facebook2"/>
    </operator>
    <operator activated="true" class="concurrency:loop_values" compatibility="8.1.000" expanded="true" height="82" name="Loop Values" width="90" x="179" y="34">
    <parameter key="attribute" value="Post ID"/>
    <parameter key="enable_parallel_execution" value="false"/>
    <process expanded="true">
    <operator activated="true" breakpoints="after" class="filter_examples" compatibility="8.1.000" expanded="true" height="103" name="Filter Examples" width="90" x="45" y="34">
    <list key="filters_list">
    <parameter key="filters_entry_key" value="Post ID.contains.%{loop_value}"/>
    </list>
    </operator>
    <operator activated="true" breakpoints="after" class="facebook:FindReactions" compatibility="1.0.002" expanded="true" height="68" name="Find Reactions" width="90" x="179" y="34">
    <parameter key="Post ID" value="%{loop_value}"/>
    <parameter key="FB Connection" value="Facebook2"/>
    </operator>
    <connect from_port="input 1" to_op="Filter Examples" to_port="example set input"/>
    <connect from_op="Filter Examples" from_port="example set output" to_op="Find Reactions" to_port="example set"/>
    <connect from_op="Find Reactions" from_port="example set" to_port="output 1"/>
    <portSpacing port="source_input 1" spacing="0"/>
    <portSpacing port="source_input 2" spacing="0"/>
    <portSpacing port="sink_output 1" spacing="0"/>
    <portSpacing port="sink_output 2" spacing="0"/>
    </process>
    </operator>
    <operator activated="true" class="append" compatibility="8.1.000" expanded="true" height="82" name="Append" width="90" x="313" y="34"/>
    <connect from_op="Find Page Content" from_port="example set" to_op="Loop Values" to_port="input 1"/>
    <connect from_op="Loop Values" from_port="output 1" to_op="Append" to_port="example set 1"/>
    <connect from_op="Append" from_port="merged set" to_port="result 1"/>
    <portSpacing port="source_input 1" spacing="0"/>
    <portSpacing port="sink_result 1" spacing="0"/>
    <portSpacing port="sink_result 2" spacing="0"/>
    </process>
    </operator>
    </process>

    Scott

     

     

Answers

  • sgenzersgenzer Administrator, Moderator, Employee, RapidMiner Certified Analyst, Community Manager, Member, University Professor, PM Moderator Posts: 2,959 Community Manager

    yes exactly. Did you see my sample XML process on using the extension?

     

    Scott

     

  • ncjanesncjanes Member Posts: 3 Contributor I

    I did see that @sgenzer, thank you. I imported the XML that @curious95 posted and modified is so that the content operator loops on the reactions operator:

     

    <?xml version="1.0" encoding="UTF-8"?><process version="8.1.000">
    <context>
    <input/>
    <output/>
    <macros/>
    </context>
    <operator activated="true" class="process" compatibility="8.1.000" expanded="true" name="Process">
    <process expanded="true">
    <operator activated="true" class="facebook:FindPageContent" compatibility="1.0.005" expanded="true" height="68" name="Find Page Content" width="90" x="45" y="34">
    <parameter key="Page ID" value="REI"/>
    <parameter key="FB Connection" value="facebook connection"/>
    </operator>
    <operator activated="true" class="concurrency:loop_values" compatibility="8.1.000" expanded="true" height="82" name="Loop Values" width="90" x="179" y="34">
    <parameter key="attribute" value="Post ID"/>
    <process expanded="true">
    <operator activated="true" class="facebook:FindReactions" compatibility="1.0.005" expanded="true" height="68" name="Find Reactions" width="90" x="179" y="34">
    <parameter key="Post ID" value="%{loop_value}"/>
    <parameter key="FB Connection" value="facebook connection"/>
    </operator>
    <connect from_port="input 1" to_op="Find Reactions" to_port="example set"/>
    <connect from_op="Find Reactions" from_port="example set" to_port="output 1"/>
    <portSpacing port="source_input 1" spacing="0"/>
    <portSpacing port="source_input 2" spacing="0"/>
    <portSpacing port="sink_output 1" spacing="0"/>
    <portSpacing port="sink_output 2" spacing="0"/>
    </process>
    </operator>
    <operator activated="true" class="append" compatibility="8.1.000" expanded="true" height="82" name="Append" width="90" x="313" y="34"/>
    <connect from_op="Find Page Content" from_port="example set" to_op="Loop Values" to_port="input 1"/>
    <connect from_op="Loop Values" from_port="output 1" to_op="Append" to_port="example set 1"/>
    <connect from_op="Append" from_port="merged set" to_port="result 1"/>
    <portSpacing port="source_input 1" spacing="0"/>
    <portSpacing port="sink_result 1" spacing="0"/>
    <portSpacing port="sink_result 2" spacing="0"/>
    </process>
    </operator>
    </process>

    This returns only 33 lines however. When running the page content operator by itself, 100 lines are returned. 

     

    Also, I'm not sure how to export this to .CSV and/or clean up the data, change data types and etc. 

     

    Thanks!!!

Sign In or Register to comment.