Create the URL in the LyricWikia format
161242
def create_url(artist, song):
    """"""
    return (__BASE_URL__ +
            '/wiki/{artist}:{song}'.format(artist=urlize(artist),
                                           song=urlize(song)))
1335905
def random
      require 'open-uri'
      require 'nokogiri'

      @main_page_doc = Nokogiri::HTML(open('https://thecodinglove.com'))
      random_love_page_url = @main_page_doc.at_xpath("//a[@class='nav-link']/@href").to_s

      text, image_url = atUrl(random_love_page_url)

      markdown("------\n#{text}\n--\n![alt text](#{image_url} \"thecodinglove.com\")")

      [text, image_url]
    end
971021
async def _make_url(self, url: Text, request: 'Request') -> Text:
        

        if self.sign_webview:
            return await request.sign_url(url)

        return url
808966
def _build_url(self, host, sport, method, id, format, parameters):
        
        path = "/".join(filter(None, (sport, method, id)))
        url = "https://" + host + "/" + path + "." + format
        if parameters:
            paramstring = urllib.parse.urlencode(parameters)
            url = url + "?" + paramstring
        return url
659984
def wiki_create(self, title, body, other_names=None):
        
        params = {
            'wiki_page[title]': title,
            'wiki_page[body]': body,
            'wiki_page[other_names]': other_names
            }
        return self._get('wiki_pages.json', params, method='POST', auth=True)
948548
def urlize_tweet(tweet):
    
    if tweet['retweeted']:
        text = 'RT {user}: {text}'.format(
            user=TWITTER_USERNAME_URL.format(screen_name=tweet['user']['screen_name']),
            text=tweet['text'])
    else:
        text = tweet['text']

    for hashtag in tweet['entities']['hashtags']:
        text = text.replace(
            '#%s' % hashtag['text'],
            TWITTER_HASHTAG_URL.format(hashtag=hashtag['text']))

    for mention in tweet['entities']['user_mentions']:
        text = text.replace(
            '@%s' % mention['screen_name'],
            TWITTER_USERNAME_URL.format(screen_name=mention['screen_name']))

    urls = tweet['entities']['urls']
    for url in urls:
        text = text.replace(
            url['url'], TWITTER_URL.format(
                url=url['expanded_url'], display_url=url['display_url']))

    if 'media' in tweet['entities']:
        for media in tweet['entities']['media']:
            text = text.replace(
                media['url'],
                TWITTER_MEDIA_URL.format(
                    url=media['expanded_url'],
                    display_url=media['display_url']))

    return mark_safe(text)
890726
def download_wiki():
    """"""
    ambiguous = [i for i in l.UNITS.items() if len(i[1]) > 1]
    ambiguous += [i for i in l.DERIVED_ENT.items() if len(i[1]) > 1]
    pages = set([(j.name, j.uri) for i in ambiguous for j in i[1]])

    print
    objs = []
    for num, page in enumerate(pages):

        obj = {'url': page[1]}
        obj['_id'] = obj['url'].replace('https://en.wikipedia.org/wiki/', '')
        obj['clean'] = obj['_id'].replace('_', ' ')

        print '---> Downloading %s (%d of %d)' % \
              (obj['clean'], num + 1, len(pages))

        obj['text'] = wikipedia.page(obj['clean']).content
        obj['unit'] = page[0]
        objs.append(obj)

    path = os.path.join(l.TOPDIR, 'wiki.json')
    os.remove(path)
    json.dump(objs, open(path, 'w'), indent=4, sort_keys=True)

    print '\n---> All done.\n'
315764
function urlize(worker, text) {
  if (!linkify.test(text)) return escape(text)
  var matches = linkify.match(text)
  var lastIndex = 0;
  var buf = []
  for (var i = 0, match; (match = matches[i++]); ) {
    buf.push(escape(text.slice(lastIndex, match.index)))
    var link = {tag: true, name: 'a',
                attrs: {href: match.url}, 
                value: escape(match.type === 'hashtag' ? match.text : truncateUrl(match.text))}
    if (match.type === 'hashtag') {
      link.attrs['class'] = 'p-category'
    }
    else {
      link.attrs.rel = 'nofollow'
      link.attrs.target = '_blank'
    }
    buf = buf.concat(tagBuffer(worker, link, true))
    lastIndex = match.lastIndex
  }
  buf.push(escape(text.slice(lastIndex)))
  debug('urlize', matches, buf)
  return buf.join('')
}
275890
def prep(link):
    '''
    
    '''
    s, p, o = link[:3]
    s = URIRef(s)
    p = URIRef(p)
    o = URIRef(o) if isinstance(o, I) else Literal(o)
    return s, p, o
302920
def add_wikilink(self, title, href, **attrs):
        
        return WikiLinks(self.requester).create(self.id, title, href, **attrs)
1192920
def add_wikipage(self, slug, content, **attrs):
        
        return WikiPages(self.requester).create(
            self.id, slug, content, **attrs
        )
660575
def make_link(title, url, blank=False):
	
	attrs = 'href="%s"' % url
	if blank:
		attrs += ' target="_blank" rel="noopener noreferrer"'
	return '<a %s>%s</a>' % (attrs, title)
635946
def letras(song):
    
    translate = {
        '&': 'a',
        URLESCAPE: '',
        ' ': '-'
    }
    artist = song.artist.lower()
    artist = normalize(artist, translate)
    title = song.title.lower()
    title = normalize(title, translate)

    url = 'https://www.letras.com/{}/{}/'.format(artist, title)
    soup = get_url(url)
    if not soup:
        return ''

    found_title = soup.select_one('div.cnt-head_title h1')
    if not found_title:
        # The site didn't find lyrics and took us to the homepage
        return ''

    found_title = found_title.get_text()
    found_title = re.sub(r'[\W_]+', '', found_title.lower())
    if found_title != re.sub(r'[\W_]+', '', song.title.lower()):
        # The site took us to the wrong song page
        return ''

    content = soup.find('article')
    if not content:
        return ''

    text = ''
    for br in content.find_all('br'):
        br.replace_with('\n')

    for p in content.find_all('p'):
        text += p.get_text() + '\n\n'

    return text.strip()
138451
def lyricscom(song):
    
    artist = song.artist.lower()
    artist = normalize(artist, ' ', '+')
    title = song.title

    url = 'https://www.lyrics.com/artist/{}'.format(artist)
    soup = get_url(url)
    location = ''
    for a in soup.select('tr a'):
        if a.string.lower() == title.lower():
            location = a['href']
            break
    if location == '':
        return ''

    url = 'https://www.lyrics.com' + location
    soup = get_url(url)
    body = soup.find(id='lyric-body-text')
    if not body:
        return ''

    return body.get_text().strip()
1161923
def prepare_url(self, uri, kwargs):
        
        params = dict()
        for key in kwargs:
            if key in ('include', 'exclude', 'fields'):
                params.update({
                    key: ','.join(kwargs.get(key))
                })
            elif key in ('search', 'kind'):
                params.update({
                    key: kwargs.get(key)
                })

        if params:
            params = urlencode(params)
            uri = '%s?%s' % (uri, params)

        return uri
1332129
def create_url(self, db="", user="genome", host="genome-mysql.cse.ucsc.edu",
        password="", dialect="mysqldb"):
        
        if os.path.exists(db):
            db = "sqlite:///" + db

        # Is this a DB URL? If so, use it directly
        if self.db_regex.match(db):
            self.db = self.url = db
            self.dburl = db
            self.user = self.host = self.password = ""
        else:
            self.db = db
            if user == "genome" and host != "genome-mysql.cse.ucsc.edu":
                import getpass
                user = getpass.getuser()
            self.host = host
            self.user = user
            self.password = (":" + password) if password else ""
            self.dburl = self.url.format(db=self.db, user=self.user,
                host=self.host, password=self.password, dialect=dialect)
351868
def generate_url(scheme=None, host=None, port=None, path=None, query=None):
    
    url = ""
    if scheme is not None:
        url += "%s://" % scheme
    if host is not None:
        url += host
    if port is not None:
        url += ":%s" % str(port)
    if path is not None:
        url += ensure_url_path_starts_with_slash(path)
    if query is not None:
        url += "?%s" % (urlencode(query))
    return url