Beispiel #1
0
 /**
  * {@inheritdoc}
  */
 public function run()
 {
     parent::run();
     $this->api = new Bag();
     $titles = $this->request->url->getDirectory(1);
     if (!empty($titles)) {
         $url = clone $this->request->url;
         $url->setPath('/w/api.php');
         $url->setParameter('action', 'query');
         $url->setParameter('format', 'json');
         $url->setParameter('continue', '');
         $url->setParameter('titles', $titles);
         //extract images
         $url->setParameter('prop', 'images');
         $api = $this->request->createRequest($url);
         if ($json = $api->getJsonContent()) {
             $this->api->set('images', $json);
         }
         //extract content
         $url->setParameter('prop', 'extracts');
         $url->setParameter('exchars', 1500);
         $api = $this->request->createRequest($url);
         if ($json = $api->getJsonContent()) {
             $this->api->set('extracts', $json);
         }
     }
 }
Beispiel #2
0
 /**
  * {@inheritdoc}
  */
 protected function run()
 {
     if ($this->request->getHost() === 'gist.github.com') {
         $this->addProvider('gist', new Api\Gist());
     }
     parent::run();
 }
Beispiel #3
0
 /**
  * {@inheritdoc}
  */
 public function run()
 {
     if ($this->request->match('*/maps/*')) {
         $this->addProvider('google', new Api\GoogleMaps());
     }
     parent::run();
 }
Beispiel #4
0
 /**
  * {@inheritdoc}
  */
 public function run()
 {
     if ($this->request->getHttpCode() === 429) {
         $this->addProvider('oembed', new Providers\OEmbed());
         return;
     }
     parent::run();
 }
Beispiel #5
0
 /**
  * {@inheritdoc}
  */
 public function run()
 {
     parent::run();
     $this->api = new Bag();
     $api = $this->request->createRequest($this->request->url->getUrl() . '.json');
     if ($json = $api->getJsonContent()) {
         $this->api->set($json);
     }
 }
Beispiel #6
0
 /**
  * {@inheritdoc}
  */
 public function run()
 {
     parent::run();
     $this->api = new Bag();
     $api = clone $this->request;
     $api->url->setParameter('output', 'json');
     if ($json = $api->getJsonContent()) {
         $this->api->set($json);
     }
 }
Beispiel #7
0
 /**
  * {@inheritdoc}
  */
 public function run()
 {
     parent::run();
     $this->api = new Bag();
     if (isset($this->config['soundcloudKey'])) {
         $api = $this->request->createRequest('http://api.soundcloud.com/resolve.json');
         $api->startingUrl->setParameter('client_id', $this->config['soundcloudKey']);
         $api->startingUrl->setParameter('url', $this->request->url->getUrl());
         if ($json = $api->getJsonContent()) {
             $this->api->set($json);
         }
     }
 }
Beispiel #8
0
 /**
  * {@inheritdoc}
  */
 public function run()
 {
     parent::run();
     $this->api = new Bag();
     if ($id = $this->getId($this->request->startingUrl)) {
         if ($this->config['facebookKey']) {
             $api = $this->request->createRequest('https://graph.facebook.com/' . $id);
             $api->startingUrl->setParameter('access_token', $this->config['facebookKey']);
             if ($json = $api->getJsonContent()) {
                 $this->api->set($json);
             }
         }
         $this->api->set('id', $id);
     }
 }
Beispiel #9
0
 /**
  * {@inheritdoc}
  */
 public function run()
 {
     $this->addProvider('soundcloud', new Api\Soundcloud());
     parent::run();
 }
Beispiel #10
0
 /**
  * {@inheritdoc}
  */
 public function run()
 {
     $this->addProvider('archive', new Api\Archive());
     parent::run();
 }
Beispiel #11
0
 /**
  * {@inheritdoc}
  */
 protected function run()
 {
     $this->addProvider('wikipedia', new Api\Wikipedia());
     parent::run();
 }
Beispiel #12
0
 /**
  * {@inheritdoc}
  */
 public function run()
 {
     $this->addProvider('facebook', new Api\Facebook());
     parent::run();
 }
Beispiel #13
0
 /**
  * {@inheritdoc}
  */
 public function run()
 {
     $this->addProvider('imageshack', new Api\Imageshack());
     parent::run();
 }