
from BeautifulSoup import BeautifulSoup
import requests
import re

from toflib import Plugin

DOMAINS = [ "t.co/"
          ]

VIDEO_DOMAINS = [ "youtube"
                , "youtu.be"
                ]

def is_mini(url):
    for d in DOMAINS:
        if d in url:
            return True
    return False

def is_video(url):
    for d in VIDEO_DOMAINS:
        if d in url:
            return True
    return False

def urlExpand(url):
    r = requests.get(url)
    return r.url

def getTitle(url):
    r = requests.get(url)
    c = r.content
    s = BeautifulSoup(c)
    t = s.html.head.title.string
    return ''.join(t.split("\n")).strip()

class PluginExpand(Plugin):

    def on_url(self, url):
        if is_mini(url):
            try:
                exp = urlExpand(url)
                self.say(exp)
            except:
                pass

        if is_video(url):
            try:
                t = getTitle(url)
                self.say(t)
            except:
                pass


from BeautifulSoup import BeautifulSoup
import requests
import re

from toflib import Plugin

DOMAINS = [ "t.co/"
          , "tinyurl.com/"
          ]

VIDEO_DOMAINS = [ "youtube"
                , "youtu.be"
                ]

def is_mini(url):
    for d in DOMAINS:
        if d in url:
            return True
    return False

def is_video(url):
    for d in VIDEO_DOMAINS:
        if d in url:
            return True
    return False

def urlExpand(url):
    r = requests.get(url)
    return r.url

def getTitle(url):
    r = requests.get(url)
    c = r.content
    s = BeautifulSoup(c)
    t = s.html.head.title.string
    return ''.join(t.split("\n")).strip()

class PluginExpand(Plugin):

    def on_url(self, url):
        if is_mini(url):
            try:
                exp = urlExpand(url)
                self.say(exp)
            except:
                pass

        if is_video(url):
            try:
                t = getTitle(url)
                self.say(t)
            except:
                pass

Add tinyurl.com as a minifier
Add tinyurl.com as a minifier

  
  from BeautifulSoup import BeautifulSoup
  import requests
  import re
  
  from toflib import Plugin
  
  DOMAINS = [ "t.co/"
+           , "tinyurl.com/"
            ]
  
  VIDEO_DOMAINS = [ "youtube"
                  , "youtu.be"
                  ]
  
  def is_mini(url):
      for d in DOMAINS:
          if d in url:
              return True
      return False
  
  def is_video(url):
      for d in VIDEO_DOMAINS:
          if d in url:
              return True
      return False
  
  def urlExpand(url):
      r = requests.get(url)
      return r.url
  
  def getTitle(url):
      r = requests.get(url)
      c = r.content
      s = BeautifulSoup(c)
      t = s.html.head.title.string
      return ''.join(t.split("\n")).strip()
  
  class PluginExpand(Plugin):
  
      def on_url(self, url):
          if is_mini(url):
              try:
                  exp = urlExpand(url)
                  self.say(exp)
              except:
                  pass
  
          if is_video(url):
              try:
                  t = getTitle(url)
                  self.say(t)
              except:
                  pass
  
Add tinyurl.com as a minifier
## Code Before:

from BeautifulSoup import BeautifulSoup
import requests
import re

from toflib import Plugin

DOMAINS = [ "t.co/"
          ]

VIDEO_DOMAINS = [ "youtube"
                , "youtu.be"
                ]

def is_mini(url):
    for d in DOMAINS:
        if d in url:
            return True
    return False

def is_video(url):
    for d in VIDEO_DOMAINS:
        if d in url:
            return True
    return False

def urlExpand(url):
    r = requests.get(url)
    return r.url

def getTitle(url):
    r = requests.get(url)
    c = r.content
    s = BeautifulSoup(c)
    t = s.html.head.title.string
    return ''.join(t.split("\n")).strip()

class PluginExpand(Plugin):

    def on_url(self, url):
        if is_mini(url):
            try:
                exp = urlExpand(url)
                self.say(exp)
            except:
                pass

        if is_video(url):
            try:
                t = getTitle(url)
                self.say(t)
            except:
                pass

## Instruction:
Add tinyurl.com as a minifier
## Code After:

from BeautifulSoup import BeautifulSoup
import requests
import re

from toflib import Plugin

DOMAINS = [ "t.co/"
          , "tinyurl.com/"
          ]

VIDEO_DOMAINS = [ "youtube"
                , "youtu.be"
                ]

def is_mini(url):
    for d in DOMAINS:
        if d in url:
            return True
    return False

def is_video(url):
    for d in VIDEO_DOMAINS:
        if d in url:
            return True
    return False

def urlExpand(url):
    r = requests.get(url)
    return r.url

def getTitle(url):
    r = requests.get(url)
    c = r.content
    s = BeautifulSoup(c)
    t = s.html.head.title.string
    return ''.join(t.split("\n")).strip()

class PluginExpand(Plugin):

    def on_url(self, url):
        if is_mini(url):
            try:
                exp = urlExpand(url)
                self.say(exp)
            except:
                pass

        if is_video(url):
            try:
                t = getTitle(url)
                self.say(t)
            except:
                pass
