jameslawler / react-native-rss-parser

React Native compatible package to parse RSS feeds
MIT License
86 stars 42 forks source link

Provide 'content:encoded' element with HTML full text #6

Closed chuanhd closed 6 years ago

chuanhd commented 6 years ago

Hi @jameslawler , thank for your great parser.

Im using your parser in my project but encounter a problem that many RSS feed actually did not put content in description tag anymore, instead they put their full text in a tag. Something like https://en.blog.wordpress.com/feed/ has entries like

<item>
        <title>Introducing: A Diverse, Free Stock Photo Library</title>
        <link>https://en.blog.wordpress.com/2018/08/02/diverse-stock-photo-library-pexels/</link>
        <comments>https://en.blog.wordpress.com/2018/08/02/diverse-stock-photo-library-pexels/#comments</comments>
        <pubDate>Thu, 02 Aug 2018 13:00:05 +0000</pubDate>
        <dc:creator><![CDATA[Anne McCarthy]]></dc:creator>
                <category><![CDATA[Diversity & Inclusion]]></category>
        <category><![CDATA[New Features]]></category>
        <category><![CDATA[diversity]]></category>
        <category><![CDATA[images]]></category>
        <category><![CDATA[pexels]]></category>
        <category><![CDATA[photo blogging]]></category>
        <category><![CDATA[Photography]]></category>
        <category><![CDATA[stock photos]]></category>

        <guid isPermaLink="false">http://en.blog.wordpress.com/?p=40626</guid>
        <description><![CDATA[Diversity in visual representation matters.]]></description>
                <content:encoded><![CDATA[<p>As many site creators know, it’s daunting to find images to represent the message you&#8217;re trying to put out into the world &#8212; especially if you don’t have the equipment or time to make your own.</p>
<p>At WordPress.com, we’re constantly striving to make it as easy as possible to create beautiful websites that represent who you are and what you stand for. We&#8217;re excited to announce that we&#8217;ve been working hard with Pexels and other diversity-focused image-library partners so that everyone with a WordPress.com or Jetpack-connected site can realize their vision with the right stock photos.</p>
<p>To use these images, just head to your Media Library and select <strong>Free Photo Library</strong> before searching for any image you need. You can also do this from the <strong>Add Media</strong> option within a post or page:</p>
<p><img data-attachment-id="40627" data-permalink="https://en.blog.wordpress.com/2018/08/02/diverse-stock-photo-library-pexels/screen-shot-2018-08-01-at-7-28-04-pm/" data-orig-file="https://en-blog.files.wordpress.com/2018/08/screen-shot-2018-08-01-at-7-28-04-pm.png?w=720" data-orig-size="1252,522" data-comments-opened="1" data-image-meta="{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}" data-image-title="Screen Shot 2018-08-01 at 7.28.04 PM" data-image-description="" data-medium-file="https://en-blog.files.wordpress.com/2018/08/screen-shot-2018-08-01-at-7-28-04-pm.png?w=720?w=300" data-large-file="https://en-blog.files.wordpress.com/2018/08/screen-shot-2018-08-01-at-7-28-04-pm.png?w=720?w=720" class="alignnone size-full wp-image-40627" src="https://en-blog.files.wordpress.com/2018/08/screen-shot-2018-08-01-at-7-28-04-pm.png?w=720" alt="Screen Shot 2018-08-01 at 7.28.04 PM.png" srcset="https://en-blog.files.wordpress.com/2018/08/screen-shot-2018-08-01-at-7-28-04-pm.png?w=720 720w, https://en-blog.files.wordpress.com/2018/08/screen-shot-2018-08-01-at-7-28-04-pm.png?w=150 150w, https://en-blog.files.wordpress.com/2018/08/screen-shot-2018-08-01-at-7-28-04-pm.png?w=300 300w, https://en-blog.files.wordpress.com/2018/08/screen-shot-2018-08-01-at-7-28-04-pm.png?w=768 768w, https://en-blog.files.wordpress.com/2018/08/screen-shot-2018-08-01-at-7-28-04-pm.png?w=1024 1024w, https://en-blog.files.wordpress.com/2018/08/screen-shot-2018-08-01-at-7-28-04-pm.png 1252w" sizes="(max-width: 720px) 100vw, 720px"   /></p>
<h3>Free images representing a wide range of experiences</h3>
<p>In January 2018, we collaborated with Pexels to integrate their free stock-image library into WordPress.com. Since then, every user has had access to thousands of free, high-quality images at their fingertips! Knowing how diverse our community is, however, we didn’t stop there.</p>
<p>Stock-image libraries <a href="https://medium.com/@NikkyMill/where-to-find-free-stock-photos-of-people-of-color-f262b851a1b5">have historically struggled</a> to represent all experiences, and often excluded photos of people of color, people with disabilities, or non-binary individuals. Pexels is working to change that, and since partnering with them we&#8217;ve helped incorporate diversity-focused libraries to their collection. Ultimately, we believe it’s on us to help find a solution to this problem, and avoid generic stock images that often perpetuate stereotypes.</p>
<p>Our first partner in this effort was the <a href="https://www.wocintechchat.com/blog/wocintechphotos">Women of Color in Tech Stock Photos library</a> (WoCinTech for short). We were thrilled to work with them, as they were an earlier driver for these efforts. Christina Morillo, one of the project&#8217;s co-founders, had this awesome message to share:</p>
<blockquote><p>We started this collection to address the lack of visible representation of women of color engaging in technical tasks in stock images. Our mission was always twofold: Disrupt stock images and further representation of women/non-binary people in technology by making the photos accessible to all creators. We are thrilled to partner with Pexels and WordPress.com to further this mission and help creators like you represent who and what you stand for.</p></blockquote>
<p>Since adding their brilliant photos to Pexels, we’ve seen <a href="https://www.pexels.com/@divinetechygirl/stats/">their stats soar</a> with more than 70,000 downloads and 28 million image views:</p>
<p><img data-attachment-id="40628" data-permalink="https://en.blog.wordpress.com/2018/08/02/diverse-stock-photo-library-pexels/screen-shot-2018-08-01-at-7-28-59-pm/" data-orig-file="https://en-blog.files.wordpress.com/2018/08/screen-shot-2018-08-01-at-7-28-59-pm.png?w=720" data-orig-size="2550,692" data-comments-opened="1" data-image-meta="{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}" data-image-title="Screen Shot 2018-08-01 at 7.28.59 PM" data-image-description="" data-medium-file="https://en-blog.files.wordpress.com/2018/08/screen-shot-2018-08-01-at-7-28-59-pm.png?w=720?w=300" data-large-file="https://en-blog.files.wordpress.com/2018/08/screen-shot-2018-08-01-at-7-28-59-pm.png?w=720?w=720" class="alignnone size-full wp-image-40628" src="https://en-blog.files.wordpress.com/2018/08/screen-shot-2018-08-01-at-7-28-59-pm.png?w=720" alt="Screen Shot 2018-08-01 at 7.28.59 PM.png" srcset="https://en-blog.files.wordpress.com/2018/08/screen-shot-2018-08-01-at-7-28-59-pm.png?w=720 720w, https://en-blog.files.wordpress.com/2018/08/screen-shot-2018-08-01-at-7-28-59-pm.png?w=1437 1437w, https://en-blog.files.wordpress.com/2018/08/screen-shot-2018-08-01-at-7-28-59-pm.png?w=150 150w, https://en-blog.files.wordpress.com/2018/08/screen-shot-2018-08-01-at-7-28-59-pm.png?w=300 300w, https://en-blog.files.wordpress.com/2018/08/screen-shot-2018-08-01-at-7-28-59-pm.png?w=768 768w, https://en-blog.files.wordpress.com/2018/08/screen-shot-2018-08-01-at-7-28-59-pm.png?w=1024 1024w" sizes="(max-width: 720px) 100vw, 720px"   /></p>
<p>These statistics show how great the need and desire are for truly representative images online. What started out as a passion project of the <a href="https://www.wocintechchat.com/blog/wocintechphotos">WoCinTech group</a> has now reached more than 70,000 people in the span of a month. Since we introduced the free stock image library, WordPress.com users have already downloaded more than 1 million photos.</p>
<p><img data-attachment-id="40640" data-permalink="https://en.blog.wordpress.com/2018/08/02/diverse-stock-photo-library-pexels/computers-laptops-office-1181232/" data-orig-file="https://en-blog.files.wordpress.com/2018/08/computers-laptops-office-1181232.jpg?w=720" data-orig-size="6016,4016" data-comments-opened="1" data-image-meta="{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}" data-image-title="computers-laptops-office-1181232" data-image-description="" data-medium-file="https://en-blog.files.wordpress.com/2018/08/computers-laptops-office-1181232.jpg?w=720?w=300" data-large-file="https://en-blog.files.wordpress.com/2018/08/computers-laptops-office-1181232.jpg?w=720?w=720" class="alignnone size-full wp-image-40640" src="https://en-blog.files.wordpress.com/2018/08/computers-laptops-office-1181232.jpg?w=720" alt="computers-laptops-office-1181232" srcset="https://en-blog.files.wordpress.com/2018/08/computers-laptops-office-1181232.jpg?w=720 720w, https://en-blog.files.wordpress.com/2018/08/computers-laptops-office-1181232.jpg?w=1440 1440w, https://en-blog.files.wordpress.com/2018/08/computers-laptops-office-1181232.jpg?w=150 150w, https://en-blog.files.wordpress.com/2018/08/computers-laptops-office-1181232.jpg?w=300 300w, https://en-blog.files.wordpress.com/2018/08/computers-laptops-office-1181232.jpg?w=768 768w, https://en-blog.files.wordpress.com/2018/08/computers-laptops-office-1181232.jpg?w=1024 1024w" sizes="(max-width: 720px) 100vw, 720px"   /></p>
<p>Going forward, we’re thrilled to work with Pexels to bring other diverse image-library partners on board, and to expand the selection of images you can access.</p>
<h3>We need your help</h3>
<p>We&#8217;re continuing to add more image libraries! This is where we could use your help:</p>
<ul>
<li>Suggest in the comments below image libraries that we should reach out to that will help expand our offerings.</li>
<li>If you’re a photoblogger, <a href="https://www.pexels.com/submit-photos/?utm_source=wordpress">upload your images to Pexels</a> and immediately have them available for other WordPress users to find.</li>
<li>Become a part of future diversity-focused photo challenges on Pexels like <a href="https://www.pexels.com/challenges/pride-challenge-2018/">this recent one from Pride Month</a>.</li>
<li>If you’re a blogger or site owner, make an effort to use more diverse images when sharing content on your site.</li>
<li>If your company provides images for customers to use, we recommend integrating with <a href="https://www.pexels.com/">Pexels</a> to give your customers access to a library dedicated to diversity in images.</li>
<li>If you run an image library offering diverse images, comment below and we’ll get in touch with you!</li>
</ul>
<p>Happy WordPress-ing! <img src="https://s0.wp.com/wp-content/mu-plugins/wpcom-smileys/twemoji/2/72x72/1f642.png" alt="🙂" class="wp-smiley" style="height: 1em; max-height: 1em;" /></p>
<p><em><a href="https://www.pexels.com/@divinetechygirl">Photos</a> by Christina Morillo of WOCinTech from Pexels</em></p>
]]></content:encoded>
            <wfw:commentRss>https://en.blog.wordpress.com/2018/08/02/diverse-stock-photo-library-pexels/feed/</wfw:commentRss>
        <slash:comments>54</slash:comments>

        <media:thumbnail url="https://en-blog.files.wordpress.com/2018/08/casual-computers-hands-1181210.jpg" />
        <media:content url="https://en-blog.files.wordpress.com/2018/08/casual-computers-hands-1181210.jpg" medium="image">
            <media:title type="html">casual-computers-hands-1181210</media:title>
        </media:content>

        <media:content url="https://0.gravatar.com/avatar/0e2249a7de3404bc6d5207a45e911187?s=96&#38;d=retro" medium="image">
            <media:title type="html">annezazu</media:title>
        </media:content>

        <media:content url="https://en-blog.files.wordpress.com/2018/08/screen-shot-2018-08-01-at-7-28-04-pm.png" medium="image">
            <media:title type="html">Screen Shot 2018-08-01 at 7.28.04 PM.png</media:title>
        </media:content>

        <media:content url="https://en-blog.files.wordpress.com/2018/08/screen-shot-2018-08-01-at-7-28-59-pm.png" medium="image">
            <media:title type="html">Screen Shot 2018-08-01 at 7.28.59 PM.png</media:title>
        </media:content>

        <media:content url="https://en-blog.files.wordpress.com/2018/08/computers-laptops-office-1181232.jpg" medium="image">
            <media:title type="html">computers-laptops-office-1181232</media:title>
        </media:content>
    </item>

Could you provide an 'content:encoded' element with html full text?

jameslawler commented 6 years ago

Thanks for your feedback. I have added support for content:encoded as it is the default namespace defined by the RSS team - http://www.rssboard.org/rss-profile#namespace-elements-content-encoded.

I have mapped it to the item.content field (luckily it already existed for atom feeds).

I have pushed a new version of the package 1.3.0 to npm which includes the new mapping. Please open another issue if you have any problems with it.