Ejemplo n.º 1
0
function search_query($kw)
{
    $wf = new Workflows();
    $url = 'http://www.bilibili.tv/search?keyword=' . urlencode($kw) . '&orderby=&formsubmit=';
    $content = $wf->request($url, array(CURLOPT_ENCODING => 1));
    $doc = phpQuery::newDocumentHTML($content);
    $list = $doc->find('li.l');
    $i = 0;
    foreach ($list as $item) {
        $link = pq($item)->children('a:first')->attr('href');
        if (strpos($link, 'http') !== 0) {
            $link = 'http://www.bilibili.tv' . $link;
        }
        $info = pq($item)->find('div.info > i');
        $author = pq($item)->find('a.upper:first')->text();
        $view = $info->eq(0)->text();
        $comment = $info->eq(1)->text();
        $bullet = $info->eq(2)->text();
        $save = $info->eq(3)->text();
        $date = $info->eq(4)->text();
        $subtitle = 'UP主:' . $author . ' 播放:' . $view . ' 评论:' . $comment . ' 弹幕:' . $bullet . ' 收藏:' . $save . ' 日期:' . $date;
        $wf->result($i, $link, pq($item)->find('div.t:first')->text(), $subtitle, 'icon.png', 'yes');
        $i++;
    }
    if (count($wf->results()) == 0) {
        $wf->result('0', $url, '在bilibili.tv中搜索', $kw, 'icon.png', 'yes');
    }
    return $wf->toxml();
}
Ejemplo n.º 2
0
 public function getTranslation($query)
 {
     $workflows = new Workflows();
     $api = $this->url . urlencode($query);
     $res = $workflows->request($api);
     $res = json_decode($res);
     if ($res->errorCode == 0) {
         $workflows->result($query, $res->translation[0], $res->translation[0], $query, "translate.png");
         if (isset($res->basic)) {
             $explains = $res->basic->explains;
             foreach ($explains as $key => $value) {
                 $workflows->result($key, $value, $value, $query, "translate.png");
             }
         }
         if (isset($res->web)) {
             $web = $res->web;
             foreach ($web as $key => $item) {
                 $workflows->result($key, implode(",", $item->value), implode(",", $item->value), $item->key, "translate.png");
             }
         }
     } else {
         $workflows->result('', '', '没查到呀', '没找到对应的翻译', 'translate.png', false);
     }
     echo $workflows->toxml();
 }
/**
 * Description :
 * Show the mixes 
 */
function showMix($url)
{
    // create a temporary directory for storing mix covers
    if (!file_exists(DIR_COVERS)) {
        mkdir(DIR_COVERS, 0777, true);
    }
    deleteAllFiles();
    $wf = new Workflows();
    $options = unserialize(OPTIONS);
    $json = $wf->request($url, $options);
    $data = json_decode($json, true);
    $mixes = $data['mix_set']['mixes'];
    $count = 1;
    foreach ($mixes as $mix) {
        // get mix info
        $mix_id = $mix['id'];
        $mix_name = $mix['name'];
        $url = "http://8tracks.com" . $mix['path'];
        $plays_count = $mix['plays_count'];
        $likes_count = $mix['likes_count'];
        $tracks_count = $mix['tracks_count'];
        $duration = $mix['duration'];
        $cover_url = $mix['cover_urls']['sq56'];
        // get mix cover from url
        $image_data = file_get_contents($cover_url);
        $image_name = $mix_id . '.png';
        file_put_contents(DIR_COVERS . '/' . $image_name, $image_data);
        // put image into temporary directory
        $wf->result('alfred8tracksworkflow.' . $count . '.' . time(), $url, trim($mix_name), '[' . number_format($plays_count) . ' plays] ' . '[' . number_format($likes_count) . ' likes] ' . '[' . $tracks_count . ' tracks] (' . gmdate("H:i:s", $duration) . ')', DIR_COVERS . '/' . $image_name);
        $count++;
    }
    return $wf->toxml();
}
Ejemplo n.º 4
0
function load($dir)
{
    $wf = new Workflows();
    $enable_cache = $GLOBALS["enable_cache"];
    $cache_file = $wf->cache() . "/cache-" . preg_replace('/[^a-z0-9_-]/i', '', $GLOBALS["url"]);
    $GLOBALS["cache_file"] = $cache_file;
    if ($enable_cache) {
        // echo "cache file is $cache_file\n";
        $cache_time = 5 * 60;
        // 5min
        if (file_exists($cache_file)) {
            $entry = getCachedItem($dir);
            if ($entry) {
                return $entry;
            }
        } else {
            file_put_contents($cache_file, serialize(array()));
        }
    }
    $options = array(CURLOPT_CONNECTTIMEOUT => 10, CURLOPT_USERPWD => $GLOBALS["username"] . ':' . $GLOBALS["password"], CURLOPT_FAILONERROR => true, CURLOPT_CUSTOMREQUEST => "LIST {$dir}");
    $lines = explode("\n", $wf->request($GLOBALS["url"], $options));
    // print_r($lines);
    $list = array();
    foreach ($lines as $line) {
        if (empty($line)) {
            continue;
        }
        preg_match_all('/(?P<flag>[dl-])[rwx-]+\\s+(?P<contents>\\d+).+?(?P<size>\\d+)\\s+(?P<month>\\w+)\\s+(?P<date>\\d+)\\s+(?P<time_or_year>[\\d:]+)\\s+(?P<name>\\S+)/', $line, $out, PREG_SET_ORDER);
        // ignore invalid line
        if (!count($out)) {
            continue;
        }
        $match = $out[0];
        $pattern = strpos($match["time_or_year"], ':') === false ? "Y" : "H:i";
        $timezone = new DatetimeZone($GLOBALS["server_timezone"]);
        $date = DateTime::createFromFormat("M d {$pattern}", $match["month"] . " " . $match["date"] . " " . $match["time_or_year"], $timezone);
        if ($date > date_create("now", $timezone)) {
            $date->sub(new DateInterval("P1Y"));
        }
        $timestamp = $date->getTimestamp();
        $keys = array('name', 'size', 'flag');
        $match = array_intersect_key($match, array_flip($keys));
        $match["timestamp"] = $timestamp;
        $match["lastmodifieddate"] = $date->format($GLOBALS["date_format"]);
        $list["{$timestamp}-" . $match['name']] = $match;
    }
    krsort($list);
    if ($enable_cache) {
        $data = unserialize(file_get_contents($cache_file));
        $data[$dir] = array('ts' => time(), 'list' => $list);
        file_put_contents($cache_file, serialize($data));
    }
    return $list;
}
Ejemplo n.º 5
0
 function getTranslations($input)
 {
     $w = new Workflows("psistorm.alfed.leo");
     $leo = new LeoParser();
     $cleanedInput = clean_utf8($input);
     $url = "http://dict.leo.org/" . $this->translationCode . "/?lang=en&searchLoc=0&search=" . urlencode($cleanedInput);
     $str = $w->request($url);
     $options = $leo->get($str);
     if ($options != array()) {
         foreach ($options as $option) {
             $w->result(time(), "{" . $this->translationCode . "}" . $option->translatedWord, $option->translatedWord, $option->originalWord, $option->languageCode . ".png", "yes", $option->originalWord);
         }
     }
     return $w->toxml();
 }
Ejemplo n.º 6
0
 public function getWeather($query)
 {
     $workflows = new Workflows();
     $api = $this->url . $query;
     $res = $workflows->request($api);
     $res = json_decode($res);
     if ($res->error === 0) {
         $forecast = $res->results[0]->weather_data;
         foreach ($forecast as $key => $value) {
             $date = mb_substr($value->date, 0, 6);
             $workflows->result($key, $query, $date . "      " . $value->weather, $value->wind . ", 温度:" . $value->temperature, $value->weather . ".png");
         }
     } else {
         $workflows->result('', '', '没查到呀', '没找到你所查询城市的天气', 'unknown.png');
     }
     echo $workflows->toxml();
 }
Ejemplo n.º 7
0
 public function getMeans($query)
 {
     $workflows = new Workflows();
     $api = $this->url . $query;
     $res = $workflows->request($api);
     $res = json_decode($res);
     if ($res->status === 1) {
         $means = $res->message[0]->means;
         foreach ($means as $key => $mean) {
             $i = implode(',', $mean->means);
             $workflows->result($key, '', $mean->part . $i, '', '');
         }
     } else {
         $workflows->result('', '', '查不到\'' . $query . '\'', '没查到要找的单词', '');
     }
     echo $workflows->toxml();
 }
Ejemplo n.º 8
0
 function getTranslations($input)
 {
     $w = new Workflows("psistorm.alfed.leo");
     $leo = new LeoParser();
     $cleanedInput = clean_utf8($input);
     $url = "http://dict.leo.org/dictQuery/m-vocab/" . $this->translationCode . "/query.xml?tolerMode=nof&lp=" . $this->translationCode . "&lang=de&rmWords=off&directN=0&rmSearch=on&search=" . urlencode($cleanedInput) . "&searchLoc=0&resultOrder=basic&multiwordShowSingle=on&sectLenMax=16";
     $str = $w->request($url, array(CURLOPT_CONNECTTIMEOUT => 5, CURLOPT_TIMEOUT => 5));
     if (!empty($str)) {
         $options = $leo->get($str);
         if ($options != array()) {
             foreach ($options as $option) {
                 $argument = "{" . $this->translationCode . "}{" . $option->originalWord . "}{" . $option->translatedWord . "}";
                 $w->result(time(), $argument, $option->translatedWord, $option->originalWord, $option->languageCode . ".png", "yes", $option->originalWord);
             }
         }
     } else {
         $w->result(time(), "", "Timeout occurred.", $option->originalWord, "icon.png", "no");
     }
     return $w->toxml();
 }
Ejemplo n.º 9
0
 public function getResults($query)
 {
     $wf = new Workflows("jwm.alfed.jisho");
     $query = trim($query);
     // Limit requests to > 2 characters
     if (strlen($query) < 3) {
         echo $wf->toxml();
     }
     // Check cache first
     if ($this->isCached($query)) {
         $html_data = $this->getCachedResults($query);
     } else {
         // Scrape HTML from jisho.org
         $html_data = $wf->request("http://beta.jisho.org/search/" . rawurlencode($query));
         // Cache results
         $this->cacheResults(trim($query), $html_data);
     }
     // Parse HTML
     $search_results = $this->scrape($html_data);
     // Feed results to Alfred
     if (!empty($search_results)) {
         foreach ($search_results as $result) {
             $definition = '';
             foreach ($result['en'] as $word) {
                 $definition .= $word . '・';
             }
             $definition = preg_replace('/[^,.\\s;a-zA-Z0-9_-]|[,.;]$/s', '', $definition);
             $type = $result['type'] ? '[' . $result['type'] . '] ' : '';
             $definition = $type . str_replace('.', '; ', $definition);
             $icon = $this->getIcon($result['type']);
             $wf->result(time(), $result['url'] . ',' . $result['ja'], $result['ja'], $definition, $icon, "yes");
         }
     }
     // Return results to Alfred as XML
     echo $wf->toxml();
 }
Ejemplo n.º 10
0
<?php

require_once 'workflows.php';
$wf = new Workflows();
$query = trim($argv[1]);
$site = '美团';
$icon = 'icon.png';
$requestOption = array(CURLOPT_POST => true, CURLOPT_HTTPHEADER => array('Content-length:0', 'X-Requested-With:XMLHttpRequest'));
$json = $wf->request("http://www.meituan.com/search/smartbox/" . urlencode($query), $requestOption);
$items = json_decode($json);
$items = $items->data;
foreach ($items as $item) {
    $url = sprintf('http://www.meituan.com/s/?w=%s', urlencode($item));
    $subtitle = sprintf('查看全部与%s有关的团购', $item);
    $wf->result("{$url}", "在美团上搜索: {$item}", "{$subtitle}", $icon);
}
$url = sprintf('http://www.meituan.com/s/?w=', $query);
$results = $wf->results();
if (count($results) == 0) {
    $wf->result($url, 'No Suggestions', 'No search suggestions found. Search 美团 for ' . $query, 'icon.png');
}
echo $wf->toxml();
Ejemplo n.º 11
0
<?php

/**
 *  Chiphell For Alfred Workflows
 *  @author simman
 *  @copyright simman.cc
 */
require_once 'workflows.php';
$wf = new Workflows();
$orig = intval("{query}");
$chh_url = "http://www.chiphell.com/forum.php?fid=" . $orig . "&mod=rss";
$data = $wf->request($chh_url);
$xml = simplexml_load_string($data);
$result_data_array = $xml->channel;
foreach ($result_data_array->item as $val) {
    $icon = "icon.png";
    $wf->result($int++ . '.' . time(), $val->link, $val->title, 'author:' . $val->author . '    pubDate:' . $val->pubDate, $icon);
}
if (count($result_data_array->item) == 0) {
    $wf->result('Chiphell_500', '请确保指令和网络链接正常', '没有响应,请再试一次。', '请确保指令和网络链接正常', 'icon.png');
}
echo $wf->toxml();
//$first_channel = array(
//				array(
//					array('name' => '电脑', 'id' => 'gid=3')
//					array('name' => '业界新闻', 'id' => 'fid=80')
//					array('name' => 'CPU/内存/主板/超频', 'id' => 'fid=36')
//					array('name' => '顶级图形卡', 'id' => 'fid=4')
//					array('name' => '散热器/机箱/电源', 'id' => 'fid=42')
//					array('name' => '水冷/MOD', 'id' => 'fid=127')
//					array('name' => '外设', 'id' => 'fid=147')
Ejemplo n.º 12
0
<?php

require_once 'workflows.php';
$w = new Workflows();
$query = urlencode($argv[1]);
if (strlen($query) < 3) {
    exit(1);
}
$url = "http://autocomplete.wunderground.com/aq?query={$query}&format=json";
$suggestions = $w->request($url);
$suggestions = json_decode($suggestions);
$results = array();
foreach ($suggestions->RESULTS as $suggest) {
    $w->result($suggest->l, $suggest->l, $suggest->name, 'Country: ' . $suggest->c . '. Timezone: ' . $suggest->tz, 'icon.png');
}
echo $w->toxml();
Ejemplo n.º 13
0
<?php

require_once 'workflows.php';
$w = new Workflows();
$username = $w->get('github.username', 'settings.plist');
$password = $w->get('github.password', 'settings.plist');
$url = "https://api.github.com/rate_limit";
if ($username && $password) {
    exec('sh auth.sh -u ' . escapeshellarg($username) . ' -p ' . escapeshellarg($password) . ' --url ' . escapeshellarg($url), $output, $return_var);
    $data = implode($output);
    $content = substr($data, strpos($data, "{"));
    $content = substr($content, 0, strrpos($content, "}") + 1);
    $msg = json_decode($content);
} else {
    $content = $w->request($url);
    $msg = json_decode($content);
}
if (isset($msg->message)) {
    $w->result($msg->message, $msg->message, 'Github Limit', $msg->message, 'icon.png', 'no');
}
if (isset($msg->rate->remaining)) {
    $w->result('Limit', 'Limit', 'Github Limit', 'Github API requests remaining ' . $msg->rate->remaining, 'icon.png', 'no');
}
echo $w->toxml();
Ejemplo n.º 14
0
    $hex = '';
    if ($rgba) {
        $rgba = explode(',', $rgba);
        $rgb = array_slice($rgba, 0, 3);
        // Convert to hex
        foreach ($rgb as $c) {
            $hex .= substr('0' . dechex($c / 65535 * 255), -2);
        }
    }
    return `osascript -e 'tell application "Alfred 2" to search "hue {$id}:color:{$hex}"'`;
}
/** Cache a reference to lights. */
if (trim($query) === '') {
    // clear cache
    $lights = $w->write('', 'lights');
    $lights = $w->request("http://{$bridge_ip}" . $base_path . '/lights', array(CURLOPT_CONNECTTIMEOUT => 3));
    $lights = json_decode($lights, true);
    if ($lights) {
        $w->write($lights, 'lights');
    }
} else {
    $lights = $w->read('lights', true);
}
if (!$lights) {
    result(array('title' => 'Bridge connection failed.', 'subtitle' => 'Try running "setup-hue".', 'valid' => 'no'));
    echo $w->toxml($results);
    exit;
}
/** Generate Results */
if ($query == 'lights') {
    foreach ($lights as $id => $light) {
Ejemplo n.º 15
0
* Revised:      14/06/2013
* Version:      0.3
* Note:         Icon Source: A68 - Freelance Graphics Design (http://a68.pl)
*/
require_once 'workflows.php';
$w = new Workflows('wordreference');
$id = $w->get('api', 'settings.plist');
if (!$id) {
    $w->result('wordreference-noapi', 'open http://www.wordreference.com/docs/APIregistration.aspx', 'You must provide a WordReference API to use the workflow', "Get an API using 'getapi', then set it with 'setapi'", 'icon.png', 'yes');
    echo $w->toxml();
    die;
}
$langs = urlencode($argv[1]);
$query = urlencode($argv[2]);
$url = "http://api.wordreference.com/0.8/{$id}/json/{$langs}/{$query}";
$translations = $w->request($url);
$translations = json_decode($translations);
$lang1 = substr($langs, 0, 2);
$lang2 = substr($langs, -2);
$dir = dirname(__FILE__);
$defaultIcon = 'icon.png';
$lang1Icon = file_exists($dir . "/{$lang1}.png") ? "{$lang1}.png" : $defaultIcon;
// where translations are stored in the JSON
$translationPositions = array(array('term0', 'PrincipalTranslations'), array('term0', 'Entries'), array('term0', 'AdditionalTranslations'), array('original', 'Compounds'));
$termIndex = 0;
// for each position check if present and call the walker
foreach ($translationPositions as $pos) {
    if (isset($translations->{$pos[0]}->{$pos[1]})) {
        foreach ($translations->{$pos[0]}->{$pos[1]} as $translation) {
            foreach ($translation as $trkey => $tr) {
                if ($trkey === "Note") {
Ejemplo n.º 16
0
<?php

require_once 'workflows.php';
require_once 'config.php';
$w = new Workflows();
$kw = "{query}";
$isKey = preg_match("/^([a-z]+)-([\\d]+)\$/i", $kw);
if ($isKey) {
    $query = urlencode("key = {$kw}");
} else {
    $query = urlencode("summary ~ {$kw} OR description ~ {$kw}");
}
$url = "{$jiraUrl}/sr/jira.issueviews:searchrequest-xml/temp/SearchRequest.xml?tempMax=20&jqlQuery={$query}";
$content = $w->request($url, array(CURLOPT_COOKIE => $jiraCookie));
if (!strpos($content, 'channel')) {
    $w->result('zhoufan.jira.error', '', '계정 유효성 검사 실패', 'JIRA 파라미터 설정을 다시 해주십시오', 'icon.png');
    echo $w->toxml();
    exit;
}
preg_match_all("/<item>([\\S\\s]+?)<\\/item>/", $content, $itemLines);
if (!count($itemLines[1])) {
    $w->result('zhoufan.jira.no_result', '', '기록을 찾을 수 없습니다', '', 'icon.png');
    echo $w->toxml();
    exit;
}
foreach ((array) $itemLines[1] as $itemLine) {
    $itemLine = trim($itemLine);
    $itemLine = preg_replace("/>([\\s]+?)</", '><', $itemLine);
    preg_match_all("/<([\\S\\s]+?)>([\\S\\s]*?)<\\/([\\S]+?)>/", $itemLine, $itemVars);
    foreach ($itemVars[1] as $itemIndex => $itemName) {
        preg_match_all("/([\\S]+?)=\"([\\S]+?)\"/", $itemName, $matches);
Ejemplo n.º 17
0
<?php

require_once 'workflows.php';
$w = new Workflows();
// Make sure settings file exists.
exec('touch settings.plist');
/** Send request to Portal API to discover bridges on the local network. */
$bridges = $w->request('http://www.meethue.com/api/nupnp');
$bridges = json_decode($bridges, true);
if (empty($bridges)) {
    die('No bridges found on your network.');
}
$bridge_ip = $bridges[0]['internalipaddress'];
$w->set('api.bridge_ip', $bridge_ip, 'settings.plist');
/** Set API group */
if (!empty($argv[1]) && is_numeric($argv[1])) {
    $group = (int) $argv[1];
} else {
    $group = 0;
}
$w->set('api.group', $group, 'settings.plist');
/** Create API user for this workflow. */
$resp = $w->request("http://{$bridge_ip}/api", array(CURLOPT_POST => true, CURLOPT_POSTFIELDS => '{"devicetype": "Alfred"}'));
$resp = json_decode($resp, true);
if (isset($resp[0]['error'])) {
    die('Setup Error: ' . $resp[0]['error']['description']);
}
$username = $resp[0]['success']['username'];
$w->set('api.username', $username, 'settings.plist');
echo 'Success! You can now control your lights by using the "hue" keyword.';
exit;
Ejemplo n.º 18
0
function getArtistArtworkURL($artist)
{
    $parsedArtist = urlencode($artist);
    $w = new Workflows();
    $html = $w->request("http://ws.audioscrobbler.com/2.0/?method=artist.getinfo&api_key=49d58890a60114e8fdfc63cbcf75d6c5&artist={$parsedArtist}&format=json");
    $json = json_decode($html, true);
    return $json[artist][image][1]['#text'];
}
Ejemplo n.º 19
0
<?php

require_once 'workflows.php';
$w = new Workflows();
$location = $w->get('default.location', 'settings.plist');
if ($location) {
    $key = "67350ed2995fb73f";
    $url = "http://api.wunderground.com/api/{$key}/conditions/" . $location . ".json";
    $weather = $w->request($url);
    $weather = json_decode($weather);
    $weather = $weather->current_observation;
    date_default_timezone_set($weather->local_tz_long);
    $hr = date('H', $weather->local_epoch);
    if ($hr > 18) {
        $tod = 'night';
    } else {
        $tod = 'day';
    }
    switch (trim($weather->weather)) {
        case 'Chance of Rain':
            $icon = 'icons/007.png';
            break;
        case 'Chance of Snow':
            $icon = 'icons/014.png';
            break;
        case 'Chance of a Thunderstorm':
            $icon = 'icons/010.png';
            break;
        case 'Light Drizzle':
            $icon = 'icons/007.png';
            break;
Ejemplo n.º 20
0
     $shell_command = 'sh auth.sh -u ' . escapeshellarg($username) . ' -p ' . escapeshellarg($password) . ' --url ' . escapeshellarg($url);
     if ($proxy) {
         $shell_command .= ' --proxy ' . escapeshellarg($proxy);
         file_put_contents("/tmp/alfred", $shell_command . "\n", FILE_APPEND);
     }
     exec($shell_command, $output, $return_var);
     $data = implode($output);
     $data = substr($data, strrpos($data, "X-GitHub-Request-Id"));
     // clean string
     preg_match("/([\\[{])/", $data, $matches, PREG_OFFSET_CAPTURE);
     $start = $matches[0][1];
     $end = max(strrpos($data, "}"), strrpos($data, "]")) + 1;
     $data = substr($data, $start, $end - $start);
     $repos = json_decode($data);
 } else {
     $data = $w->request($url);
     $repos = json_decode($data);
 }
 if (isset($repos->message)) {
     $w->result($repos->message, $repos->message, 'Github Limit', $repos->message, $icon, 'no');
 } else {
     foreach ($repos as $repo) {
         // repos
         if (isset($repo->full_name) && (!strlen($query) || strpos(strtolower($repo->full_name), strtolower($query)) !== false)) {
             $w->result('git-' . $repo->full_name, $repo->html_url, $repo->name, $repo->description, $icon, 'yes');
         } else {
             if (!strlen($query) || strpos(strtolower($repo->description), strtolower($query)) !== false) {
                 $w->result('git-' . $repo->id, $repo->html_url, $repo->description, $repo->html_url, $icon, 'yes');
             }
         }
     }
Ejemplo n.º 21
0
    if (strlen(end($parts)) == 0) {
        //output all relevant sub categories
        $matched_route = true;
        foreach ($routes as $key => $name) {
            if (floor($key / 100) == $main_route / 100 && $key != $main_route) {
                $name = $routes[$main_route] . $split_symbol . $name;
                $routeNum = floor($main_route / 100);
                $w->result($key, $name, $name, "Browse {$name} stops", "icons/{$routeNum}.png", 'no', "{$name}{$split_symbol}");
            }
        }
    }
} elseif (count($parts) == 3) {
    $counter = 0;
    $routeNo = floor($main_route / 100);
    $url = "http://m.ridetherapid.org/next-bus?routeNumber=" . $routeNo . "&direction=" . $directionName;
    $data = $w->request($url);
    $html = str_get_html($data);
    $stops = $html->find('select[name=stopID]', 0);
    $arrtmp = $stops->children();
    $name = $routes[$main_route] . $split_symbol . $name . $split_symbol;
    $stopID = 0;
    foreach ($arrtmp as $child) {
        if ($counter++ == 0) {
            continue;
        }
        $html2 = str_get_html($child);
        $stopID = $child->getAttribute('value');
        $stop = $html2->find("option", 0)->plaintext;
        $w->result($stopID, '', $stop, "Stop #" . $stopID, "icons/{$routeNo}.png", 'no', "{$name}#{$stopID}{$split_symbol}");
        $stopID = $stopID;
    }