xml-to-json
xml-to-json copied to clipboard
update to retrieve image for medium posts
This pull request loops through JSON resulting object and gets post images exposing them to postImage variable.
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.
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.
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.