@@ -36,17 +36,21 @@ def _run(self):
36
36
if self .extracted :
37
37
return
38
38
_init_newsplease ()
39
- data = _NP .from_url (self .url )
40
- self .title = data .title
41
- self .description = data .description
42
- self .image_url = data .image_url
43
- self .language = data .language
44
- self .domain = data .source_domain
45
- self .text = data .maintext
46
- self .authors = data .authors
47
- self .date_publish = data .date_publish
48
- self .date_modify = data .date_modify
49
- self .extracted = True
39
+ try :
40
+ data = _NP .from_url (self .url )
41
+ self .title = data .title
42
+ self .description = data .description
43
+ self .image_url = data .image_url
44
+ self .language = data .language
45
+ self .domain = data .source_domain
46
+ self .text = data .maintext
47
+ self .authors = data .authors
48
+ self .date_publish = data .date_publish
49
+ self .date_modify = data .date_modify
50
+ self .extracted = True
51
+ except Exception as e :
52
+ logger .error (f'Error Parsing URL: { self .url } .\n { str (e )} ' )
53
+
50
54
51
55
52
56
@lazyclass
@@ -68,11 +72,13 @@ def parse(self):
68
72
return
69
73
self .extraction = Article (url = self .url )
70
74
self .extraction ._run ()
71
- self .text = self .extraction .text
75
+ if self .extraction .extracted :
76
+ self .text = self .extraction .text
72
77
73
78
async def async_parse (self ):
74
79
if self .extraction is not None :
75
80
return
76
81
self .extraction = Article (url = self .url )
77
82
self .extraction ._run ()
78
- self .text = self .extraction .text
83
+ if self .extraction .extracted :
84
+ self .text = self .extraction .text
0 commit comments