Giter Site home page Giter Site logo

social_stream's Introduction

SOCIAL STREAM

A TYPO3 extension to crawl the data, posts, events and images from a Social Media Page and saves them as tx_news records to the database.

The posts are saved as normal news articles from the tx_news extension.

Highly extendable with every Social Media Platform, that provides an API

Provides a scheduler task so the pages are crawled each day.

Issue Tracking at https://github.com/siwaonline/social_stream/issues.


Installation

Please make sure the PHP Extension bcmath is installed. If you are using a docker environment this can be done with the following command run inside of the container

`` docker-php-ext-install bcmath `` -----------------------------------------------------------------------------

Configuration

Please include the Plugin in you Main Template and then change to the Constant Editor.

Select PLUGIN.TX_SOCIALSTREAM_PI1

The plugin requires your storage PID, app ID and app secret.

You can get an app ID and app secret when you create a new facebook app at https://developers.facebook.com/.

Create a facebook app

Firstly you need to register with your facebook account.

You are now registered as a facebook developer, that means you can now create facebook apps.

Add a new app via the "My Apps" button on the top right.

Choose a Website App and skip the quickstart (top right in the picture).

Now you have a facebook app and can copy the App Id and the App Secret into the Constants of the Social Stream Plugin.


Add a channel

Go to the List View ov you storage Folder and create a new Social Stream Channel.

Select your Type, enter your Object ID and save.

If you want to access a person - not a page - enter me.

After you saved, you have to get your Access Token - click on the button.

The PopUp redirects you to your Social Media Page - you have to log in and accept the plugin.

Redirect Path: /_assets/b8acd56a12fa390388e961cc3b76df2c/Redirect.php

Use the eID Controller for external persons

Just call /?eID=generate_token&channel=5 (replace 5 with the ID of the channel) or send the link to the owner of the Facebook Page.

Only works for Facebook yet.

Get the name or id of your facebook page

For example:

If your facebook page URL is https://www.facebook.com/siwa.online/?fref=ts then your name is siwa.online

You can look your page ID up on this site: https://findmyfbid.com/


Use the scheduler to crawl for posts once a day

Menu Scheduled tasks

Create a new task with the class extbase - Extbase CommandController Task and enter the rootPage ID if your Root Page hasn't the ID 1

Type Recurring, Frequency 0 0 * * *

Menu setup check

The first rootpage must have an storagePid set in the constants, otherwise the CommandController can't find the entries!

Copy the script line <path-to-your-typo3>/typo3/sysext/core/bin/typo3 scheduler:run

Enter this line in your /etc/crontab file.

I would recommend 0/5 * * * * so your scheduler is called every 5 minutes.


NEWS

You will now have many tx_news records in your storage folder also categorized.

The templating is now up to you.

You can use the standard news template or design your own one.

social_stream's People

Contributors

ddiesenreither avatar mgrundkoetter avatar philippradler avatar shochstoeger avatar siwa-ddiesenreither avatar siwa-pparzer avatar siwa-pradler avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

social_stream's Issues

Usage of realurl without domain records

Using realurl does not necessarily mean the website also uses domain records. In the BaseUtility.php there is this code:

if (\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::isLoaded('realurl')) {
  $rootline = \TYPO3\CMS\Backend\Utility\BackendUtility::BEgetRootLine($id);
  $host = \TYPO3\CMS\Backend\Utility\BackendUtility::firstDomainRecord($rootline);
  $_SERVER['HTTP_HOST'] = $host;
}

which will lead to problems later on (empty host).

Also the code

$actualUrl = "http://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]";

in the file Classes/Controller/Wizard/TokenController.php should be replaced by

$actualUrl = $base . $_SERVER['REQUEST_URI'];

to avoid problems.

Don't rely on direct cURL calls

Using curl directly will cause problems with certain TYPO3 options like settings a proxy connection for outgoing traffic. Instead, the RequestFactory in the core should be used to avoid such problems and to provide more flexibility to configure the used adapter.

Publication workflow

The latest versions 2.0.3 and 2.0.4 were not published to TER. It would be nice if you could tag (git) your released versions here, so using it with explicit link to the repository will be possible. Right now, there is no easy way to get the most recent version with composer :-(
BTW: there is also a quite easy way to automatically publish new versions to packagist by just registering it there and adding the hook here at GitHub, see https://packagist.org/packages/submit for details, takes just 10 minutes ;-)

Broken Dependency injection by not using ObjectManager to get new objects

You use \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance() quite often in the whole extension. This is only correct for creating the object manager itself as the call will NOT respect all the dependency injection stuff at all. So instead of doing things like:

$this->configurationManager = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Extbase\\Configuration\\ConfigurationManager');

this would be correct:

$this->configurationManager = $this->objectManager->get('TYPO3\\CMS\\Extbase\\Configuration\\ConfigurationManager');

or even better this:

/**
 * @var \TYPO3\CMS\Extbase\Configuration\ConfigurationManager
 * @inject 
 */
protected $configurationManager = null;

Also calls like

$news = new \Socialstream\SocialStream\Domain\Model\News();
$cat = new \GeorgRinger\News\Domain\Model\Category();
$classname = "\\Socialstream\\SocialStream\\Utility\\Token\\".ucfirst($type)."Utility";
return new $classname($pid);

do neither respect registered xclasses nor will any dependency injection work! All those calls should be made to ObjectManager::get() instead.

Basic template examples should be included

All the template folders are missing in the published version of the extension. Configured in the setup.txt are the paths:

plugin.tx_news {
    view {
        templateRootPaths.9 = EXT:social_stream/Resources/Private/Templates/
        partialRootPaths.9 = EXT:social_stream/Resources/Private/Partials/
        layoutRootPaths.9 = EXT:social_stream/Resources/Private/Layouts/
    }
}

but none of those folders exist.

Avoid file_get_contents()

All calls to file_get_contents() should be replaced by \TYPO3\CMS\Core\Utility\GeneralUtility::getUrl()

Too few arguments to function Socialstream\SocialStream\Controller\Wizard\TokenController::mainAction(), 1 passed and exactly 2 expected

Hello,

just copied the extension into my TYPO3 9.5.8, followed the instructions and got stuck on generating the access token for facebook.

App id, app secret and social id are correct. But the popup does not open facebook as in the instruction - instead it pops up the error.

Even tried to put in the access token by hand via Access Token Debugger of facebook, but then it returns a 404 in backend.

Any idea, where my error could be?
Will there be any problems with the newer fb graph version (3.3) and the permissions on facebook app? We just have "email, manage_pages, pages_show_list, public_profile".

Thank you in advance

Remove duplication of code

There are a lot of code duplications inside the extension.

// in TokenUtility and FeedUtility those methods could be removed completely
public static function initTSFE($id = 1, $typeNum = 0) {
    parent::initTSFE($id,$typeNum);
}
public function initSettings(){
    parent::initSettings();
}

The constructors should also be moved from derived classes into the base class if they are all the same like

/**
 * __construct
 */
public function __construct($pid=0)
{
    if($pid) {
        $this->initTSFE($pid, 0);
        $this->initSettings();
    }
}

Same applies to methods like getCategory() in the *Utility classes.
Those are just examples, there is a lot more code duplication here.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.