Return the links.

        This function is a convenience function for calling
        :meth:`iter_processed_text` and returning only the links.
324636
def iter_processed_links(self, file, encoding=None, base_url=None, context=False):
        '''
        '''
        if context:
            return [item for item in self.iter_processed_text(file, encoding, base_url) if item[1]]
        else:
            return [item[0] for item in self.iter_processed_text(file, encoding, base_url) if item[1]]
1169626
def get_duckduckgo_links(limit, params, headers):
	
	resp = s.get('https://duckduckgo.com/html', params = params, headers = headers)
	links = scrape_links(resp.content, engine = 'd')
	return links[:limit]
1144546
def links(self):
        """"""
        # <https://example.com/?page=2>; rel="next", <https://example.com/?page=34>; rel="last"'
        # becomes
        # {
        #     'last': {'rel': 'last', 'url': 'https://example.com/?page=34'},
        #     'next': {'rel': 'next', 'url': 'https://example.com/?page=2'},
        # },
        result = {}
        if 'Link' in self.headers:
            value = self.headers['Link']

            for part in re.split(r', *<', value):
                link = {}
                vs = part.split(';')

                # First section is always an url.
                link['url'] = vs.pop(0).strip('\'" <>')

                for v in vs:
                    if '=' in v:
                        key, v = v.split('=')
                        link[key.strip('\'" ')] = v.strip('\'" ')

                rkey = link.get('rel') or link['url']
                result[rkey] = link

        return result
486168
def iter_links_element(self, element):
        ''''''
        # reference: lxml.html.HtmlMixin.iterlinks()
        attrib = element.attrib
        tag = element.tag

        if tag == 'link':
            iterable = self.iter_links_link_element(element)
        elif tag == 'meta':
            iterable = self.iter_links_meta_element(element)
        elif tag in ('object', 'applet'):
            iterable = self.iter_links_object_element(element)
        elif tag == 'param':
            iterable = self.iter_links_param_element(element)
        elif tag == 'style':
            iterable = self.iter_links_style_element(element)
        elif tag == 'script':
            iterable = self.iter_links_script_element(element)
        else:
            iterable = self.iter_links_plain_element(element)

        # RSS/Atom
        if tag in ('link', 'url', 'icon'):
            iterable = itertools.chain(
                iterable, self.iter_links_element_text(element)
            )

        for link_info in iterable:
            yield link_info

        if 'style' in attrib and self.css_scraper:
            for link in self.css_scraper.scrape_links(attrib['style']):
                yield LinkInfo(
                    element=element, tag=element.tag, attrib='style',
                    link=link,
                    inline=True, linked=False,
                    base_link=None,
                    value_type='css',
                    link_type=LinkType.media,
                )
127774
def all_as_href(self):
        
        if not self.is_any and not self.is_none:
            return [element for element in self.get(self.typeof)]
        return []
647306
async def getlinks(url):
    """"""
    page = Linkfetcher(url)
    await page.linkfetch()
    for i, url in enumerate(page):
        return (i, url)
388046
def process_document(self, doc):
        

        raw = doc.select_segments("$.raw_content")[0]
        extractions = doc.extract(self.inferlink_extractor, raw)
        doc.store(extractions, "inferlink_extraction")
        return list()
686584
protected function getLinks()
    {
        $sLinks = '';
        foreach($this->xPaginator->getPages() as $page)
        {
            if($page['call'])
            {
                $sTemplate = ($page['isCurrent'] ? 'pagination::links/current' : 'pagination::links/enabled');
                $sLinks .= $this->xTemplate->render($sTemplate, ['call' => $page['call'], 'text' => $page['num']]);
            }
            else
            {
                $sLinks .= $this->xTemplate->render('pagination::links/disabled', ['text' => $page['num']]);
            }
        }
        return $sLinks;
    }
1120153
def extract_links(html):
        
        links = []
        soup = BeautifulSoup(html, 'html.parser')
        for link in soup.findAll('a'):
            href = link.get('href')
            if not href:
                continue
            if href.startswith('/'):
                href = 'https://www.reddit.com' + href
            links.append({'text': link.text, 'href': href})
        return links
1201183
def read_links(self, file, encoding=None):
        '''
        '''
        return [item[0] for item in self.iter_text(file, encoding) if item[1]]
668524
def fetchall_textdefs(ont):
    
    logging.info("fetching text defs for: "+ont)
    namedGraph = get_named_graph(ont)
    query = """
    prefix IAO: <http://purl.obolibrary.org/obo/IAO_>
    SELECT * WHERE {{
    GRAPH <{g}>  {{
      ?c IAO:0000115 ?d
    }}
    FILTER (!isBlank(?c))
    }}
    """.format(g=namedGraph)
    bindings = run_sparql(query)
    rows = [(r['c']['value'], r['d']['value']) for r in bindings]
    return rows
94365
def link(self, link, title, text):
        
        if self.anonymous_references:
            underscore = '__'
        else:
            underscore = '_'
        if title:
            return self._raw_html(
                '<a href="{link}" title="{title}">{text}</a>'.format(
                    link=link, title=title, text=text
                )
            )
        if not self.parse_relative_links:
            return '\ `{text} <{target}>`{underscore}\ '.format(
                target=link,
                text=text,
                underscore=underscore
            )
        else:
            url_info = urlparse(link)
            if url_info.scheme:
                return '\ `{text} <{target}>`{underscore}\ '.format(
                    target=link,
                    text=text,
                    underscore=underscore
                )
            else:
                link_type = 'doc'
                anchor = url_info.fragment
                if url_info.fragment:
                    if url_info.path:
                        # Can't link to anchors via doc directive.
                        anchor = ''
                    else:
                        # Example: [text](#anchor)
                        link_type = 'ref'
                doc_link = '{doc_name}{anchor}'.format(
                    # splittext approach works whether or not path is set. It
                    # will return an empty string if unset, which leads to
                    # anchor only ref.
                    doc_name=os.path.splitext(url_info.path)[0],
                    anchor=anchor
                )
                return '\ :{link_type}:`{text} <{doc_link}>`\ '.format(
                    link_type=link_type,
                    doc_link=doc_link,
                    text=text
                )
326635
def get_texts(self):
        
        with self.getstream() as text_stream:
            for i, line in enumerate(text_stream):
                line = to_unicode(line)
                line = (TweetCorpus.case_normalizer or passthrough)(line)
                # line = self.case_normalizer(line)
                if self.mask is not None and not self.mask[i]:
                    continue
                ngrams = []
                for ng in tokens2ngrams((TweetCorpus.tokenizer or str.split)(line), n=self.num_grams):
                    if self.ignore_matcher(ng):
                        continue
                    ngrams += [ng]
                if not (i % 1000):
                    print(line)
                    print(ngrams)
                yield ngrams
1177124
def get_book_links(links):
    
    book_links = []

    for link in links:
        data = DOWNER.download(link + "1")
        dom = dhtmlparser.parseString(data)

        book_links.extend(_parse_book_links(dom))

        max_page = _get_max_page(dom)
        if max_page == 1:
            continue

        for i in range(max_page - 1):
            data = DOWNER.download(link + str(i + 2))

            book_links.extend(
                _parse_book_links(
                    dhtmlparser.parseString(data)
                )
            )

    return book_links
1248348
def links(links = {})
      links.each_pair do |rel, uri|
        link rel, uri if uri
      end
    end
322562
def process_document(self, doc):
        

        segment = doc.select_segments("target_text")[0]

        for e in self.e_list:
            res = doc.extract(e, segment)
            doc.store(res, e.name)
        return list()
132198
def find_links (url_data, callback, tags):
    
    # construct parser object
    handler = linkparse.LinkFinder(callback, tags)
    parser = htmlsax.parser(handler)
    if url_data.charset:
        parser.encoding = url_data.charset
    handler.parser = parser
    # parse
    try:
        parser.feed(url_data.get_content())
        parser.flush()
    except linkparse.StopParse as msg:
        log.debug(LOG_CHECK, "Stopped parsing: %s", msg)
        pass
    # break cyclic dependencies
    handler.parser = None
    parser.handler = None