xml-to-json icon indicating copy to clipboard operation
xml-to-json copied to clipboard

update to retrieve image for medium posts

Open jorniks opened this issue 3 years ago • 3 comments

This pull request loops through JSON resulting object and gets post images exposing them to postImage variable.

jorniks avatar Apr 21 '22 17:04 jorniks

Hi @jorniks, thanks for submitting an improvement to the repo. When you say "image for medium post", are you referring to Medium.com? If you can elaborate what you're trying to do and how this help, I'd appreciate it.

ethanraevan avatar Apr 21 '22 20:04 ethanraevan

Oh sorry for my poor documentation skill. I was indeed referring to medium.com.

The body of posts on medium is packed in an XML tag name encoded which houses the images and texts of the post. I looped searched through the encoded variable in the resulting JSON object to find and pick out the first image in the post and add it to the JSON object using postImage variable.

This update will improve result efficiency for those who are interested in grabbing and displaying an image from the posts made on medium.com. Where no image is found on the post, the JSON object is not modified but returned in its original state.

jorniks avatar Apr 22 '22 22:04 jorniks

Got it, looks great. I also use this to convert my Medium feed to JSON. I ended up using regex to get the image.

Although I like this feature, it's specific to just Medium XMLs right now. I'm thinking this can be expanded to pull additional information from Medium as a new feature.

ethanraevan avatar Apr 26 '22 11:04 ethanraevan