Ejemplo n.º 1
0
    def test_google(self):
        self.args.urls = ["http://google.com"]
        s = gettitle.get_titles_and_urls(self.br, self.args)[0][:-1]
        title, url = s.split('\n')

        self.assertEqual("Google", title)
        self.assertTrue("https://www.google.com" in url)
Ejemplo n.º 2
0
    def test_ptt_normal(self):
        self.args.urls = [
            "https://www.ptt.cc/bbs/joke/M.1442444784.A.1C4.html"
        ]
        s = gettitle.get_titles_and_urls(self.br, self.args)[0][:-1]
        title, url = s.split('\n')

        self.assertEqual(
            "[豪洨] 成語新解--弘庭戴套 - 看板 joke - 批踢踢實業坊",
            title
        )
        self.assertEqual(
            "https://www.ptt.cc/bbs/joke/M.1442444784.A.1C4.html",
            url
        )
Ejemplo n.º 3
0
    def test_dcard(self):
        ''' grab dcard title with dryscrape which supports javascript. '''

        self.args.urls = [
            "https://www.dcard.tw/f/bg/p/706907"
        ]
        s = gettitle.get_titles_and_urls(self.br, self.args)[0][:-1]
        title, url = s.split('\n')

        self.assertEqual(
            "駕照 附贈閃光一枚",
            title
        )
        self.assertEqual(
            "https://www.dcard.tw/f/bg/p/706907",
            url
        )
Ejemplo n.º 4
0
    def test_ruten(self):
        ''' Ruten title is returned in big5 format. '''

        self.args.urls = [
            "http://www.ruten.com.tw/"
        ]
        s = gettitle.get_titles_and_urls(self.br, self.args)[0][:-1]
        title, url = s.split('\n')

        self.assertEqual(
            "露天拍賣-台灣 NO.1 拍賣網站",
            title
        )
        self.assertEqual(
            "http://www.ruten.com.tw/",
            url
        )
Ejemplo n.º 5
0
    def test_hackpad(self):
        ''' Hackpad title is returned in unicode format. '''

        self.args.urls = [
            "https://hackpad.com/iToolMan-T-cOJlcwLntzx"
        ]
        s = gettitle.get_titles_and_urls(self.br, self.args)[0][:-1]
        title, url = s.split('\n')

        self.assertEqual(
            "iToolMan 工具人帽T討論 - hackpad.com",
            title
        )
        self.assertEqual(
            "https://hackpad.com/iToolMan-T-cOJlcwLntzx",
            url
        )
Ejemplo n.º 6
0
    def test_ptt_ask_over_18(self):
        ''' Need to submit "yes" to the action="/ask/over18/" form '''

        self.args.urls = [
            "https://www.ptt.cc/bbs/Gossiping/M.1441715120.A.72E.html"
        ]
        s = gettitle.get_titles_and_urls(self.br, self.args)[0][:-1]
        title, url = s.split('\n')

        self.assertEqual(
            "Re: [爆卦] 9/19 台灣失智症協會 一日志工 - 看板 Gossiping - 批踢踢實業坊",
            title
        )
        self.assertEqual(
            "https://www.ptt.cc/bbs/Gossiping/M.1441715120.A.72E.html",
            url
        )