@@ -39,19 +39,24 @@ class TestYahooNewsEngine(SearxTestCase):
39 self.assertEqual(yahoo_news.response(response), [])
39 self.assertEqual(yahoo_news.response(response), [])
41 html = """
41 html = """
42− <div class="res">
42+ <ol class=" reg searchCenterMiddle">
43− <div>
43+ <li class="first">
44+ <div class="compTitle">
45− <a class="yschttl spt" href="http://this.is.the.url" target="_blank">
46+ <a class="yschttl spt" href="http://this.is.the.url" target="_blank">
47− the <b>title</b>...
48+ the <b>title</b>...
51− <span class="url">Business via Yahoo! Finance</span> <span class="timestamp">Feb 03 09:45am</span>
53+ <span class="cite">Business via Yahoo!</span>
54+ <span class="tri fc-2nd ml-10">May 01 10:00 AM</span>
52− <div class="abstr">
56+ <div class="compText">
53− This is the content
57+ This is the content
57 response = mock.Mock(text=html)
62 response = mock.Mock(text=html)
@@ -63,48 +68,59 @@ class TestYahooNewsEngine(SearxTestCase):
63 self.assertEqual(results[0]['content'], 'This is the content')
68 self.assertEqual(results[0]['content'], 'This is the content')
65 html = """
70 html = """
66− <div class="res">
71+ <ol class=" reg searchCenterMiddle">
67− <div>
72+ <li class="first">
73+ <div class="compTitle">
69− <a class="yschttl spt" href="http://this.is.the.url" target="_blank">
75+ <a class="yschttl spt" href="http://this.is.the.url" target="_blank">
71− the <b>title</b>...
77+ the <b>title</b>...
75− <span class="url">Business via Yahoo!</span> <span class="timestamp">2 hours, 22 minutes ago</span>
82+ <span class="cite">Business via Yahoo!</span>
83+ <span class="tri fc-2nd ml-10">2 hours, 22 minutes ago</span>
76− <div class="abstr">
85+ <div class="compText">
77− This is the content
86+ This is the content
80− <div class="res">
90+ <div class="compTitle">
83− <a class="yschttl spt" href="http://this.is.the.url" target="_blank">
92+ <a class="yschttl spt" href="http://this.is.the.url" target="_blank">
85− the <b>title</b>...
94+ the <b>title</b>...
89− <span class="url">Business via Yahoo!</span> <span class="timestamp">22 minutes ago</span>
99+ <span class="cite">Business via Yahoo!</span>
100+ <span class="tri fc-2nd ml-10">22 minutes ago</span>
90− <div class="abstr">
102+ <div class="compText">
91− This is the content
103+ This is the content
94− <div class="res">
107+ <div class="compTitle">
97− <a class="yschttl spt" href="http://this.is.the.url" target="_blank">
109+ <a class="yschttl spt" href="http://this.is.the.url" target="_blank">
99− the <b>title</b>...
111+ the <b>title</b>...
103− <span class="url">Business via Yahoo!</span> <span class="timestamp">Feb 03 09:45am 1900</span>
116+ <span class="cite">Business via Yahoo!</span>
117+ <span class="tri fc-2nd ml-10">Feb 03 09:45AM 1900</span>
104− <div class="abstr">
119+ <div class="compText">
105− This is the content
120+ This is the content
109 response = mock.Mock(text=html)
125 response = mock.Mock(text=html)
110 results = yahoo_news.response(response)
126 results = yahoo_news.response(response)
@@ -114,30 +130,3 @@ class TestYahooNewsEngine(SearxTestCase):
114 self.assertEqual(results[0]['url'], 'http://this.is.the.url/')
130 self.assertEqual(results[0]['url'], 'http://this.is.the.url/')
115 self.assertEqual(results[0]['content'], 'This is the content')
131 self.assertEqual(results[0]['content'], 'This is the content')
116 self.assertEqual(results[2]['publishedDate'].year, datetime.now().year)
132 self.assertEqual(results[2]['publishedDate'].year, datetime.now().year)
119− <li class="b_algo" u="0|5109|4755453613245655|UAGjXgIrPH5yh-o5oNHRx_3Zta87f_QO">
121− <div class="sb_tlst">
123− <a href="http://this.should.be.the.link/" h="ID=SERP,5124.1">
124− <strong>This</strong> should be the title</a>
127− <div class="sb_meta">
129− <strong>this</strong>.meta.com</cite>
130− <span class="c_tlbxTrg">
131− <span class="c_tlbxH" H="BASE:CACHEDPAGEDEFAULT" K="SERP,5125.1">
136− <strong>This</strong> should be the content.</p>
140− response = mock.Mock(text=html)
141− results = yahoo_news.response(response)
142− self.assertEqual(type(results), list)
143− self.assertEqual(len(results), 0)