@@ -53,13 +53,14 @@ def items(self):
5353
5454 post ["num" ] = 0
5555 hashes = set ()
56- for kind , url , name in itertools .chain .from_iterable (
56+ for kind , file , url , name in itertools .chain .from_iterable (
5757 g (post ) for g in generators ):
5858 fhash = self ._filehash (url )
5959 if fhash not in hashes or not fhash :
6060 hashes .add (fhash )
6161 post ["hash" ] = fhash
6262 post ["type" ] = kind
63+ post ["file" ] = file
6364 post ["num" ] += 1
6465 text .nameext_from_url (name , post )
6566 if text .ext_from_url (url ) == "m3u8" :
@@ -86,15 +87,15 @@ def _postfile(self, post):
8687 name = url
8788 else :
8889 name = self ._filename (url ) or url
89- return (("postfile" , url , name ),)
90+ return (("postfile" , postfile , url , name ),)
9091 return ()
9192
9293 def _images (self , post ):
9394 if images := post .get ("images" ):
9495 for image in images :
9596 if url := self ._images_url (image ):
9697 name = image .get ("file_name" ) or self ._filename (url ) or url
97- yield "image" , url , name
98+ yield "image" , image , url , name
9899
99100 def _images_url (self , image ):
100101 return image .get ("download_url" )
@@ -109,24 +110,24 @@ def _image_large(self, post):
109110 if image := post .get ("image" ):
110111 if url := image .get ("large_url" ):
111112 name = image .get ("file_name" ) or self ._filename (url ) or url
112- return (("image_large" , url , name ),)
113+ return (("image_large" , image , url , name ),)
113114 return ()
114115
115116 def _attachments (self , post ):
116117 for attachment in post .get ("attachments" ) or ():
117118 if url := self .request_location (attachment ["url" ], fatal = False ):
118- yield "attachment" , url , attachment ["name" ]
119+ yield "attachment" , attachment , url , attachment ["name" ]
119120
120121 for attachment in post .get ("attachments_media" ) or ():
121122 if url := attachment .get ("download_url" ):
122- yield "attachment" , url , attachment ["file_name" ]
123+ yield "attachment" , attachment , url , attachment ["file_name" ]
123124
124125 def _content (self , post ):
125126 if content := post .get ("content" ):
126127 for img in text .extract_iter (
127128 content , '<img data-media-id="' , '>' ):
128129 if url := text .extr (img , 'src="' , '"' ):
129- yield "content" , url , self ._filename (url ) or url
130+ yield "content" , None , url , self ._filename (url ) or url
130131
131132 def posts (self ):
132133 """Return all relevant post objects"""
0 commit comments