@@ -15,7 +15,6 @@ class TechCrunch:
15
15
"""
16
16
17
17
def get_articles (self , category ):
18
-
19
18
"""
20
19
Class - `TechCrunch`
21
20
Example:
@@ -34,7 +33,8 @@ def get_articles(self, category):
34
33
}
35
34
"""
36
35
url = (
37
- "https://techcrunch.com/category/" + category .replace (" " , "-" ).lower ()
36
+ "https://techcrunch.com/category/" +
37
+ category .replace (" " , "-" ).lower ()
38
38
)
39
39
try :
40
40
res = requests .get (url )
@@ -78,7 +78,8 @@ def get_articles(self, category):
78
78
.encode ("ascii" , "ignore" )
79
79
.decode ()
80
80
)
81
- links = n .find_all ("a" , class_ = "post-block__title__link" , href = True )
81
+ links = n .find_all (
82
+ "a" , class_ = "post-block__title__link" , href = True )
82
83
link = links [0 ]["href" ]
83
84
articles_data ["articles" ].append (
84
85
{
@@ -100,7 +101,6 @@ def get_articles(self, category):
100
101
return ejson
101
102
102
103
def search (self , topic ):
103
-
104
104
"""
105
105
Class - `TechCrunch`
106
106
Example:
@@ -125,11 +125,13 @@ def search(self, topic):
125
125
126
126
articles_data = {"articles" : []}
127
127
128
- articles = soup .find_all ("li" , class_ = "ov-a mt-0 pt-26 pb-26 bt-dbdbdb" )
128
+ articles = soup .find_all (
129
+ "li" , class_ = "ov-a mt-0 pt-26 pb-26 bt-dbdbdb" )
129
130
for i in articles :
130
131
name = i .find ("a" , class_ = "fz-20 lh-22 fw-b" ).getText ()
131
132
desc = i .find ("p" , class_ = "fz-14 lh-20 c-777" ).getText ()
132
- img = i .find ("img" , class_ = "s-img mr-10 s-img-errchk" , src = True )
133
+ img = i .find (
134
+ "img" , class_ = "s-img mr-10 s-img-errchk" , src = True )
133
135
image = img ["src" ]
134
136
author = i .find ("span" , class_ = "mr-15" ).getText ()
135
137
date = i .find ("span" , class_ = "pl-15 bl-1-666" ).getText ()
0 commit comments