Server IP : 185.86.78.101 / Your IP : 216.73.216.124 Web Server : Apache System : Linux 675867-vds-valikoshka1996.gmhost.pp.ua 5.4.0-150-generic #167-Ubuntu SMP Mon May 15 17:35:05 UTC 2023 x86_64 User : www ( 1000) PHP Version : 7.4.33 Disable Function : passthru,exec,system,putenv,chroot,chgrp,chown,shell_exec,popen,proc_open,pcntl_exec,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,imap_open,apache_setenv MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : OFF Directory : /www/wwwroot/mifepriston.org/node_modules/oust/ |
Upload File : |
# oust [](https://travis-ci.org/addyosmani/oust) [](https://david-dm.org/addyosmani/oust) [](https://david-dm.org/addyosmani/oust?type=dev) > Extract URLs to stylesheets, scripts, links, images or HTML imports from HTML ## Install ```sh $ npm install --save-dev oust ``` ## Usage First include: ```js var oust = require('oust'); ``` Resource links can then be extracted from either files: #### Extract stylesheets references `<link rel="stylesheet">` ```js var hrefs = oust(htmlString, 'stylesheets'); ``` #### Extract stylesheets references with media print `<link rel="stylesheet" media="print">` ```js var hrefs = oust(htmlString, 'stylesheets', function(i, $el) { return $el.attr('media') === 'print'; }); ``` #### Extract script references `<script src>` ```js var srcs = oust(htmlString, 'scripts'); ``` #### Extract HTML imports `<link rel="import">` ```js var hrefs = oust(htmlString, 'imports'); ``` #### Extract URL references `<a href>` ```js var srcs = oust(htmlString, 'links'); ``` #### Extract image source references `<img src>` ```js var srcs = oust(htmlString, 'images'); ``` #### Extract cheerio elements alongside the value Usefull for post processing/filtering as you get an array of matched elements with cheerio convenience syntax (e.g. `$el.attr()`) ```js var srcs = oust.raw(htmlString, '...'); -> [ {value: '...', $el: '...'}, {value: '...', $el: '...'}, ... ] ``` ## API #### Options Attribute | Default | Description --- | --- | --- `src` | `` | a valid HTML string to parse for references `type` | `` | one of `stylesheets`, `scripts`, `imports`, `links`, `images` ## CLI ```sh $ npm install --global oust ``` ```sh Extract URLs to stylesheets, scripts, links, images or HTML imports from HTML Usage: $ oust <filename> <type> ``` #### Extract stylesheets references `<link rel="stylesheet">` ```sh $ oust myFile.html stylesheets ``` #### Extract script references `<script src>` ```sh $ oust myFile.html scripts ``` #### Extract HTML imports `<link rel="import">` ```sh $ oust myFile.html imports ``` #### Extract URL references `<a href>` ```sh $ oust myFile.html links ``` #### Extract image source references `<img src>` ```sh $ oust myFile.html images ``` ## License Released under an Apache 2 license. © Google 2014.