File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -55,7 +55,7 @@ def get_images(self, news):
5555 for feed in news :
5656 images = feed .media_content
5757 for number_of_image , image in enumerate (images ):
58- if not image :
58+ if not image or image . endswith ( '.mp4' ) :
5959 continue
6060 image = self .check_image_link (image )
6161 response , content = h .request (image )
@@ -75,6 +75,7 @@ def check_image_link(image_link):
7575 where_sub_link = image_link .rfind ('http' )
7676 if where_sub_link :
7777 return image_link [where_sub_link :]
78+ return image_link
7879
7980
8081class HtmlConverter (ConverterBase ):
@@ -181,8 +182,8 @@ def add_description(self, description):
181182
182183 def add_images_from_the_feed (self , id , media_content ):
183184 '''Method that adds images from the news to document'''
184- for number_of_image in range ( len ( media_content ) ):
185- if not media_content [ 0 ] :
185+ for number_of_image , image_link in enumerate ( media_content ):
186+ if not image_link or image_link . endswith ( '.mp4' ) :
186187 continue
187188 self .set_x (50 )
188189 self .image (path .join (self .dir_with_images , f'{ id } { number_of_image } .png' ), w = 120 , h = 80 )
You can’t perform that action at this time.
0 commit comments