Skip to content

Question: how should I set Medium Featured Images as asset inside an asset field from Medium feed? #525

@Saboteur777

Description

@Saboteur777

Description

I would like to import entries from Medium, and add the posts featured images to the newly-created entries as an asset inside an asset field. The "Featured image" in Medium feeds are located inside the <content:encoded> tags, as you can see below (the ones inside the <figure></figure> tags):

This XML file does not appear to have any style information associated with it. The document tree is shown below.
<rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html" version="2.0">
<channel>
<title>
<![CDATA[ Stories by X Y on Medium ]]>
</title>
<description>
<![CDATA[ Stories by X Y on Medium ]]>
</description>
<link>
https://medium.com/@XY?source=rss-XXXXXXXXX------2
</link>
<image>
<url>
https://cdn-images-1.medium.com/fit/c/150/150/0*YEzdbka1EYGeQjWr.jpg
</url>
<title>Stories by X Y on Medium</title>
<link>
https://medium.com/@XY?source=rss-XXXXXXXXX------2
</link>
</image>
<generator>Medium</generator>
<lastBuildDate>Fri, 26 Apr 2019 08:40:02 GMT</lastBuildDate>
<atom:link href="https://medium.com/feed/@XY" rel="self" type="application/rss+xml"/>
<webMaster>
<![CDATA[ yourfriends@medium.com ]]>
</webMaster>
<atom:link href="http://medium.superfeedr.com" rel="hub"/>
<item>
<title>
<![CDATA[ Test 2 ]]>
</title>
<link>
https://medium.com/@XY/test-2-YYYYYYYYYY?source=rss-XXXXXXXXX------2
</link>
<guid isPermaLink="false">https://medium.com/p/YYYYYYYYYY</guid>
<dc:creator>
<![CDATA[ X Y ]]>
</dc:creator>
<pubDate>Thu, 25 Apr 2019 22:07:52 GMT</pubDate>
<atom:updated>2019-04-25T22:07:52.680Z</atom:updated>
<content:encoded>
<![CDATA[
<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*YhzWMaIBvbCUWVXXrKY03A.jpeg" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=YYYYYYYYYY" width="1" height="1">
]]>
</content:encoded>
</item>
<item>
<title>
<![CDATA[ Test entry ]]>
</title>
<link>
https://medium.com/@XY/test-entry-ZZZZZZZZZ?source=rss-XXXXXXXXX------2
</link>
<guid isPermaLink="false">https://medium.com/p/ZZZZZZZZZ</guid>
<dc:creator>
<![CDATA[ X Y ]]>
</dc:creator>
<pubDate>Thu, 25 Apr 2019 22:02:47 GMT</pubDate>
<atom:updated>2019-04-25T22:06:36.410Z</atom:updated>
<content:encoded>
<![CDATA[
<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*r_-gOtfVSrcvmmaNfD-x2w.jpeg" /></figure><p>test paragraph</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ZZZZZZZZZ" width="1" height="1">
]]>
</content:encoded>
</item>
</channel>
</rss>

If my instinct is right, I have to write an additional parser for Feed Me, right? If yes, how should I start to do that? :)

Steps to reproduce

  1. Use Feed Me
  2. Try to import entries from Medium, including their Featured image as an asset added to a field.

Additional info

  • Plugin version: 4.1.0
  • Craft version: 3.1.24

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions