This file is indexed.

/usr/bin/picofeed is in php-picofeed 0.1.18-1ubuntu1.

This file is owned by root:root, with mode 0o755.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
#!/usr/bin/php
<?php

require_once 'PicoFeed/autoload.php';

use PicoFeed\Config\Config;
use PicoFeed\Scraper\Scraper;
use PicoFeed\Reader\Reader;
use PicoFeed\Logging\Logger;
use PicoFeed\PicoFeedException;

Logger::enable();

function get_feed($url, $disable_filtering = false)
{
    try {

        $reader = new Reader;
        $resource = $reader->discover($url);

        $parser = $reader->getParser(
            $resource->getUrl(),
            $resource->getContent(),
            $resource->getEncoding()
        );

        if ($disable_filtering) {
            $parser->disableContentFiltering();
        }

        return $parser->execute();
    }
    catch (PicoFeedException $e) {
        echo 'Exception thrown ===> "'.$e->getMessage().'"'.PHP_EOL;
        return false;
    }
}

function get_item($feed, $item_id)
{
    foreach ($feed->items as $item) {
        if ($item->getId() === $item_id) {
            echo $item;
            echo "============= CONTENT ================\n";
            echo $item->getContent();
            echo "\n============= CONTENT ================\n";
            break;
        }
    }
}

function dump_feed($url)
{
    $feed = get_feed($url);
    echo $feed;
}

function debug_feed($url)
{
    get_feed($url);
    print_r(Logger::getMessages());
}

function dump_item($url, $item_id)
{
    $feed = get_feed($url);

    if ($feed !== false) {
        get_item($feed, $item_id);
    }
}

function nofilter_item($url, $item_id)
{
    $feed = get_feed($url, true);

    if ($feed !== false) {
        get_item($feed, $item_id);
    }
}

function grabber($url)
{
    $grabber = new Scraper(new Config);
    $grabber->setUrl($url);
    $grabber->execute();

    print_r(Logger::getMessages());
    echo "============= CONTENT ================\n";
    echo $grabber->getRelevantContent().PHP_EOL;
    echo "============= FILTERED ================\n";
    echo $grabber->getFilteredContent().PHP_EOL;
}

// Parse command line arguments
if ($argc === 4) {
    switch ($argv[1]) {
        case 'item':
            dump_item($argv[2], $argv[3]);
            die;
        case 'nofilter':
            nofilter_item($argv[2], $argv[3]);
            die;
    }
}
else if ($argc === 3) {
    switch ($argv[1]) {
        case 'feed':
            dump_feed($argv[2]);
            die;
        case 'debug':
            debug_feed($argv[2]);
            die;
        case 'grabber':
            grabber($argv[2]);
            die;
    }
}

printf("Usage:\n");
printf("%s feed <feed-url>\n", $argv[0]);
printf("%s debug <feed-url>\n", $argv[0]);
printf("%s item <feed-url> <item-id>\n", $argv[0]);
printf("%s nofilter <feed-url> <item-id>\n", $argv[0]);
printf("%s grabber <url>\n", $argv[0]);